Open coliu19 opened 1 year ago
Seems like the same problem as in the #2506
Seems like the same problem as in the #2506
Actually not the same.
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 https://github.com/stoplightio/spectral/issues/2506 was saying.
Hi, anything unclear for this issue? I will add if any.
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
52:13 error oas3-schema Property "schema" is not expected to be here. components.schemas.Pet
spectral-cli 6.8.021: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