mirror of
https://github.com/LukeHagar/redocly-cli.git
synced 2025-12-07 04:21:11 +00:00
refactor: split in two packages: core and cli (#223)
This commit is contained in:
22
packages/core/src/rules/common/parameter-description.ts
Normal file
22
packages/core/src/rules/common/parameter-description.ts
Normal file
@@ -0,0 +1,22 @@
|
||||
import { Oas3Rule, Oas2Rule } from '../../visitors';
|
||||
import { Oas2Parameter } from '../../typings/swagger';
|
||||
import { Oas3Parameter } from '../../typings/openapi';
|
||||
import { 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']),
|
||||
});
|
||||
}
|
||||
},
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user