-
Notifications
You must be signed in to change notification settings - Fork 148
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
no-invalid-media-type-examples | not working as expected #919
Comments
Note for our team: I wonder if we have tests with |
@adamaltman we have tests for the no-example-value-and-externalValue rule, however we are not resolving |
@tatomyr does the tool compare examples with the response schema? from your comment, it sounds like this validation is not performed but the error provided is highlighting my example external schema file in VS Code. |
@jeremyfiel do you mean the highlighted file is being referenced by |
Yes, I can show you on slack if you want to see |
@jeremyfiel sure, feel free to ping me: [email protected] |
i've tried to make a solid example of different locations and usage of I'm asking for Redocly to support I may be able to provide some development effort from our internal tooling team to make this happen. If there is interest, we can arrange further discussion for how you would like the feature added. |
Thanks for summing it up! |
I found a workaround to it's not super pretty, but it seems to work ok. Because the ## external example file ./examples/confirmMessage-example_v01.json
{
"summary": "confirmMessage-example",
"value": {
"confirmMessageID": "391708e2-b82a-4e40-8079-29256022a85d",
"processStatus": "success"
}
} ## oas definition
"responses": {
"400": {
"description": "Bad Request",
"headers": {
...
},
"content": {
"application/json": {
"schema": {
"$ref": "../../../common/shared/confirm-message-schema_v03.json"
},
"examples": {
"confirmMessage": {
"$ref": "./examples/confirmMessage-example_v01.json"
}
}
}
}
}
} |
We should be careful about assuming that we can resolve/parse The workaround here, using (just noticed we should wish a happy birthday to this issue, I thought it had been open a while! 🎂 ) |
I thnk it's reasonable to expect the use of $ref over externalValue. You're right about the intention is to express non-json/yaml strings. Because it accepts a uri-reference I think checking for a filename extension prior to validation would be a reasonable compromise to enable this functionality. It does check the example but it fails with |
Still to be implemented for the lint command. |
Describe the bug
i've looked at the OAS schema and it uses either a ref or example object. We are using an example schema in our definition but the external file is not a valid example per the linter. I can't share the full schema for a repo of the issue but my external schema file is matching the expected response body schema, is there any reason why the linter says it should be
type object
? my external document is a validuri
openapi.json
Response body schema
Example
OAS meta schema
The text was updated successfully, but these errors were encountered: