OpenAPITools / OpenAPITools/openapi-generator

[BUG][WSDL-SCHEMA] Problem with generating WSDL from OpenApi HashMap definitions

Open
#19,275 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Issue: Bug
Dominant language
Java
Stars
26.8k
Forks
7.7k
PR merge metrics
PR metrics pending

Description

Bug Report Checklist
  • Have you provided a full/minimal spec to reproduce the issue?
  • Have you validated the input using an OpenAPI validator (example)?
  • Have you tested with the latest master to confirm the issue still exists?
  • Have you searched for related issues/PRs?
  • What's the actual output vs expected output?
  • [Optional] Sponsorship to speed up the bug fix or feature request (example)
Description

Using openapi-generator with wsdl-schema, generated WSDL doesn't create valid models from OpenApi HashMap defintiions.

Dictionaries, HashMaps and Associative Arrays

openapi-generator version

7.7.0
8.0.0

OpenAPI declaration file content or url
      "Proxy": {
        "required": [
          "attributes",
          "protocol",
          "realmId",
          "tenantId"
        ],
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "protocol": {
            "$ref": "#/components/schemas/ProtocolType"
          },
          "attributes": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": {
                "type": "string"
              }
            }
          },
          "tenantId": {
            "type": "string",
            "format": "uuid"
          },
          "realmId": {
            "type": "string",
            "format": "uuid"
          }
        }
      }

Proxy is converted into:

<xs:complexType name="Proxy">
  <xs:sequence>
    <xs:element minOccurs="0" name="id" type="xs:string" />
    <xs:element minOccurs="1" name="protocol" type="schemas:ProtocolType" />
    <xs:element minOccurs="1" maxOccurs="unbounded" name="attributes" type="schemas:string" />
    <xs:element minOccurs="1" name="tenantId" type="xs:string" />
    <xs:element minOccurs="1" name="realmId" type="xs:string" />
  </xs:sequence>
</xs:complexType>

attributes is a HashMap and is converted with type="schemas:string", which is wrong and makes wsimport tool to fail.

Generation Details

Swagger converts initial Java class attributes or REST method @RequestBody or @RequestParam into valid OpenApi definitions, but, openapi-generator with wsdl-schema generates those fields as type="schemas:string", which is wrong. schemas:string doesn't exist.

Steps to reproduce

Try to convert OpenApi file with HashMap field definition into WSDL using openapi-generator and wsdl-schema.

Related issues/PRs
Suggest a fix

Handle HashMap field types correctly.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the wsdl-schema generator and reproduce the issue using the provided Proxy schema, focusing on the attributes array with additionalProperties. Compare the generated WSDL with the expected map representation, then run wsimport to confirm the generated schema is valid and no longer references the nonexistent schemas:string type.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, xml
Domain
api, backend-api-design
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.