-
Notifications
You must be signed in to change notification settings - Fork 251
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
JSON schemas should be strict validatable #780
Comments
"additionalProperties": false
for strict validation
Maybe it'd be smart to use a JSON schema version VSCode actually supports? 🤔
PowerShell seems to have problem with 2019 and newer too: |
Looks like |
Updated schema to use this value - it seems to not like the additional property of id in your example but then doesn't have a problem with |
See comment in #777 re why the schema is provided - we can still look at adding |
Thanks @anwather. We'll take a look at AzPolicyTest. We've linted wanted "root values" for EPAC policyDefinitions with something like this for now: $AllDefinitions.Where{
$(
[string[]](
Compare-Object -PassThru -CaseSensitive -ReferenceObject (
(
ConvertFrom-Json -InputObject (Get-Content -Raw -Path $_.'Path')
).'PSObject'.'Properties'.Where{$_.'MemberType' -eq 'NoteProperty'}.'Name'
) -DifferenceObject '$schema','name','properties'
)
).'Count' -gt 0
} |
Closing as discussed with dev team - the purpose of the schema is to provide some level of Intellisense, not to support validation of policy files. |
Describe the bug
All EPAC JSON schemas should be strict validatable, to ensure definitions does not have unwanted properties that might break build and deploy.
I'd like to avoid writing our own linter for this, hopefully this is something that can be implemented in EPAC itself.
I'm no JSON schema expert, maybe adding
"additionalProperties": false
as a "root" value isn't enough? Seems like that's what Scoop does:Currently, none of the EPAC schemas have this:
To Reproduce
See issue comment: #777 (comment)
Expected behavior
Non-valid JSON / JSONC should not go through EPAC.
Screenshots
None.
EPAC Version
Not relevant, JSON schema issue AFAIK.
The text was updated successfully, but these errors were encountered: