Spectral wrongly raises an error when using "reserved" fields as properties
properties:
enum:
type: object
description: An object whose properties are the only possible values of a functionality.
Now spectral fails to understand that this is treated as a field of our schema, and raises an error treating it as a type (some values have been replaced with xxxx as they are internal for demonstration purposes):
683:28 warning duplicated-entry-in-enum "enum" property type must be array paths./xxxx.get.responses[200].content.application/json.examples['xxxxx'].value.xxxxx.enum
698:28 warning duplicated-entry-in-enum "enum" property type must be array paths./xxxx.get.responses[200].content.application/json.examples['xxxx'].value.xxxxx.enum
731:28 warning duplicated-entry-in-enum "enum" property type must be array paths./xxxx.get.responses[200].content.application/json.examples['xxxx'].value.xxxxx.enum
✖ 154 problems (89 errors, 65 warnings, 0 infos, 0 hints)
On the other hand, redoc linting is able to detect that the enum above is treated as a property (the 154 errors reported from spectral relate to the enum used a property).
Warning was generated by the tag-description rule.
./v2/schemas/xxxx/openapi.yaml: validated in 88ms
Woohoo! Your OpenAPI definition is valid. 🎉
You have 1 warning.
To Reproduce
Create an object that uses enum (as an example) as it's property
properties:
enum:
type: object
description: An object whose properties are the only possible values of a functionality.
Expected behavior
The linter should not treat enum as the type but as a property
Spectral wrongly raises an error when using "reserved" fields as properties
Now spectral fails to understand that this is treated as a field of our schema, and raises an error treating it as a
type(some values have been replaced withxxxxas they are internal for demonstration purposes):On the other hand,
redoclinting is able to detect that the enum above is treated as a property (the 154 errors reported from spectral relate to theenumused a property).To Reproduce
Create an object that uses
enum(as an example) as it's propertyExpected behavior
The linter should not treat
enumas the type but as a property