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

Wrong generation on generic model parametrized by a collection #388

Closed
egorklimov opened this issue Jul 9, 2020 · 1 comment · Fixed by #393
Closed

Wrong generation on generic model parametrized by a collection #388

egorklimov opened this issue Jul 9, 2020 · 1 comment · Fixed by #393
Labels
bug Something isn't working
Milestone

Comments

@egorklimov
Copy link

egorklimov commented Jul 9, 2020

Hi!

My Quarkus app has a wrapper for an API response with a generic field.
I noticed that if my endpoint returns something like Response<List<Cat>>, my openapi model will look like this:

      "ListCat" : {
        "type" : "object",
        "properties" : {
          "empty" : {
            "type" : "boolean"
          }
        }
      },

Expected result:

      "ListCat" : {
        "type" : "array",
        "items" : {
          "$ref" : "#/components/schemas/Cat"
        }
      },

After some reverse engineering, I added this test case (as an example) to 'GenericModelTypesResourceTest': egorklimov@8c329f4

Test result is the same:

      "ListPOJO" : {
        "type" : "object",
        "properties" : {
          "empty" : {
            "type" : "boolean"
          }
        }
      },

Could you please confirm that this is actually a bug?

P.S.
Also, I noticed that while processing a field of type List<String> in SchemaRegistry#checkRegistration it has type array, whereas when processing a generic field parametrized by List (type.toString() -> "T") it has type object.

@egorklimov
Copy link
Author

Seems that it is related to #387

When we resolve the type of a parameterized field, we must check whether it is a collection or not, and change the type to an array, if necessary

@egorklimov egorklimov changed the title Error on generic model parametrized by a collection Wrong generation on generic model parametrized by a collection Jul 9, 2020
@MikeEdgar MikeEdgar added the bug Something isn't working label Jul 14, 2020
@MikeEdgar MikeEdgar added this to the 2.0.3 milestone Jul 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants