22 lines
753 B
Plaintext
22 lines
753 B
Plaintext
import type { Arazzo1Rule } from '../../visitors';
|
|
import type { UserContext } from '../../walk';
|
|
|
|
export const SourceDescriptionType: Arazzo1Rule = () => {
|
|
return {
|
|
SourceDescriptions: {
|
|
enter(sourceDescriptions, { report, location }: UserContext) {
|
|
if (!sourceDescriptions.length) return;
|
|
for (const sourceDescription of sourceDescriptions) {
|
|
if (!['openapi', 'arazzo'].includes(sourceDescription?.type)) {
|
|
report({
|
|
message:
|
|
'The `type` property of the `sourceDescription` object must be either `openapi` or `arazzo`.',
|
|
location: location.child([sourceDescriptions.indexOf(sourceDescription)]),
|
|
});
|
|
}
|
|
}
|
|
},
|
|
},
|
|
};
|
|
};
|