OpenAPITools / OpenAPITools/openapi-generator

[BUG] XML attribute incompatible with JSON $ref

Open
#3,178 3 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

Description

When using reference to describe property, the xml meta information is lost in the parsing.
It is therefore impossible when using reference to define xml related information. This seems like a big limitation.

openapi-generator version

3.0.2

OpenAPI declaration file content or url
openapi: 3.0.2
paths: {}
components:
  schemas:
    XXX:
      type: object
      properties:
        MyAttribute:
          $ref: "#/components/schemas/MyAttributeType"
          xml:
            attribute: true
            name: MyAttributeSpecialName
Suggest a fix

No idea as when using $ref it is supposed to replace the block content, therefore I don't know how this should be handled.

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 supplied OpenAPI declaration and reproduce how the parser handles a property combining $ref with xml metadata. Trace the relevant parsing and generation path; done means the xml attribute and name remain available when the referenced schema is used, with regression coverage for this example.

Written by the indexing model from the issue text.

Assessment

Tech stack
openapi
Domain
api
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.