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
Describe the bug
In an oas3 spec's response schema, I used schema: $ref without content keys etc around which is a oas2 format. Then spectral will raise Property "schema" is not expected to be here which is correct. But it did not show the correct path and line number.
Run this CLI command spectral lint -r validation.js ref.json
See error
spectral-cli 6.5.1: 52:13 error oas3-schema Property "schema" is not expected to be here. components.schemas.Pet
spectral-cli 6.8.0 21:11 error oas3-schema Property "schema" is not expected to be here. paths
Expected behavior
The output should be 32:22 error oas3-schema Property "schema" is not expected to be here. paths./pets/{petId}.get.responses[200].schema
Environment (remove any that are not applicable):
Library version: [e.g. 3.0.0]
OS: [MacOS 13.4.1]
Additional context paths./pets/{petId}.get.responses[200]
the responses have additional properties "schema", which violates the oas3 schema spec here: https://github.com/OAI/OpenAPI-Specification/blob/main/schemas/v3.0/schema.json#L930.
The correct syntax is actually shown on paths./pets/{petId}.get.responses[202].
oas3-schema rule behaves differently in two spectral versions. Both did not show the correct path and line number.
This is related to "ref" resolve. If I go to node_modules, and add resolved: false to the oas3-schema rule, it will show the correct result.
So the fix may be
override the oas3-schema rule in my own ruleset. Can someone show me how to do this? Did not try out yet.
I first find this issue with spectral-cli 6.5.1, which use spectral-core version of "1.14.1", It wrongly point the error deep into the $ref's inner which actually it has nothing to do with it. The actual error is in additional "schema" key is not allowed.
Then I upgrade spectral-cli to the newest version, which use spectral core 1.18.2, to see if this issue was fixed in the newest version. Happened to see it behave differently by just showing the path, which #2506 was saying.
Describe the bug
In an oas3 spec's response schema, I used
schema: $ref
withoutcontent
keys etc around which is a oas2 format. Then spectral will raiseProperty "schema" is not expected to be here
which is correct. But it did not show the correct path and line number.To Reproduce
spectral lint -r validation.js ref.json
spectral-cli 6.5.1:
52:13 error oas3-schema Property "schema" is not expected to be here. components.schemas.Pet
spectral-cli 6.8.0
21:11 error oas3-schema Property "schema" is not expected to be here. paths
Expected behavior
The output should be
32:22 error oas3-schema Property "schema" is not expected to be here. paths./pets/{petId}.get.responses[200].schema
Environment (remove any that are not applicable):
Additional context
paths./pets/{petId}.get.responses[200]
the responses have additional properties "schema", which violates the oas3 schema spec here: https://github.com/OAI/OpenAPI-Specification/blob/main/schemas/v3.0/schema.json#L930.
The correct syntax is actually shown on
paths./pets/{petId}.get.responses[202]
.oas3-schema rule behaves differently in two spectral versions. Both did not show the correct path and line number.
This is related to "ref" resolve. If I go to node_modules, and add
resolved: false
to the oas3-schema rule, it will show the correct result.So the fix may be
The text was updated successfully, but these errors were encountered: