swagger-api / swagger-api/swagger-codegen

[JAX-RS 2.0] @JsonProberties are not assigned, always null

Open
#6,435 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

On the generator a always recieved null for a List. I fixed it by renaming the proberty "xPathsToBeRedacted" to "pathsToBeRedacted".

I used this part of the swagger-file: (now works)

paths:
  /redact:
    post:
      tags:
        - redact
      consumes:
        - application/json
      produces:
        - application/xml
      parameters:
        - name: redactOperation
          in: body
          required: true
          schema:
            $ref: '#/definitions/redactOperation'
      responses:
        '200':
          schema:
            type: string
        default:
          schema:
            type: string

definitions:
  redactOperation:
    type: object
    properties:
      signerId:
        type: string
      signedXML:
        type: string
      pathsToBeRedacted:
        type: array
        xml:
          wrapped: false
        items:
          type: string
    xml:
      name: redactOperation

I feel there might be a naming conflict. I debuggt it a little and noticed, that at the
initialisation of the gen/java/model/RedactOperation the method setXPathsToBeRedacted method was never called.

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 in the generated gen/java/model/RedactOperation class and inspect the pathsToBeRedacted property alongside the setXPathsToBeRedacted method mentioned in the report. Trace generation from the supplied Swagger definition and verify that the setter is called and the list is populated for the redactOperation model.

Written by the indexing model from the issue text.

Assessment

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