Repository navigation
[Issue #370] Generate json schemas per version - #426
Conversation
Previously changes in the changelog were just unstructured strings. This commit adds support for structured log messages with these fields: - message (original log message) - action - targetKind - currTargetName - prevTargetName - currDataType - prevDataType
Updates to match the new changelog output format.
|
🚀 Website Preview Deployed! Preview your changes at: https://cg-pr-426.billy-daly.workers.dev This preview will be automatically deleted when the PR is closed. |
Right now these are pushed to the .gitignored `tsp-output/` directory
There was a problem hiding this comment.
I added one non-blocking comment.
In response the questions posed in the Summary:
-
re: the latest version of each schema available at
/schemas/yaml/
I am in favor of preserving/schemas/yaml/for the latest version and also exposing all versions in/schemas/yaml/versions[v0.1 | v0.2 | etc]. -
re: how we want to link to these published versions
IMO the Changelog table is the perfectly contextual place to link to the versioned schemas. Changes and versions go hand in hand, whereas the Formats section is more about examples of the latest version in different languages.
Uses the exported types from the changelog emitter dependency instead of declaring the same ones.
|
🗑️ Preview Cleaned Up The preview for this PR has been automatically deleted. |
Summary
Auto-generates JSON schemas for each version of a model, field, enum etc.
Changes proposed
SchemaChangelogto work with new changelog outputContext for reviewers
This PR doesn't yet publish all of JSON schema versions on the website. I had a few questions about where/how we wanted to do this:
/schemas/yaml/we could:/schemas/yaml/for the latest version but then expose all versions in/schemas/yaml/versions/[v1 | v2 | v3]//schemas/yaml/latest/and then do/schemas/yaml/v2/etc. for earlier versions/schemas/yaml/v3/etc.Additional information
Schema versions
pnpm --filter typespec-versioning-changelog test:coverageto build the updated changelog emitternpm run typespec && npm run generate:versioned-schemasfrom within thewebsite/directorytsp-output/schemas/to view the auto-generated schemasv0.2.0/Form.ymlandv0.3.0/FormBase.ymlChangelog outputs
Old output
{ "FormBase": [ { "version": "0.2.0", "changes": [ "Added `Form` model" ] }, { "version": "0.3.0", "changes": [ "Renamed model from `Form` to `FormBase`", "Added `version` field" ] } ] }New output
{ "versions": ["0.1.0", "0.2.0", "0.3.0"], "logs": { "FormBase": { "0.2.0": [ { "message": "Added `Form` model", "action": "added", "targetKind": "model", "currTargetName": "Form" } ], "0.3.0": [ { "message": "Renamed model from `Form` to `FormBase`", "action": "renamed", "targetKind": "model", "prevTargetName": "Form", "currTargetName": "FormBase" }, { "message": "Added `version` field", "action": "added", "targetKind": "field", "currTargetName": "version" } ] } } }