OpenAPITools / OpenAPITools/openapi-generator

[BUG] Broken wrapped xml example

Open
#22,274 2 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?
  • 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?
Description

With #21899 and #21913 we introduced a wrapped xml feature/fix regarding wrapped elements in golang.
However we did a small mistake with the spec. You don't define the name of the element beside wrapped, that is the name of the list. The element must be named with xml at the element by itself.

wrong:

        photoUrls:
          items:
            type: string
          type: array
          xml:
            name: photoUrl
            wrapped: true

right:

        photoUrls:
          items:
            type: string
            xml:
              name: photoUrl
          type: array
          xml:
            wrapped: true
openapi-generator version

head

OpenAPI declaration file content or url

spec in repo / can be found in #21913

Generation Details

check prs

Steps to reproduce

copy current file in swagger editor and validate wrong wrapping:

Image

this is the right wrapping used:

Image
Related issues/PRs
  • #21899
  • #21913
Suggest a fix

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 spec in the repository referenced by #21913 and reproduce the wrapped XML case in Swagger Editor. Compare the incorrect and corrected OpenAPI declarations, then run the relevant generation or validation checks for the Go output. Done means the item name is defined on the element and the wrapper produces the expected XML.

Written by the indexing model from the issue text.

Assessment

Tech stack
go, openapi
Domain
api, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.