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

Generate schemars derives in Rust generator #193

Merged
merged 21 commits into from
May 16, 2024
Merged

Conversation

leighmcculloch
Copy link
Member

@leighmcculloch leighmcculloch commented Mar 4, 2024

What

Generate schemars::JsonSchema derives in Rust generator whenever the existing serde feature is enabled.

Why

To support generating JSON schemas of the JSON that gets generated for the types.

Close stellar/rs-stellar-xdr#348

Todo

  • Test out the initial prototype
  • Check if the schema is valid (ask @willemneal for help in validating it with JS tooling)
  • Consider the best way to structure the features.
  • Generate custom hex/hash for any fixed or var array custom types
  • Tidy and chefs kiss
  • Adopt @willemneal's no additional properties from feat: add wasm-pack to allow publishing to npm rs-stellar-xdr#351 (comment) (Edit: Reduces size, but results in same affect, so leaving out and we can add as an improvement.)
  • Include comments from .x files (Edit: We can do this as a follow up.)
  • Add json schema meta titles for union arms. (like how @willemneal did in a visitor, but add them in the original schema for the type in the generated code) (Edit: Deferred.)

Related

@leighmcculloch leighmcculloch marked this pull request as ready for review April 9, 2024 12:28
@leighmcculloch leighmcculloch enabled auto-merge (squash) May 15, 2024 06:12
@leighmcculloch leighmcculloch merged commit ac16535 into master May 16, 2024
3 checks passed
@leighmcculloch leighmcculloch deleted the rust-add-schemas branch May 16, 2024 01:41
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.

Add capability to generate JSON schema for JSON repr of types
2 participants