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

feat: sort schema barrel file #530

Merged
merged 3 commits into from
Aug 23, 2022
Merged

Conversation

SamKirkland
Copy link
Contributor

Fix #483 sort schema barrel file

Note

When testing this change I found the output of many example folders to be out of date. I didn't want to pollute this PR so I left those files out of this PR. I did leave the samples/react-query/basic/src/api/model/index.ts file in this PR as an example of what this change accomplishes.

Status

READY

Description

The contents of the schema barrel files (model/index.ts) should be stable between builds - the output between re-runs should be identical. This has several benefits, including less noisy git diffs.

This change also reduces IO trashing because it removes 2 IO operations that were previously within a loop (read file, append file)

Related PRs

Non

Todos

  • Tests
  • Documentation - N/A
  • Changelog Entry (unreleased)

Steps to Test or Reproduce

  1. Clone orval@6.8.1
  2. Open samples/react-query/basic
  3. run npm install
  4. run orval --config ./orval.config.ts
  5. Look at the output of samples/react-query/basic/src/api/model/index.ts
  6. Delete the file (or a single line)
  7. re-run orval --config ./orval.config.ts
  8. Note how the file contents is not stable, the contents can be in any order

Fix anymaniax#483 sort schema barrel file
@vercel
Copy link

vercel bot commented Aug 11, 2022

Someone is attempting to deploy a commit to a Personal Account owned by @anymaniax on Vercel.

@anymaniax first needs to authorize it.

src/core/writers/schemas.ts Outdated Show resolved Hide resolved
src/core/writers/schemas.ts Show resolved Hide resolved
@SamKirkland
Copy link
Contributor Author

Changes made, requesting re-review

@anymaniax
Copy link
Collaborator

@SamKirkland Thanks

@anymaniax anymaniax merged commit 9ccbd2d into orval-labs:master Aug 23, 2022
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.

Sort Schema barrel file
2 participants