Files
redocly-cli/packages/core/src/rules/common/parameter-description.ts
Andrew Tatomyr d0fc69c2bb chore: update eslint to sort out imports (#1655)
* chore: update eslint to sort out imports

* turn warnings into errrors
2024-08-12 15:18:29 +08:00

23 lines
809 B
TypeScript

import type { Oas3Rule, Oas2Rule } from '../../visitors';
import type { Oas2Parameter } from '../../typings/swagger';
import type { Oas3Parameter } from '../../typings/openapi';
import type { UserContext } from '../../walk';
export const ParameterDescription: Oas3Rule | Oas2Rule = () => {
return {
Parameter(parameter: Oas2Parameter | Oas3Parameter, { report, location }: UserContext) {
if (parameter.description === undefined) {
report({
message: 'Parameter object description must be present.',
location: { reportOnKey: true },
});
} else if (!parameter.description) {
report({
message: 'Parameter object description must be non-empty string.',
location: location.child(['description']),
});
}
},
};
};