Skip to content

Conversation

jcscottiii
Copy link
Collaborator

Introduces a new script, generate-combined-schema.js, to automatically create a JSON schema for the final combined-data.json file. This new schema accurately reflects the flattened structure of the combined data.

The combine-mappings.js script is updated to use this generated schema to validate the data before writing the output file, preventing schema-invalid data from being committed.

The schemas.json file has been reverted to use JSON Schema draft-07. There were no features we needed from the other schema type. Plus, this matches the same version used in
web-features

The build process in package.json has been updated to include the new schema generation step.

Why this change:

This
commit, shifted the structure to move all of the nested schemas under each feature. But as a result, we can not use the existing schema file to validate or generate types for it. Now with the generated combined schema, we can keep the updated combined schema up to date automatically

Introduces a new script, `generate-combined-schema.js`, to automatically create a JSON schema for the final `combined-data.json` file. This new schema accurately reflects the flattened structure of the combined data.

The `combine-mappings.js` script is updated to use this generated schema to validate the data before writing the output file, preventing schema-invalid data from being committed.

The `schemas.json` file has been reverted to use JSON Schema `draft-07`.
There were no features we needed from the other schema type. Plus, this
matches the same version used in
[web-features](https://github.com/web-platform-dx/web-features/blob/e947bffc79135169e15efd5d5826da0f6a99a701/schemas/data.schema.json#L2)

The build process in `package.json` has been updated to include the new schema generation step.

Why this change:

This
[commit](edd6645),
shifted the structure to move all of the nested schemas under each
feature. But as a result, we can not use the existing schema file to
validate or generate types for it. Now with the generated combined
schema, we can keep the updated combined schema up to date automatically
@jcscottiii
Copy link
Collaborator Author

You are able to post this schema into https://app.quicktype.io/ and users can automatically get all the types for it:

image

@jcscottiii
Copy link
Collaborator Author

@captainbrosset is this okay to merge?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant