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

Types in generated react-query schema have unstable order, causing noisy diffs #1382

Open
severinh opened this issue May 17, 2024 · 1 comment
Labels
bug Something isn't working good first issue Good for newcomers

Comments

@severinh
Copy link
Contributor

severinh commented May 17, 2024

What are the steps to reproduce this issue?

I don't have a minimally reproducible example, but here's what happens in our project:

  1. Generate the *.schema.ts output of type react-query from some OpenAPI schema.
  2. Add a new component in the OpenAPI schema.
  3. Re-generate *.schemas.ts.

What happens?

The newly added component correctly appears as a new type in the generated schema. However, the order of the other types in the generated schema changes unnecessarily, and seemingly at random. As a result, the diff of the schema is noisy, and it significantly increases the size of the PRs with schema changes.

What were you expecting to happen?

I expected the new type to appear in the generated schemas.ts file, with the order of the other types staying the same.

Any logs, error output, etc?

No specific log output, but here's a screenshot of it happening in our project: Types moved around, even though they had nothing to do with the change to the OpenAPI schema.
image

Any other comments?

I don't know how orval is implemented. But I suspect that the instability could come from modelling the component names as a hash set, where the order is not stable.

What versions are you using?

Operating System: MacOS 14.4.1
Package Version: 6.26.0
Browser Version: Node.js 20

@severinh severinh changed the title Types in generated react-query schema have unstable/non-deterministic order, creating noisy diffs Types in generated react-query schema have unstable order, creating noisy diffs May 17, 2024
@severinh severinh changed the title Types in generated react-query schema have unstable order, creating noisy diffs Types in generated react-query schema have unstable order, causing noisy diffs May 17, 2024
@melloware melloware added the bug Something isn't working label May 17, 2024
@melloware
Copy link
Collaborator

@severinh do you have a PR to fix?

@melloware melloware added the good first issue Good for newcomers label May 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants