Description
👯♂️ v6.0
openapi-typescript has an upcoming 6.0 version, which started as a breaking change but has now expanded to include the following as well:
- OpenAPI 3.1 support
- polymorphism ([string, null] definition is converted to unknown #969)
-
discriminator
(Map oneOf with discriminator to sum type #953)
- Closer adherence to the spec
- Better JSDoc comment generation
- Library cleanup to make contributions easier
- Improvements to the formatter (now called
transform()
)
🤝 Call for contributors
This library would love to have more contributors and maintainers help keep this project going! In service of this, I’ve recently added:
- Issue templates for better bug filing
- Improved contributor docs to make contributions friendlier
- Codebase cleanup that makes onboarding simpler.
If you’ve been interested in contributing to opensource, or if you’ve found this tool useful at your workplace or personal projects and would love to contribute, please raise a hand ✋! Anyone of any skill level and experience with the project is welcome 🙂
Note that at this time, contributing monetarily isn’t necessary. Perhaps in the future, but for now this library is held back by time constraints and number of maintainers.
❓ v6.0 RFC
Would love some 👍 or 👎 (comments welcome) on the following changes for 6.0 and beyond:
❓ 1. Dropping Swagger 2.x support
Swagger 3.0 has been out for 5 years now and already many (most?) APIs have fully made the leap to 3.x. Anecdotally I haven’t seen an active 2.0 schema in the wild for quite some time. Dropping support for 2.x would shed quite a bit of dead weight in the codebase and allow for faster releases. Of course, users of Swagger 2.x could always use openapi-typescript@5
indefinitely to generate types for their 2.x schemas, but won’t receive any future updates.
❓ 2. Dropping Prettier
Prettier was originally added as a lazy way to clean up the generated output. But with the in-progress code improvements, the output is much better formatted to the point Prettier isn’t needed (to be clear, the output doesn’t and never will match Prettier 100%, but it’s still formatted neatly to the point Prettier isn’t needed). Dropping Prettier would mean much faster generation (initial testing shows a 3× speedup on large schemas) and it would also shed this library’s weight by quite a bit. And users could use their formatting method of choice (#959).
❓ 3. Keeping string manipulation (over AST transformation)
There are 2 types of codegen libraries: those that use string manipulation, and those that use AST transformation. This library uses the former initially out of expediency, but over the years has stuck with this pattern for ease of maintenance and performance. Even though there’s no change here, the idea of switching to TypeScript’s AST has been raised before, and I wanted to raise it again. I won’t explain the pros/cons of each here, because if no one reading is familiar with how ASTs work I think I’ve made my point and ASTs would be harder to maintain 😉. But regardless, thoughts are welcome for those that have them here.
❓ 4. [Insert your idea here]
If you’d like to propose something not mentioned here, either as a breaking change or as a feature request, please speak now! For ideas, you can look back at suggested enhancements that haven’t been implemented yet.
🙏 Thanks so much for all the support you’ve given this library. I can’t believe a simple little tool we made at a past company has resulted in millions of downloads and is used in thousands of projects. Thanks for all the PRs, bugfixes, and passionate contributions made by this community!
Here’s to an even better, and faster v6 (and beyond) 😎