Closed
Description
Describe the bug
myProperty:
type: string
nullable: true
default: null
fails validation with an obscure error message:
Cannot read properties of null (reading 'in')
error Command failed with exit code 2.
Setting null
as default value is perfectly fine which has been clarified in the spec version 3.0.3.
See: OAI/OpenAPI-Specification#2057 (comment) and OAI/OpenAPI-Specification#2115 (comment).
To Reproduce
- Given this OpenAPI/AsyncAPI document '...'
cat <<EOF > test.yaml
openapi: 3.0.3
components:
schemas:
myProperty:
type: string
default: null
nullable: true
EOF
- Run this CLI command '....'
yarn spectral lint test.yaml
- See error
yarn spectral lint test.yaml
yarn run v1.22.17
$ /Users/weise/code/spectral_example/node_modules/.bin/spectral lint test.yaml
Cannot read properties of null (reading 'in')
error Command failed with exit code 2.
Expected behavior
- I expected the schema to pass validation.
- I expected a clearer error message but I'll fill another issue for this – probably buggy – behaviour.
Environment (remove any that are not applicable):
yarn spectral --version
yarn run v1.22.17
$ /Users/weise/code/spectral_example/node_modules/.bin/spectral --version
6.1.0
✨ Done in 0.87s.