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

Solvers JSON OpenAPI schema #2683

Merged
merged 1 commit into from
May 2, 2024
Merged

Conversation

squadgazzz
Copy link
Contributor

@squadgazzz squadgazzz commented May 1, 2024

It turned out that serde_yaml/unsafe-libyaml lib, which is used in the utoipa generator, has its own behavior with strings, which is not suitable for HEX values, making them displayed wrongly in OpenAPI renderers. Moreover, a deeper investigation showed that these particular libs are now deprecated, and other YAML-related libs are not in good shape(deprecated, alpha versions, etc.).

The proposal is to switch to JSON schema since libs for this format are well-maintained and don't have any issues with weird string representation. Since the file is now automatically generated and doesn't require manual interventions, we shouldn't care about the file format. Also, JSON and YAML formats are interchangeable in OpenAPI.

@squadgazzz squadgazzz marked this pull request as ready for review May 1, 2024 12:06
@squadgazzz squadgazzz requested a review from a team as a code owner May 1, 2024 12:06
@squadgazzz squadgazzz mentioned this pull request May 1, 2024
3 tasks
#[allow(dead_code)]
pub struct OrderUid(String);

/// Signature bytes.
#[derive(ToSchema)]
#[schema(example = "0x0000000000000000000000000000000")]
#[schema(
example = "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we use proper examples not default values?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, will address it in the main PR.

@squadgazzz squadgazzz merged commit af43019 into utoipa/solvers May 2, 2024
7 of 10 checks passed
@squadgazzz squadgazzz deleted the utoipa/solvers-json branch May 2, 2024 18:22
@github-actions github-actions bot locked and limited conversation to collaborators May 2, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants