-
-
Notifications
You must be signed in to change notification settings - Fork 468
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
V7 Preview #1363
V7 Preview #1363
Conversation
|
Deploying with Cloudflare Pages
|
This looks awesome! There seems to be an issue compiling OpenAPI 3.1 specs.
I looked into this with a debugger, and it seems that Going further up the call chain, in the EDIT: This seems to happen only when passing a string path to openapi-typescript, passing a URL of the path You can find the spec I am trying to compile here: https://github.com/wolfy1339/openapi-webhooks/blob/main/packages/openapi-webhooks/generated/api.github.com.json |
30ca09b
to
021d1db
Compare
This might be behaving as expected, if you’re using the Node.js API. Since this is a major version, there are a couple breaking changes, especially with how schemas are loaded. Specifically, passing a partial string path is no longer supported; if you’re referring to a file you should pass a |
cdb1d32
to
80ac76c
Compare
f32576b
to
56c0108
Compare
{ | ||
"extends": "./tsconfig.json", | ||
"include": ["examples"], | ||
"exclude": ["examples/digital-ocean-api.ts"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
An overdue addition to v7 is enforcing that the generated TypeScript doesn’t contain any type errors. Before, this checked happened manually. But going forward it will be enforced automatically by CI.
However, the DigitalOcean schema is a bit of a love–hate relationship. On the one hand, it does really stress-test many of the features that make this library robust and flexible (like being the biggest example I can find of abusing remote schemas). But on the other, the schema itself has errors 🙃.
Unfortunately, this means we can’t use DigitalOcean’s schema to check errors until they themselves resolve the problems with their schema. But I still like having it around for snapshot testing to just make sure this library can generate something there without blowing up. So until the errors are fixed, it’s excluded from the type error check
2fef4f9
to
bbd21db
Compare
9605ba9
to
50b16b4
Compare
The upcoming v7 will require more testing before release (release date TBD), but I’m going to merge this into |
V7 Preview 🎉
This is one of the most exciting releases in this project’s history—this uses the Redocly CLI (#1344) to validate schemas and report errors ✨.
You can test it out today at:
🙏 If you’re able to test this out and report any errors it’d be much appreciated.
📖 v7 Documentation
Overview
Full Changelog
Features
✨ Feature: automatically validate schemas with Redocly CLI (docs). No more need for external tools to report errors! 🎉
✨ Feature: bundle schemas with Redocly CLI
✨ Feature: add
enum
option to export top-level enums from schemas ([Feature request] Generate Enums AND Union types #941)✨ Feature: add
formatOptions
to allow formatting TS output✨ Feature: header responses add
[key: string]: unknown
index type to allow for additional untyped headers✨ Feature: allow configuration of schemas via
apis
key in redocly.config.yaml. See docs for more info.Breaking Changes
transform()
andpostTransform()
. To migrate, you’ll have to use thetypescript
compiler API:Though it’s more verbose, it’s also more powerful, as now you have access to additional properties of the generated code you didn’t before (such as injecting comments).
For example syntax, search this codebae to see how the TypeScript AST is used.
Also see AST Explorer’s
typescript
parser to inspect how TypeScript is interpreted as an AST.--auth
,--httpHeaders
,--httpMethod
, andfetch
(Node.js-only) options were all removed from the CLI and Node.js API--immutable-types
has been renamed to--immutable
--support-array-length
has been renamed to--array-length
:never
. This includes keys of the Components Object as well as HTTP methods.external
export in schemas anymore. Everything gets flattened into thecomponents
object instead (if referencing a schema object from a remote partial, note it may have had a minor name change to avoid conflict).defaultNonNullable
option now defaults totrue
. You’ll now need to manually setfalse
to return to old behavior.redocly.yaml
config. Specify multiple schemas with outputs in there instead. See Multiple schemas for more info.