You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When defining a readOnly or writeOnly property on a component, the linter does not take that into consideration when validating examples for request bodies or response bodies.
For example, if I defined a component with an id property that was defined as readOnly, I would expect that:
In a requestBody, the id field is disallowed in the examples, because it is "read only"
In a response, the id field is required to be present in examples, because it is "required"
What I actually see is that the property is required in both the request body and the response, with the following error:
Message : "example" property must have required property "id"
Rule : oas3-valid-media-example
Path : components.requestBodies.ReplaceEntityRequest.content.application/json.example
The text was updated successfully, but these errors were encountered:
@rliebz I think you're correct, I would expect the same behavior you've described above. I hadn't noticed this before. Unfortunately, the rule oas3-valid-media-example is coming from Spectral's own ruleset, which we import into ours. You might want to open up an issue against their repo for their awareness
Version: 0.88.3
When defining a
readOnly
orwriteOnly
property on a component, the linter does not take that into consideration when validating examples for request bodies or response bodies.For example, if I defined a component with an
id
property that was defined asreadOnly
, I would expect that:requestBody
, theid
field is disallowed in the examples, because it is "read only"response
, theid
field is required to be present in examples, because it is "required"What I actually see is that the property is required in both the request body and the response, with the following error:
The text was updated successfully, but these errors were encountered: