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

FISH-48 OpenAPI document failed to use Generics within @Schema #4832

Merged
merged 2 commits into from
Aug 21, 2020
Merged

FISH-48 OpenAPI document failed to use Generics within @Schema #4832

merged 2 commits into from
Aug 21, 2020

Conversation

jGauravGupta
Copy link
Contributor

@jGauravGupta jGauravGupta commented Aug 12, 2020

Signed-off-by: Gaurav Gupta [email protected]

Description

This a fix to read and parse Open API schema models with Java Generic signature types.

This PR fixes #4148 and results in the following OpenAPI document for the given application in the ticket:

openapi: 3.0.0
info:
  title: Deployed Resources
  version: 1.0.0
servers:
- url: http://jGauravGupta:8080/openapi-showcase-master
  description: Default Server.
- url: https://jGauravGupta:8181/openapi-showcase-master
  description: Default Server.
paths:
  /resources/zoo:
    get:
      operationId: loadAnimals
      responses:
        default:
          content:
            '*/*':
              schema:
                $ref: '#/components/schemas/JsonAnimalList'
          description: Default Response.
components:
  schemas:
    Animal:
      type: object
      properties:
        name:
          type: string
        age:
          type: integer
    JsonAnimalList:
      type: object
      properties:
        data:
          type: object
          properties:
            totalItems:
              type: integer
            items:
              type: array
              items:
                $ref: '#/components/schemas/Animal'
      description: JSON wrapper for a list of animals

Testing

New tests

Unit test
https://github.com/jGauravGupta/Payara/blob/06e633347bcb057e28a0d497fb2e0a2b2c25ea47/appserver/payara-appserver-modules/microprofile/openapi/src/test/java/fish/payara/microprofile/openapi/test/app/application/GenericSchemaMappingTest.java#L61

Testing Performed

Microprofile OpenAPI TCK Runner

Testing Environment

Windows 10, JDK 1.8.0_251

Depends on

payara/patched-src-hk2#15
payara/patched-src-hk2#16
payara/Payara_PatchedProjects#323
eclipse-ee4j/glassfish-hk2#517

Fixes

#4148
#4818

@jGauravGupta jGauravGupta requested a review from Cousjava August 12, 2020 10:42
@smillidge
Copy link
Contributor

@jGauravGupta have you also pushed fixed to upstream EE4J HK2?

@jGauravGupta
Copy link
Contributor Author

EE4J HK2 is updated with OpenAPI refactoring related changes in Patched HK2: eclipse-ee4j/glassfish-hk2#515

I will create another PR in EE4J HK2 upstream repository, once this PR will be reviewed and approved.

@smillidge
Copy link
Contributor

Does this fix #4802? and #4818?

@jGauravGupta
Copy link
Contributor Author

#4818 SOF issue is fixed by the Patch HK2 v2.6.1.payara-p3.

@jGauravGupta
Copy link
Contributor Author

jenkins test please

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

Successfully merging this pull request may close these issues.

OpenAPI ApplicationProcessor does not support parsing request/response classes using generics /CUSTCOM-30
3 participants