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

[JAXRS-CXF-CDI] Invalid argument on OAS 3.0 annotation @Parameter #132

Closed
HugoMario opened this issue Jul 26, 2018 · 6 comments
Closed

[JAXRS-CXF-CDI] Invalid argument on OAS 3.0 annotation @Parameter #132

HugoMario opened this issue Jul 26, 2018 · 6 comments

Comments

@HugoMario
Copy link
Contributor

Description

A non declared argument, allowableValues, is placed for OAS 3.0 annotation @Parameter

The issue is related to an array of string set with a enum for a parameter named status, an example of this is /pet/findByStatus: path from petstore sample :

  /pet/findByStatus:
    get:
      tags:
        - pet
      summary: Finds Pets by status
      description: Multiple status values can be provided with comma separated strings
      operationId: findPetsByStatus
      produces:
        - application/xml
        - application/json
      parameters:
        - name: status
          in: query
          description: Status values that need to be considered for filter
          required: true
          type: array
          items:
            type: string
            enum:
              - available
              - pending
              - sold
            default: available
          collectionFormat: csv
      responses:
        '200':
          description: successful operation
          schema:
            type: array
            items:
              $ref: '#/definitions/Pet'
        '400':
          description: Invalid status value
      security:
        - petstore_auth:
            - 'write:pets'

Command used:

java -jar modules/swagger-codegen-cli/target/swagger-codegen-cli.jar  generate -i modules/swagger-codegen/src/test/resources/2_0/petstore.yaml -l jaxrs-cxf-cdi -o output -DhideGenerationTimestamp=true

Keeping in mind that it does not matter that definition is in OAS 2 format since Swagger Codegen v3 supports it.

So the generated output with error on PetApi.java class is:

public Response findPetsByStatus( @NotNull @Parameter(description = "Status values that need to be considered for filter",required=true, allowableValues="available, pending, sold")  @QueryParam("status") List<String> status) {
        return delegate.findPetsByStatus(status, securityContext);
    }

when we try to build generated code with mvn package command we got:

[ERROR] /Users/hugomercado/GitHub/swagger-codegen/samples/server/petstore/jaxrs-cxf-cdi/src/gen/java/io/swagger/api/PetApi.java:[106,111] cannot find symbol
[ERROR]   symbol:   method allowableValues()
[ERROR]   location: @interface io.swagger.v3.oas.annotations.Parameter
@HugoMario
Copy link
Contributor Author

Hey @reta, could you please help us with this, when you have a chance?

@frantuma, any suggestion for this?

@HugoMario
Copy link
Contributor Author

once this is fixed the jaxrs-cxf-cdi must be updated, for now i just removed the argument in order to get a success build, but that's not the idea.

@reta
Copy link
Contributor

reta commented Jul 26, 2018

@HugoMario Yes, looking into it!

@reta
Copy link
Contributor

reta commented Jul 27, 2018

@HugoMario Please take a look at #134

@HugoMario
Copy link
Contributor Author

Issue has been fixed for #134, so, let's close it. thanks again @reta !

@reta
Copy link
Contributor

reta commented Jul 28, 2018

Thanks @HugoMario!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants