Skip to content

feat: Generate ArrayMap #409

@matheusandre1

Description

@matheusandre1

Mention:
quarkiverse/quarkus-openapi-generator#1352 and quarkiverse/quarkus-openapi-generator#1611 (review)

Bug in OpenApi2JaxRs - additionalProperties as an array does not generate Map<String, List<...>>

Description:

  • In OpenApi2JaxRs, the schema below is not being correctly converted to a map type:
ApiLists:
  type: object
  additionalProperties:
    type: array
    items:
      $ref: '#/components/schemas/ApiList'
  x-codegen-inline: true

Current Behavior

  • The generator does not produce the expected bean.

  • The map is not generated as Map<String, List>.

  • There seems to be a lack of support for additionalProperties whose value is an array of references.
    Expected Behavior

  • The schema should generate the equivalent representation:
    Map<String, List>

  • If the generator needs to create an auxiliary type, it should be something functionally equivalent that preserves String → List.

Why it's a bug
This pattern is valid in OpenAPI and is common for representing objects whose values ​​are lists of models.
The generator should treat additionalProperties with type: array + items: $ref as a map of lists, not as an unsupported case.

Implementation Requirements

  • Add support for recognizing additionalProperties with type: array.
  • Ensure that references in items are resolved correctly.
  • Generate the correct map type in the final code.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions