swagger-api / swagger-api/swagger-codegen

Add check for void @ApiOperation/@ApiResponse returntype and fix @ApiResponse response-type

Open
#4,718 2 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

Description

The check for vendorExtensions.x-java-is-response-void implemented for jaxrs-spec in #4717 should be
backported to all Java languages.
Additionally, the currently used class for response is wrong (returnType is at the operation level, but the data type of the CodegenResponse should be used = baseType.

  1. Add check for void at operation level
    @ApiOperation(value = "{{{summary}}}", notes = "{{{notes}}}"{{^vendorExtensions.x-java-is-response-void}}, response = {{{returnType}}}.class{{/vendorExtensions.x-java-is-response-void}}...
  1. Change the response-Class to "baseType" and add check for void at @ApiResponse-level:
        @ApiResponse(code = {{{code}}}, message = "{{{message}}}"{{^vendorExtensions.x-java-is-response-void}}, response = {{{baseType}}}.class{{/vendorExtensions.x-java-is-response-void}}...

Languages to be updated:

  • jaxrs-cxf-cdi
  • jaxrs-spec [master]
  • jaxrs-spec [2.3.0] (already up to date as of PR #4717 but only for release 2.3.0 as due to breaking change due to interface/impl generation)
  • jaxrs (Jersey)
  • jaxrs-cxf - PR #4920
  • jaxrs-cxf-client
  • jaxrs-resteasy
  • java
  • spring
Swagger-codegen version

2.2.2-SNAPSHOT

Related issues

Jaxrs-Spec issue #4509
PR 4717

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

Inspect the Java and JAX-RS templates for the listed languages, comparing jaxrs-spec 2.3.0 with the existing jaxrs-cxf changes from PR #4920 and PR #4717. Update the operation and response annotations as described, then verify generated output uses the void check and baseType for response classes across the affected generators.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 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.