Issues validating a yaml file against a schema #2255
Unanswered
DrakeEsdon
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi 👋
Im trying to use spectral to validate/lint a yaml file using a JSON schema I've created. Using the discussion here: #1409 this should be possible but things haven't been working quiet right.
I created this custom rule set
I had originally used ajv directly to see that an error should be returned when linting but when I use spectral with the following command
spectral lint example.yaml -r .spectral.yaml
I get
No results with a severity of 'error' found!%
Next I thought something strange might be happening with the resolver so I copied the resolver from here: https://meta.stoplight.io/docs/spectral/eb68e7afd463e-spectral-in-java-script#how-to-use-a-custom-resolver
according to the page this custom resolver will resolve all remote file refs relatively to the current working directory. I should note here that all the files I'm working with are in the same location in the directory tree.
I then ran
spectral lint example.yaml -r .spectral.yaml --resolver example.cjs
and received an even stranger message:Error #1: Invalid value used as weak map key
next when I added
allErrors: true
to the ruleset I recieved this error message :Error #1: must NOT have additional properties
still confused I tried to add some additional logging to the source code. I tried to patch json-ref-readers and when I did I found that the file.js file is being loaded but it seems none of the code inside of the Promise is executing. this is also true for the http based resolver.
Is this still a feature that is expected to work? from what I can find this should be an option but I feel like I'm using the direct examples and I'm not getting very far. Any help is appreciated. Thanks for reading 🙂
Beta Was this translation helpful? Give feedback.
All reactions