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

Inline {map,list}_statements in conversion to OpenAPI #2443

Closed
Iddodo opened this issue Nov 7, 2024 · 2 comments · Fixed by #2449
Closed

Inline {map,list}_statements in conversion to OpenAPI #2443

Iddodo opened this issue Nov 7, 2024 · 2 comments · Fixed by #2449

Comments

@Iddodo
Copy link

Iddodo commented Nov 7, 2024

Hi everyone, is this something that can be accomplished relatively easily?

I understand that lists and maps need to be defined verbosely and that there aren't any inline structures of this kind;
but this is very suboptimal when schemas such as "AdditionalConfigMap" are created in generation, where this is just supposed to be a Map<String, String>.

This also makes it hard to combine with other codegen tools such as datamodel-codegen.

I would ideally like to be able to replace them with simple "object" or "array" OAS types.

@kstich
Copy link
Contributor

kstich commented Nov 7, 2024

What are you getting currently for the converted shape and what output do you want instead?

@kstich kstich added the response-requested Waiting on additional info and feedback. Will move to 'closing-soon' in 7 days. label Nov 7, 2024
@Iddodo
Copy link
Author

Iddodo commented Nov 7, 2024

I would like to be able to directly inline the shape upon conversion (similar to what it would look like upon conversion to Java e.g.), like so:

          "additionalConfig": {
            "type": "object",
            "description": "A map of key-value pairs",
            "additionalProperties": {
              "type": "string"
            }
          }
       },

Instead, it retains its Smithy symbol and turns into its own schema:

          "additionalConfig": {
            "$ref": "#/components/schemas/AdditionalConfigMap"
          }
       },
       "AdditionalConfigMap": {
        "type": "object",
        "description": "A map of key-value pairs",
        "additionalProperties": {
          "type": "string"
        }
      }

This is problematic because this "AdditionalConfigMap" construct is something that other codegen tools pick up, adding redundant structure to artifacts in our build process. This currently hinders our attempts to migrate one of our APIs from OpenAPI to Smithy.

@github-actions github-actions bot removed the response-requested Waiting on additional info and feedback. Will move to 'closing-soon' in 7 days. label Nov 8, 2024
@Iddodo Iddodo changed the title Inline {map,list}_statements in conversion to OpenAPI Inline {map,list,union}_statements in conversion to OpenAPI Nov 19, 2024
@Iddodo Iddodo changed the title Inline {map,list,union}_statements in conversion to OpenAPI Inline {map,list}_statements in conversion to OpenAPI Nov 19, 2024
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 a pull request may close this issue.

2 participants