Organize JSON schema output by protocol category#90
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
|
This PR is very large. Consider breaking it into smaller PRs for easier review. |
There was a problem hiding this comment.
Pull request overview
This PR reorganizes the JSON schema generation to output schemas into category-specific subdirectories (data/, ui/, system/, ai/, api/) instead of a flat directory structure, making the 325+ schemas easier to navigate and understand as the protocol continues to grow.
Changes:
- Modified build script to generate schemas organized by protocol namespace/category
- Created comprehensive README documentation for the json-schema directory
- Migrated all JSON schemas from flat structure to categorized subdirectories
Reviewed changes
Copilot reviewed 4 out of 328 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| json-schema/README.md | Added comprehensive documentation explaining the new categorized structure, usage examples, and conventions |
| json-schema/MenuItem.json | Removed from flat directory (moved to appropriate category subdirectory) |
| json-schema/AuthenticationProvider.json | Removed from flat directory (moved to system/ subdirectory) |
| json-schema/AuthenticationConfig.json | Removed from flat directory (moved to system/ subdirectory) |
| ```typescript | ||
| import fieldSchema from '@objectstack/spec/json-schema/data/Field.json'; |
There was a problem hiding this comment.
The TypeScript import example shows importing from '@objectstack/spec' but doesn't clarify the actual package structure. If this package publishes the json-schema directory at the package root, the import path should be verified. Consider adding a note about how the package exports these schemas or whether users should use relative paths.
| ```typescript | |
| import fieldSchema from '@objectstack/spec/json-schema/data/Field.json'; | |
| ```typescript | |
| // If your bundler/runtime supports JSON imports and the package publishes | |
| // the `json-schema` directory at the package root: | |
| import fieldSchema from '@objectstack/spec/json-schema/data/Field.json'; | |
| // Or, if you are working within this repository or have the schemas copied | |
| // locally, you can use a relative path instead: | |
| // import fieldSchema from '../json-schema/data/Field.json'; |
|
|
||
| ```json | ||
| { | ||
| "$schema": "./node_modules/@objectstack/spec/json-schema/data/Object.json" |
There was a problem hiding this comment.
The IDE example uses a relative path through node_modules which may not work correctly for all IDEs or project structures. Consider adding an alternative example using a $schema reference that works with published packages or providing guidance on when to use relative vs package-based paths.
With 325+ schemas in a flat directory, navigation was becoming unwieldy. JSON schema generation now mirrors the source protocol structure.
Changes
scripts/build-schemas.ts): Generates schemas into category subdirectories matching namespace organizationjson-schema/{data,ui,system,ai,api}/instead of flat 325-file directoryjson-schema/README.mdwith category breakdown and usage patternsSchema Distribution
The
package.jsonfiles array already includesjson-schema/, so subdirectories are automatically included in published packages.Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.