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

Support enum map keys on OpenAPI 3.1.0 #1905

Merged
merged 1 commit into from
Aug 10, 2023

Conversation

srchase
Copy link
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
@@ -67,23 +66,6 @@ public void convertsModels() {
assertTrue(document.toNode().expectObjectNode().getMember("components").isPresent());
}

@Test
public void stripsUnsupportedKeywords() {
Copy link
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
@@ -46,6 +53,11 @@ public boolean supportsContentEncodingKeyword() {
return supportsContentEncodingKeyword;
}

@SmithyInternalApi
public Set<String> getUnsupportedKeywords() {
Copy link
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