API documentation must precisely describe method behavior, especially return values and cardinality. Inaccurate descriptions mislead developers about what methods actually return, potentially causing runtime errors or incorrect assumptions.
API documentation must precisely describe method behavior, especially return values and cardinality. Inaccurate descriptions mislead developers about what methods actually return, potentially causing runtime errors or incorrect assumptions.
Key areas to verify:
Example of incorrect vs correct documentation:
// ❌ Incorrect - misleading about nullability
/**
* Find one User that matches the filter.
*/
findUnique(args) { ... }
// ✅ Correct - accurate about possible null return
/**
* Returns User that matches the filter or `null` if nothing is found.
*/
findUnique(args) { ... }
// ❌ Incorrect - wrong cardinality
/**
* Find one or more Users that matches the filter.
*/
findMany(args) { ... }
// ✅ Correct - accurate cardinality
/**
* Find zero or more Users that matches the filter.
*/
findMany(args) { ... }
This prevents developers from making incorrect assumptions about method behavior and reduces debugging time caused by unexpected null values or empty results.
Enter the URL of a public GitHub repository