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

Open
justin-tay opened this issue May 22, 2019 · 0 comments
Open

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

justin-tay opened this issue May 22, 2019 · 0 comments
Labels

Comments

@justin-tay
Copy link

@justin-tay 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant
You can’t perform that action at this time.