Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Swagger: Undocumented API response in swagger.json for BomResource #341

Closed
justin-tay opened this issue May 22, 2019 · 2 comments
Closed

Comments

@justin-tay
Copy link

justin-tay commented May 22, 2019

Current Behavior:

The swagger.json does not contain documented responses for some apis and hence when using swagger-codegen to generate the api clients the resultant api code ends up with void return results.

This is because the @ApiOperation response is not being set to an appropriate VO hence according to http://docs.swagger.io/swagger-core/apidocs/com/wordnik/swagger/annotations/ApiOperation.html#response() the return type will be void.

  • BomResource.uploadBom (POST & PUT)
  • BomResource.isTokenBeingProcessed

Steps to Reproduce:

java -jar swagger-codegen-cli-3.0.8.jar generate -i swagger.json --api-package org.dependencytrack.client.jersey2.api --model-package org.dependencytrack.client.jersey2.model --invoker-package org.dependencytrack.client.jersey2.invoker --group-id org.dependencytrack --artifact-id jersey-swagger-codegen-api-client --artifact-version 0.0.1-SNAPSHOT -l java --library jersey2 -o jersey-swagger-codegen-api-client

The BomApi class will contain methods with void parameters.

public void uploadBom(String project, Boolean autoCreate, String projectName, String projectVersion) throws ApiException
public void uploadBom1(BomSubmitRequest body) throws ApiException
public void isTokenBeingProcessed(String uuid) throws ApiException

Expected Behavior:

Responses in swagger.json should also have documented 200 responses

        "responses" : {
          "200" : {
            "description" : "successful operation",
            "schema" : {
              "$ref" : "#/definitions/BomSubmitResponse"
            }
          }

Environment:

  • Dependency-Track Version: 3.5.0-SNAPSHOT

Proposed Solution:

  1. Create 2 VOs, eg. BomSubmitResponse and TokenProcessedResponse
  2. Modify the @ApiOperation response for the respective methods
  3. Return the VOs instead of using the singletonMap
@stevespringett
Copy link
Member

Closing and incorporating these changes into #840. Please follow that ticket for updates.

@github-actions
Copy link
Contributor

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 26, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants