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

Clean up the Pet Store (and possibly Airlines) app annotations #322

Closed
EricWittmann opened this issue Dec 21, 2018 · 6 comments · Fixed by #562
Closed

Clean up the Pet Store (and possibly Airlines) app annotations #322

EricWittmann opened this issue Dec 21, 2018 · 6 comments · Fixed by #562
Assignees
Labels

Comments

@EricWittmann
Copy link
Contributor

The Pet Store app (possibly also the Airlines app, I haven't checked) has a number of @Parameter annotations that are likely incorrect because the app was taken from the old Swagger 2.0 codebase. For example, there are a number of @Parameter annotations on method arguments which would typically be represented as a request body. In Swagger 2.0 that was correct, because request bodies were defined as "body" style parameters. In 3.0, however, there is an actual request body. There may be other annotations that do not make sense in 3.0 - so we should review the code.

@arthurdm
Copy link
Member

thanks for opening this Eric.

fyi, these were other warnings that we saw from the Pet Store app:

 - Message: Required "scopes" field is missing or is set to an invalid value, Location: #/components/securitySchemes/petsOAuth2/flows/implicit
 - Message: Required "description" field is missing or is set to an invalid value, Location: #/paths/~1pet~1{petId}/get/responses/200
 - Message: Required "in" field is missing or is set to an invalid value, Location: #/paths/~1pet~1{petId}/post/parameters
 - Message: Required "in" field is missing or is set to an invalid value, Location: #/paths/~1pet~1{petId}/post/parameters
 - Message: The "http://example.org/petapi-examples/openapi.json#/components/examples/pet-example" value is an invalid reference, Location: #/paths/~1pet/post/requestBody/content/application~1json/examples/pet-example
 - Message: Required "in" field is missing or is set to an invalid value, Location: #/paths/~1pet/put/parameters
 - Message: Required "in" field is missing or is set to an invalid value, Location: #/paths/~1pet~1findByStatus/get/parameters
 - Message: Required "description" field is missing or is set to an invalid value, Location: #/paths/~1pet~1findByStatus/get/responses/200
 - Message: Required "name" field is missing or is set to an invalid value, Location: #/paths/~1store~1order/post/parameters
 - Message: Required "in" field is missing or is set to an invalid value, Location: #/paths/~1store~1order/post/parameters
 - Message: Required "name" field is missing or is set to an invalid value, Location: #/paths/~1user~1{username}/put/parameters
 - Message: Required "in" field is missing or is set to an invalid value, Location: #/paths/~1user~1{username}/put/parameters
 - Message: Required "name" field is missing or is set to an invalid value, Location: #/paths/~1user~1createWithArray/post/parameters
 - Message: Required "in" field is missing or is set to an invalid value, Location: #/paths/~1user~1createWithArray/post/parameters
 - Message: Required "name" field is missing or is set to an invalid value, Location: #/paths/~1user~1createWithList/post/parameters
 - Message: Required "in" field is missing or is set to an invalid value, Location: #/paths/~1user~1createWithList/post/parameters
 - Message: Required "name" field is missing or is set to an invalid value, Location: #/paths/~1user/post/parameters
 - Message: Required "in" field is missing or is set to an invalid value, Location: #/paths/~1user/post/parameters ```

@MikeEdgar
Copy link
Member

MikeEdgar commented Nov 27, 2019

@EricWittmann - is the apiKey/api_key header in PetResource#deletePet (extracted in snippet below) an example of this? The TCK tests for apiKey, but I would expect a scanner to use the JAX-RS name api_key, particularly when the @Parameter is attached to the same argument/bean property as the JAX-RS annotation.

@Parameter(
    name = "apiKey",
    description = "authentication key to access this method",
    schema = @Schema(type = SchemaType.STRING, implementation = String.class,
    maxLength = 256, minLength = 32))
@HeaderParam("api_key") String apiKey

@EricWittmann
Copy link
Contributor Author

No although that seems wonky for a different reason (namely that the names do not match).

But an example of this issue, I think, is this:

@Parameter(
description = "Created user object",
schema = @Schema(ref = "#/components/schemas/User"),
required = true
) User user) {

That's a POST operation with a request body of type User which is annotated with @Parameter instead of @RequestBody.

@MikeEdgar
Copy link
Member

Ok, I see now. I opened up #390 to take a look at clarifying parameter annotation usage and behavior.

@lamtrhieu
Copy link

Hi @EricWittmann @MikeEdgar
Is this something that need to work on ? I think this one could be a good one for me to understand more about all the open-api annotations.

@arthurdm arthurdm added this to the MP OpenAPI 2.0 milestone Apr 14, 2020
@MikeEdgar MikeEdgar added the tck label Feb 21, 2022
@MikeEdgar MikeEdgar removed this from the MP OpenAPI 2.1 milestone Feb 21, 2022
@MikeEdgar
Copy link
Member

@EricWittmann , @lamtrhieu - are either of you still interested in working on this one? I think this could be a good candidate to fix for 3.1.

Azquelt pushed a commit to Azquelt/microprofile-open-api that referenced this issue Mar 17, 2022
…lrye.config-smallrye-config-1.8.0

Bump smallrye-config from 1.7.0 to 1.8.0
@MikeEdgar MikeEdgar added this to the MP OpenAPI 3.1.1 milestone Jan 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants