Skip to content

Fix serialize object #910

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
Jun 1, 2022
Merged

Conversation

duncanbeevers
Copy link
Contributor

Complex default and example values were serialized in comments at [Object object].
This PR attempts to recognize these values, and to serialize them in a more-useful way.

This PR depends on both #909 and #906

@drwpow
Copy link
Contributor

drwpow commented May 24, 2022

Last one! Once this one is rebased off main will review & merge.

@duncanbeevers duncanbeevers force-pushed the fix-serialize-object branch from 44169b2 to 426cb09 Compare May 24, 2022 14:58
@duncanbeevers
Copy link
Contributor Author

@drwpow Rebased on main; the relevant commit applied cleanly! 🎉

@@ -639,7 +639,7 @@ export interface definitions {
sso_url?: string;
/** @enum {string} */
version?: "v1";
/** @default [object Object] */
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💯

@@ -49,7 +49,8 @@ export function prepareComment(v: CommentObject): string | void {
if (v[field] === "" && !allowEmptyString) {
continue;
}
commentsArray.push(`@${field} ${v[field]} `);
const serialized = typeof v[field] === "object" ? JSON.stringify(v[field], null, 2) : v[field];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice fix

@drwpow drwpow merged commit 513c19a into openapi-ts:main Jun 1, 2022
@drwpow
Copy link
Contributor

drwpow commented Jun 1, 2022

Will ship all these in a release later today. Thanks for your patience, and thanks so much for all these awesome improvements 🙏

@duncanbeevers duncanbeevers deleted the fix-serialize-object branch June 1, 2022 14:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants