Skip to content

Create interfaces for additionalProperties objects #4

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 4 commits into from
Feb 22, 2019

Conversation

enmand
Copy link
Contributor

@enmand enmand commented Feb 21, 2019

This PR adds supports for object definitions with additionalProperties: boolean | Swagger2Definition

@enmand enmand requested a review from drwpow February 21, 2019 23:43
@enmand enmand force-pushed the dan/improvements/swagger-additionalProperties branch 2 times, most recently from fb6a7e8 to f6d84ac Compare February 21, 2019 23:52
@enmand enmand force-pushed the dan/improvements/swagger-additionalProperties branch from f6d84ac to 47af2da Compare February 22, 2019 02:19
Copy link

@tim-speed tim-speed left a comment

Choose a reason for hiding this comment

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

Seems okay to me!

@@ -181,7 +198,7 @@ function parse(spec: Swagger2, namespace: string) {

output.push('}'); // Close namespace

return prettier.format(output.join('\n'), { parser: 'typescript' });
return prettier.format(output.join('\n'), { parser: 'typescript', singleQuote: true });
Copy link
Contributor

Choose a reason for hiding this comment

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

Just a note: I personally like singleQuote, but since we’re open-sourcing it I didn’t know the best thing to decide on. Maybe we could add options one day to allow customization of this, but this is fine for now (we can always change it if someone asks!)

@drwpow
Copy link
Contributor

drwpow commented Feb 22, 2019

@enmand are you able to add a test to tests/swagger-2.test.ts to test for this case? (also make sure all the existing tests pass?)


expect(swaggerToTS(swagger)).toBe(ts);
});

Copy link
Contributor

Choose a reason for hiding this comment

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

💯

Copy link
Contributor

@drwpow drwpow left a comment

Choose a reason for hiding this comment

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

Looks great! Thank you!

@enmand enmand merged commit 41542d1 into master Feb 22, 2019
@enmand enmand deleted the dan/improvements/swagger-additionalProperties branch February 22, 2019 14:42
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.

4 participants