swagger-api / swagger-api/swagger-codegen

java-cxf templates and read-only fields

Open
#10,092 1 comment 1 reaction 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

Description

Hello,

I was wondering why the pojo template of java-cxf hides setters of read-only fields :
https://github.com/swagger-api/swagger-codegen/blame/master/modules/swagger-codegen/src/main/resources/JavaJaxRS/cxf/pojo.mustache#L81

Following swagger specs (https://swagger.io/docs/specification/data-models/data-types/) this fields should only be set by the server
So I'd understand if java-cxf was a client generator, but it's a server generator. So is there any reasons I missed ?

Swagger-codegen version

2.4.12, but issue already exists 2.2.3

Swagger declaration file content or url
Command line used for generation

Generation done using maven plugin

Steps to reproduce

none

Related issues/PRs

Issue introduced with
https://github.com/swagger-api/swagger-codegen/issues/4386

Suggest a fix/enhancement

Remove the following lines :
https://github.com/swagger-api/swagger-codegen/blame/master/modules/swagger-codegen/src/main/resources/JavaJaxRS/cxf/pojo.mustache#L81
https://github.com/swagger-api/swagger-codegen/blame/master/modules/swagger-codegen/src/main/resources/JavaJaxRS/cxf/pojo.mustache#L104

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 modules/swagger-codegen/src/main/resources/JavaJaxRS/cxf/pojo.mustache, especially the referenced lines around 81 and 104, and review issue 4386 for the history of this behavior. Remove the specified setter-hiding lines and verify that Maven-generated Java CXF server POJOs expose setters for read-only fields.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
backend
Issue type
Bug
Difficulty
1/5
Estimated time
Under an hour
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.