Skip to content

Support enum map keys on OpenAPI 3.1.0#1905

Merged
srchase merged 1 commit intosmithy-lang:mainfrom
srchase:enum_map_keys
Aug 10, 2023
Merged

Support enum map keys on OpenAPI 3.1.0#1905
srchase merged 1 commit intosmithy-lang:mainfrom
srchase:enum_map_keys

Conversation

@srchase
Copy link
Copy Markdown
Contributor

@srchase srchase commented Aug 2, 2023

Closes: #1664

This PR updates OpenAPI configuration to allow propertyNames to be set when using version 3.1.0.

Previously, propertyNames was stripped from outputs as an unsupported keyword, since OpenAPI 3.0 did not support it.

By allowing propertyNames, enums can be used as map keys, without discarding all of the enum information.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@srchase srchase requested a review from a team as a code owner August 2, 2023 22:08
}

@Test
public void stripsUnsupportedKeywords() {
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This behavior is now covered by the convertsToOpenAPI3_0_2 and convertsToOpenAPI3_1_0 tests in OpenApiConverterTest.

@srchase srchase merged commit b8999a4 into smithy-lang:main Aug 10, 2023
@srchase srchase deleted the enum_map_keys branch August 10, 2023 19:28
}

@SmithyInternalApi
public Set<String> getUnsupportedKeywords() {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Oh interesting to make this version specific. Is this internal because you aren't sure about the design? Maybe unstable instead if that's the concern?

alextwoods pushed a commit to alextwoods/smithy that referenced this pull request Sep 15, 2023
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.

Improve OpenAPI support for enums as map keys

3 participants