-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
[EDR Workflows] Explicitly export type in open api autogenerated ZOD types #191830
Merged
Merged
Changes from 3 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
c15dcfe
temporary solution to error TS7056: The inferred type of this node ex…
tomsonpl ff1173b
remove unknown
tomsonpl 98092bf
clean up
tomsonpl 26c3433
Merge branch 'main' into fix-infer-limit-issue
tomsonpl a614824
response actions in eql and esql rules
tomsonpl aec9da0
support anyof
tomsonpl 49006c9
Update packages/kbn-openapi-generator/src/template_service/register_h…
tomsonpl 4c5c217
Merge branch 'main' into fix-infer-limit-issue
tomsonpl 7108b88
[CI] Auto-commit changed files from 'node scripts/eslint --no-cache -…
kibanamachine File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,8 +31,17 @@ export type {{@key}} = {{> ts_type}}; | |
export type {{@key}}Input = {{> ts_input_type }}; | ||
export const {{@key}}: z.ZodType<{{@key}}, ZodTypeDef, {{@key}}Input> = {{> zod_schema_item }}; | ||
{{else}} | ||
{{#if (shouldCastExplicitly this)}} | ||
// We need this temporary type to infer from it below, but in the end we want to export as a casted {{@key}} type | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Comment reveals implementation details in each generated file. It doesn't look necessary here and may only confuse readers. I recommend to transform it to a handlebars comment or remove completely. |
||
// error TS7056: The inferred type of this node exceeds the maximum length the compiler will serialize. An explicit type annotation is needed. | ||
const {{@key}}Internal = {{> zod_schema_item}}; | ||
|
||
export type {{@key}} = z.infer<typeof {{@key}}Internal>; | ||
export const {{@key}} = {{@key}}Internal as z.ZodType<{{@key}}>; | ||
{{else}} | ||
export type {{@key}} = z.infer<typeof {{@key}}>; | ||
export const {{@key}} = {{> zod_schema_item}}; | ||
{{/if }} | ||
{{/if}} | ||
{{#if enum}} | ||
{{#unless (isSingle enum)}} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
oneOf
looks like a valid case as well.nit: Having a comment why casting explicitly is required would be nice here.
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.
added support to oneOf for the future 👍 currently no schemas are using the same way as anyOf, I think oneOf is used mostly in the requestBody.