Skip to content
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

{ "type": null } in profiles.schema.json violates JSON Schema draft 2019-09 meta-schema #8024

Closed
KalleOlaviNiemitalo opened this issue Oct 23, 2020 · 3 comments · Fixed by #8547
Labels
Area-Schema Things that have to do with the json schema. Issue-Docs It's a documentation issue that really should be on MicrosoftDocs/Console-Docs Needs-Tag-Fix Doesn't match tag requirements Product-Terminal The new Windows Terminal. Resolution-Fix-Committed Fix is checked in, but it might be 3-4 weeks until a release.

Comments

@KalleOlaviNiemitalo
Copy link

https://aka.ms/terminal-profiles-schema redirects to https://raw.githubusercontent.com/microsoft/terminal/release-1.3/doc/cascadia/profiles.schema.json, i.e. the raw view of https://github.com/microsoft/terminal/blob/release-1.3/doc/cascadia/profiles.schema.json. That schema uses the https://json-schema.org/draft/2019-09/schema# meta-schema:

"$schema": "https://json-schema.org/draft/2019-09/schema#",

The #/definitions/CloseOtherTabsAction and #/definitions/CloseTabsAfterAction schemas have a subschema { "type": null }:


That is not valid according to https://tools.ietf.org/html/draft-handrews-json-schema-validation-02#section-6.1.1, referenced by http://json-schema.org/specification-links.html#2019-09-formerly-known-as-draft-8. The value of type "MUST be either a string or an array"; null is neither.

{ "type": "null" } would be valid according to the meta-schema, but it would not match the documentation https://docs.microsoft.com/windows/terminal/customize-settings/actions#close-tabs-after-index, which says that the index property is optional but does not say that an explicit { "index": null } is allowed.

The null literals were added in #7390. Meta-schemas were also discussed in #7683.

@ghost ghost added Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting Needs-Tag-Fix Doesn't match tag requirements labels Oct 23, 2020
@KalleOlaviNiemitalo
Copy link
Author

"default": "" for the index property seems a bit dubious too, as it is not valid against the schema of that property. On the other hand, http://json-schema.org/draft/2019-09/json-schema-validation.html#rfc.section.9.2 only recommends validity and does not require it.

@zadjii-msft zadjii-msft added Area-Schema Things that have to do with the json schema. Issue-Docs It's a documentation issue that really should be on MicrosoftDocs/Console-Docs Product-Terminal The new Windows Terminal. labels Oct 23, 2020
@ghost ghost removed the Needs-Tag-Fix Doesn't match tag requirements label Oct 23, 2020
@zadjii-msft zadjii-msft removed the Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting label Oct 23, 2020
@Don-Vito
Copy link
Contributor

@KalleOlaviNiemitalo - I don't think that it is that important to forbid "index": null (and actually not sure how to do it). But it is definitely a time to make our schema compliant. Issuing a PR.

@ghost ghost added the In-PR This issue has a related PR label Dec 10, 2020
@ghost ghost added Needs-Tag-Fix Doesn't match tag requirements and removed In-PR This issue has a related PR labels Dec 11, 2020
DHowett pushed a commit that referenced this issue Dec 11, 2020
* The index field should be of type `"null"` and not `null`.
* The default value should be `null` and not `""`

Closes #8024
@ghost ghost added the Resolution-Fix-Committed Fix is checked in, but it might be 3-4 weeks until a release. label Dec 11, 2020
@KalleOlaviNiemitalo
Copy link
Author

I don't think that it is that important to forbid "index": null (and actually not sure how to do it).

AFAIK, one would do it like this:

            "index": {
              "type": "integer",
              "description": "Close the tabs other than the one at this index. If no index is provided, use the focused tab's index."
            }

If the "index" property is not listed in "required", then the object can be valid without having that property. If the lack of property does not mean the same thing as any valid value, then don't specify a "default". That's how I understand JSON Schema, anyway.

mpela81 pushed a commit to mpela81/terminal that referenced this issue Jan 28, 2021
…t#8547)

* The index field should be of type `"null"` and not `null`.
* The default value should be `null` and not `""`

Closes microsoft#8024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Schema Things that have to do with the json schema. Issue-Docs It's a documentation issue that really should be on MicrosoftDocs/Console-Docs Needs-Tag-Fix Doesn't match tag requirements Product-Terminal The new Windows Terminal. Resolution-Fix-Committed Fix is checked in, but it might be 3-4 weeks until a release.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants