swagger-api / swagger-api/swagger-codegen

Type problem on enum generating jaxrs-cxf-cdi-server

Open
#9,708 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Mustache
Stars
17.8k
Forks
6k
PR merge metrics
No merged PRs in 30d

Description

Q&A (please complete the following information)
  • OS: all
  • Browser: all
  • Version: all
  • Swagger-Editor version: 3.23.9
  • Swagger/OpenAPI version: Swagger 2.0, OpenAPI 3.0
Content & configuration

If you define a enum with type integer and format int32 an generat jaxrs-cxf-cdi server, the generated model has a type problem. the enum is handled like a string type enum. It is correct if you generate a jaxrs-cxf server from the definition

Example Swagger/OpenAPI definition:

enumproperty:
  type: integer
  format: int32
  enum:
    - 1
  default: 1
Describe the bug you're encountering
To reproduce...

Steps to reproduce the behavior:

  1. Go to 'editor.swagger.io'
  2. Create a basic definition with a enum with type integer and format int32
  3. Click on 'Generate Server' -> jaxrs-cxf-cdi
  4. Check the generated model in an IDE
Expected behavior

Correct type on Enum in the generated model.

Screenshots

Generated jaxrs-cxf-cdi-server
image

Genereated jaxrs-cxf-server
image

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 by reproducing the integer, int32 enum through jaxrs-cxf-cdi server generation and compare its generated model with the jaxrs-cxf output. Trace the generator entry point and templates involved in enum handling; done means the generated jaxrs-cxf-cdi model uses the correct integer enum type.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
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.