Skip to content
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

Enable OpenAPI definitions to reflect field renaming #49

Merged

Conversation

IodizedGabe
Copy link
Contributor

Further support to allow DTO types to retain the expected field naming
convention, but expose a different name over its API.

@@ -156,6 +156,9 @@ Object {
"format": "uuid",
"type": "string",
},
"string_value_with_different_wire_name": Object {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

OpenAPI definition reflects the wire name.

@@ -211,6 +211,11 @@ export function createFixtures(flavor: Flavor): Fixture {
nullable: true,
})
nullableUUIDValue!: string | null;

@IsString({
name: 'string_value_with_different_wire_name',
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Opted to make this required in testing to ensure that we can always validate that it was converted correctly.

@@ -54,11 +54,13 @@ describe('flavors.basic', () => {
nullableNestedValue: {
nullableStringValue: 'nested',
},
// NB: This field is not transformed (b/c @Expose() is not included)
string_value_with_different_wire_name: 'value',
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Notice me: I'm assuming the exclusion of expose on DecoratorOptions was intentional, meaning that this now adds a new (expected) issue.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah, the basic flavor omits the @Expose decorator because we used to have a scenario in pod where that behavior broke things.

@IodizedGabe IodizedGabe force-pushed the feature/allow-external-name-exposure branch from 039667b to 4adab0e Compare November 19, 2021 20:06
Further support to allow DTO types to retain the expected field naming
convention, but expose a different name over its API.
@IodizedGabe IodizedGabe force-pushed the feature/allow-external-name-exposure branch from 4adab0e to 750a0e8 Compare November 19, 2021 20:08
@jessemyers jessemyers merged commit 3ffb861 into hippo-oss:main Nov 22, 2021
@IodizedGabe IodizedGabe deleted the feature/allow-external-name-exposure branch November 29, 2021 16:13
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.

3 participants