Skip to content

Better discovery data, including I/O JSON Schemas #13

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

Closed
slinkydeveloper opened this issue Aug 21, 2024 · 1 comment · Fixed by #59
Closed

Better discovery data, including I/O JSON Schemas #13

slinkydeveloper opened this issue Aug 21, 2024 · 1 comment · Fixed by #59
Assignees
Labels
enhancement New feature or request

Comments

@slinkydeveloper
Copy link
Collaborator

slinkydeveloper commented Aug 21, 2024

Discovery right now doesn't propagate much for input/output in the macro, we could propagate more.

@slinkydeveloper slinkydeveloper self-assigned this Aug 21, 2024
@slinkydeveloper slinkydeveloper added the enhancement New feature or request label Aug 21, 2024
@slinkydeveloper slinkydeveloper changed the title Better discovery data Better discovery data, including I/O JSON Schemas Oct 31, 2024
@slinkydeveloper
Copy link
Collaborator Author

What we would need is something like that:

  • Some trait WithSchema alike WithContentType in our internal serde module. This trait probably has a single method generate_schema with an associated type that must respect serde::Serialize.
  • Some default implementation of WithSchema for all the primitive types. This can be hardcoded, no need to use a schema gen for that.
  • For Json we rather add some generator based on schemars (1.0, because schemas must be conform to 2020-12 spec minimum). But I would put this implementation behind a feature flag, so people can opt out of using schemars, and in that case Json implements the WithSchema simply returning an accept all schema (which is the empty object in the json schema spec).
  • This WithSchema trait then should be used in the macro generated Discoverable implementation. Wiring should probably happen in ServiceGenerator, in impl_discoverable method. The spec of the Discoverable output is also described in the endpoint_manifest_schema.json

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant