swagger-api / swagger-api/swagger-codegen
[JAVA] Swagger codegen cli for jaxrs-jersey is not generating xml tags in model files withXml option.
Nobody has claimed this yet.
- Dominant language
- Mustache
- Stars
- 17.8k
- Forks
- 6k
- PR merge metrics
- No merged PRs in 30d
Description
Description
i am trying to generate a jaxrs-jersey server stub with swagger-codegen-cli.jar (3.0.21) from CLI but the model files are not produced with xml tags.
i am not able to generate xml tags with java -jar swagger-codegen-cli.jar generate -i ./userapi-1.3.0.yaml --additional-properties withXml=true -l jaxrs-jersey -o ./codegen/jaxrs-jersey
Swagger-codegen version
3.0.21
Swagger declaration file content or url
openapi: "3.0.0"
info:
version: 1.3.0
title: User API
license:
name: MIT
servers:
- url: http://localhost:8080/v1
paths:
/users:
get:
summary: List all users
operationId: listUsers
tags:
- USERS
parameters:
- name: limit
in: query
description: How many users to fetch at single stretch (max 100)
required: false
schema:
type: integer
format: int32
responses:
'200':
description: List of Users returned from DB
headers:
x-next:
description: A link to the next page of responses
schema:
type: string
content:
application/json:
schema:
$ref: "#/components/schemas/users"
application/xml:
schema:
$ref: "#/components/schemas/users"
500:
description: unexpected error
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
post:
summary: Create a new user
operationId: create
tags:
- USERS
responses:
'201':
description: Null response
default:
description: unexpected error
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
/user/{userId}:
get:
summary: get a single user by ID
operationId: getUser
tags:
- USERS
parameters:
- name: userId
in: path
required: true
description: User to be retrieved..
schema:
type: integer
format: int32
responses:
'200':
description: Expected response to a valid request
content:
application/json:
schema:
$ref: "#/components/schemas/user"
application/xml:
schema:
$ref: "#/components/schemas/user"
'500':
description: unexpected error
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
components:
schemas:
user:
required:
- userId
- userName
properties:
userId:
type: integer
format: int64
userName:
type: string
userDescription:
type: string
xml:
name: 'xml-description'
system:
type: string
nullable: true
other:
type: string
nullable: false
xml:
name: 'xml-user'
users:
type: object
items:
$ref: "#/components/schemas/user"
Error:
required:
- code
- message
properties:
code:
type: integer
format: int32
message:
type: string
Command line used for generation
java -jar swagger-codegen-cli.jar generate -i ./userapi-1.3.0.yaml --additional-properties withXml=true -l jaxrs-jersey -o ./codegen/jaxrs-jersey
Steps to reproduce
java -jar swagger-codegen-cli.jar generate -i ./userapi-1.3.0.yaml --additional-properties withXml=true -l jaxrs-jersey -o ./codegen/jaxrs-jersey
Related issues/PRs
Suggest a fix/enhancement
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by running the documented swagger-codegen-cli command with the supplied OpenAPI YAML and inspect the generated jaxrs-jersey model files. Trace the model-generation templates or entry points used by the jaxrs-jersey library, then verify that the schema and property XML metadata produce the expected XML annotations.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100