-
Notifications
You must be signed in to change notification settings - Fork 257
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Schema validator doesn't recognize Null literals #118
Comments
@JPinkney Any updates on that? |
I am coming from here: redhat-developer/vscode-yaml#277 I forked the yaml-language-server now and added tests for this issue. I also provided a fix which implements this: https://yaml.org/type/null.html But I am in very doubt, if this will be accepted, as it could be that a lot of implementations actually rely on receiving the Null literals as strings. So I think the best solution would be to enable some configuration parameter to switch between those behaviors. But recording to the spec, I think the current implementation is just wrong here. |
I created a PR with tests also. |
Yeah, I think this should be switched back to the old behavior. I think in this case the kubernetes schema is actually wrong. If null is allowed in that case then the accepted types should be "string"/"null" not just "string". Even other validators online that I've found don't allow |
Simple test case, make a schema with
"type": "null"
Only the empty value is accepted as valid. The YAML null literals like
~
andnull
are rejected: https://yaml.org/type/null.htmlThis should be correctly supported by the parser: https://github.com/mulesoft-labs/yaml-ast-parser/blob/master/src/scalarInference.ts#L71
However,
"type": "string"
does accept Null literals, so this might be related to this fix: #72The text was updated successfully, but these errors were encountered: