-
Notifications
You must be signed in to change notification settings - Fork 63
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: yaml options #144
feat: yaml options #144
Changes from 3 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -45,8 +45,19 @@ export class OpenApiBuilder { | |||||||||||||||||||||||||
): string { | ||||||||||||||||||||||||||
return JSON.stringify(this.rootDoc, replacer, space); | ||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||
getSpecAsYaml(): string { | ||||||||||||||||||||||||||
return yaml.stringify(this.rootDoc); | ||||||||||||||||||||||||||
getSpecAsYaml( | ||||||||||||||||||||||||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||||||||||||||||||||||||||
replacer?: any[] | ((key: any, value: any) => unknown) | null, | ||||||||||||||||||||||||||
options?: | ||||||||||||||||||||||||||
| string | ||||||||||||||||||||||||||
| number | ||||||||||||||||||||||||||
| (yaml.DocumentOptions & | ||||||||||||||||||||||||||
yaml.SchemaOptions & | ||||||||||||||||||||||||||
yaml.ParseOptions & | ||||||||||||||||||||||||||
yaml.CreateNodeOptions & | ||||||||||||||||||||||||||
yaml.ToStringOptions) | ||||||||||||||||||||||||||
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. I'd suggest to make a reference to the types of the 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.
Suggested change
then you'd not need:
That will also make it future resistant (maintainability) if 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. I wanted to do that, but it's is not doable for overloaded functions, because TS doesn't know which overload to pick. 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. pick the one having 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. Dunno what you mean with the |
||||||||||||||||||||||||||
): string { | ||||||||||||||||||||||||||
return yaml.stringify(this.rootDoc, replacer, options); | ||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||
|
||||||||||||||||||||||||||
private static isValidOpenApiVersion(v: string): boolean { | ||||||||||||||||||||||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -45,8 +45,19 @@ export class OpenApiBuilder { | |
): string { | ||
return JSON.stringify(this.rootDoc, replacer, space); | ||
} | ||
getSpecAsYaml(): string { | ||
return yaml.stringify(this.rootDoc); | ||
getSpecAsYaml( | ||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
replacer?: any[] | ((key: any, value: any) => unknown) | null, | ||
options?: | ||
| string | ||
| number | ||
| (yaml.DocumentOptions & | ||
yaml.SchemaOptions & | ||
yaml.ParseOptions & | ||
yaml.CreateNodeOptions & | ||
yaml.ToStringOptions) | ||
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. same advice here |
||
): string { | ||
return yaml.stringify(this.rootDoc, replacer, options); | ||
} | ||
|
||
private static isValidOpenApiVersion(v: string): boolean { | ||
|
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.
I'd say it's too much changes to this file that are unrelated to the proposed feature.
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.
It's done by prettier, should I add Changelog.md to prettier ignore?