swagger-api / swagger-api/swagger-codegen-generators

[java jaxrs-jersey] default values are never generated in annotations

Open
#166 6 comments 1 reaction 1 assignee View on GitHub

@HugoMario is already working on this.

Since Sep 6, 2018.

Bug enhancement
Dominant language
Mustache
Stars
299
Forks
439
PR merge metrics
No merged PRs in 30d

Description

In all operations I have in my 3.0 spec, swagger-codegen never emits @DefaultValue annotation, although it exists on parameter definitions.

For parameter in operation like this:

    put:
      operationId: putExactResultZip
      tags:
        - results
      parameters:
        - name: failed
          in: query
          schema:
            type: boolean
            default: false

Emitted code for parameter is

,@Parameter(description = "") @QueryParam("failed") Boolean failed

While I would expect it to include the default value:

,@Parameter(description = "") @QueryParam("failed") @DefaultValue("false") Boolean failed

It does not matter what is the type of default, in a big project with many uses of default I see no @DefaultValue annotations in generated code.

Version info

Swagger-codegen (build from 3.0.0 release 713d52883cf320d46fb1a555c63e8ad99f78c16e), which is using 1.0.0 release of swagger-codegen-generators.

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.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.