@redocly/openapi-core
Version:
See https://github.com/Redocly/redocly-cli
31 lines • 1.42 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,
});
}
if (serializedValue !== undefined && externalValue !== undefined) {
report({
message: "The 'serializedValue' and 'externalValue' fields of an example object are mutually exclusive.",
location: location,
});
}
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(),
});
}
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(),
});
}
},
};
};
//# sourceMappingURL=spec-example-values.js.map