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

Add type validation and/or theme.json schema #26955

Closed
oandregal opened this issue Nov 13, 2020 · 4 comments
Closed

Add type validation and/or theme.json schema #26955

oandregal opened this issue Nov 13, 2020 · 4 comments
Labels
Global Styles Anything related to the broader Global Styles efforts, including Styles Engine and theme.json [Type] Enhancement A suggestion for improvement.

Comments

@oandregal
Copy link
Member

See #26803 (comment)

In #26803 we evolved the theme.json schema validation mechanism by checking the structure of the input adhered to what we expected.

Adding type validation at the leaf level can bring more security but also opportunities to report invalid data input to theme authors.

@oandregal oandregal added the Global Styles Anything related to the broader Global Styles efforts, including Styles Engine and theme.json label Nov 13, 2020
This was referenced Nov 13, 2020
@jorgefilipecosta jorgefilipecosta changed the title Add type validation to theme.json schema Add type validation and/or theme.json schema Nov 24, 2020
@skorasaurus
Copy link
Member

has this been resolved with #32404 ?

@oandregal
Copy link
Member Author

#32404 surfaces existing syntax errors to users. However, we still don't do type validation for the data that comes from theme.json.

@ajlende
Copy link
Contributor

ajlende commented Sep 17, 2021

I made a JSON schema for theme.json that I'm adding it to schemastore. Schemastore is where all the popular schemas, like tsconfig, are stored, but we also have the option to host the schema ourselves and still add it to the schemastore catalog if we want to move the schema source into gutenberg.

I mostly use the schema for autocompletion in VS Code, but it could also be used for the full validation here. WordPress has a PHP JSON schema validator that we use for the REST API that we could use. Our PHP validator supports draft-04, but not completely, so it might need some draft-04 features added to fully work.

@jordesign jordesign added the [Type] Enhancement A suggestion for improvement. label Aug 18, 2023
@oandregal
Copy link
Member Author

There's been a few years since this one was created and Alex implemented a schema that is working for people, so I'm closing this one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Global Styles Anything related to the broader Global Styles efforts, including Styles Engine and theme.json [Type] Enhancement A suggestion for improvement.
Projects
None yet
Development

No branches or pull requests

4 participants