@redocly/openapi-core
Version:
See https://github.com/Redocly/redocly-cli
35 lines • 1.79 kB
JavaScript
export const SpecExampleValues = () => {
return {
Example({ value, externalValue, dataValue, serializedValue }, { report, location }) {
if (value !== undefined && externalValue !== undefined) {
report({
message: "The 'value' and 'externalValue' fields of an example object are mutually exclusive.",
location: location,
reference: 'https://redocly.com/docs/cli/rules/oas/spec-example-values',
});
}
if (serializedValue !== undefined && externalValue !== undefined) {
report({
message: "The 'serializedValue' and 'externalValue' fields of an example object are mutually exclusive.",
location: location,
reference: 'https://redocly.com/docs/cli/rules/oas/spec-example-values',
});
}
if (value !== undefined && dataValue !== undefined) {
report({
message: "The 'value' filed must be absent if 'dataValue' is present in an example object.",
location: location.child('value').key(),
reference: 'https://redocly.com/docs/cli/rules/oas/spec-example-values',
});
}
if (value !== undefined && serializedValue !== undefined) {
report({
message: "The 'value' filed must be absent if 'serializedValue' is present in an example object.",
location: location.child('value').key(),
reference: 'https://redocly.com/docs/cli/rules/oas/spec-example-values',
});
}
},
};
};
//# sourceMappingURL=spec-example-values.js.map