Skip to content

Big honkinโ€˜ refactor, OpenAPI 3.1 features #968

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

Merged
merged 1 commit into from
Nov 4, 2022
Merged

Conversation

drwpow
Copy link
Contributor

@drwpow drwpow commented Nov 3, 2022

Changes

Refactors app, accomplishes many goals outlined in #961.

๐Ÿงน Codebase changes

  • Drops Prettier for 3ร— faster builds ๐Ÿš€๐Ÿš€๐Ÿš€
  • Performance improvements across the board ๐Ÿ”ฅ (benchmarks are tricky but itโ€™s objectively, noticably faster)
  • Overall reduction & simplification of codebase, while improving OpenAPI support
  • Updates target from ES2018 to ESNext (which most Node versions support)
  • Hardened TypeScript types to improve stability and reduce unnecessary null checks (valid schemas are still required)

๐Ÿ“– OpenAPI changes

๐Ÿค– CLI changes

  • --immutable-types has a new -t alias

๐Ÿ”จ Breaking changes

  • Dropped Swagger 2.0 support
  • Dropped Node 14 support (it still works for now, but Node 14 bugs wonโ€™t be fixed if any arise)
  • --version was changed to return the version of this library (also by dropping Swagger 2.0 support the old usage was no longer needed)
  • Dropped --raw-schema and support for partial schemas. Your entry schema MUST be valid and complete (however, your $refs to subschemas may be partials).
  • Dropped Prettier support, so all formatting options have been dropped. But you are free to format the output however youโ€™d like (or leave as-is)
  • Dropped --make-paths-enum because it was incompatible with --path-params-as-types
  • Dropped the CLI aliases -it and -ap (specify the full --immutable-types or --additional-properties flag)
  • Empty content: {} now returns never. Dropped the --content-never flag as this is now the default behavior.
  • Renamed and upgraded the Node APIโ€™s formatter() function to transform() and postTransform(). Itโ€™s an overall improvement on the original concept with even more power than before.

@codecov
Copy link

codecov bot commented Nov 3, 2022

Codecov Report

Base: 93.62% // Head: 86.66% // Decreases project coverage by -6.96% โš ๏ธ

Coverage data is based on head (1473cec) compared to base (16c25c6).
Patch coverage: 88.10% of modified lines in pull request are covered.

โ— Current head 1473cec differs from pull request most recent head 76d70a4. Consider uploading reports for the commit 76d70a4 to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #968      +/-   ##
==========================================
- Coverage   93.62%   86.66%   -6.97%     
==========================================
  Files           1       12      +11     
  Lines         204     1102     +898     
  Branches       29      211     +182     
==========================================
+ Hits          191      955     +764     
- Misses         13      147     +134     
Impacted Files Coverage ฮ”
src/transform/response-object.ts 71.02% <71.02%> (รธ)
src/transform/components-object.ts 80.97% <80.97%> (รธ)
src/transform/header-object.ts 83.33% <83.33%> (รธ)
src/transform/paths-object.ts 85.41% <85.41%> (รธ)
src/utils.ts 80.93% <88.49%> (รธ)
src/transform/schema-object.ts 92.38% <92.38%> (รธ)
src/transform/path-item-object.ts 92.85% <92.85%> (รธ)
src/transform/operation-object.ts 98.00% <98.00%> (รธ)
src/transform/link-object.ts 100.00% <100.00%> (รธ)
src/transform/media-type-object.ts 100.00% <100.00%> (รธ)
... and 4 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

โ˜” View full report at Codecov.
๐Ÿ“ข Do you have feedback about the report comment? Let us know in this issue.

@drwpow drwpow force-pushed the feat/oapi-3.1 branch 29 times, most recently from 30079c3 to 826d6ec Compare November 4, 2022 14:31
@drwpow drwpow force-pushed the feat/oapi-3.1 branch 14 times, most recently from 9eef7b5 to 59fd933 Compare November 4, 2022 17:30
@drwpow drwpow marked this pull request as ready for review November 4, 2022 17:31
@drwpow drwpow force-pushed the feat/oapi-3.1 branch 2 times, most recently from 9533401 to 8443a58 Compare November 4, 2022 18:11
@leppaott
Copy link

Just out of curiosity were those test/v3 files deleted deliberately? Made me think when I saw there were test/v2 files indeed deleted.

@drwpow
Copy link
Contributor Author

drwpow commented Nov 10, 2022

v6 drops support for Swagger 2.0 so the v2 folder was dropped and v3 just became test. And the tests were cleaned up and deduplicated to be easier to manage (the refactor required they all had to change anyway).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants