Skip to content
This repository was archived by the owner on Mar 16, 2025. It is now read-only.

References from Generics of mapped types are not counted #91

Closed
aburmeis opened this issue Apr 13, 2022 · 5 comments
Closed

References from Generics of mapped types are not counted #91

aburmeis opened this issue Apr 13, 2022 · 5 comments
Labels
bug Something isn't working
Milestone

Comments

@aburmeis
Copy link

aburmeis commented Apr 13, 2022

When you configure a type mapping in openapi-mapping.yaml using generics, the type reference is not counted and therefore the type will not be generated.

map:
    types:
        - type: MyResultPage => org.springframework.data.domain.Page<{package-name}.model.MyResult>

I see it would be hard to find such a reference, so either it should be possible to use OpenApi type names as generics:

map:
    types:
        - type: MyResultPage => org.springframework.data.domain.Page
           generics:
             - MyResult

or having an option to force generation of types to be configured:

force-types:
  - MyResult

I don't know which would be the best solution (would prefer the openapi type in generics) but somehow this has to be fixed/possible.

I am using openapi-processor-maven-plugin version 2021.1 with openapi-processor-spring version 2022.2.

@hauner
Copy link
Member

hauner commented Apr 14, 2022

That is strange, the first example should work. There is logic to handle it.

There are to 2 integration tests that use it. ... the tests have a different focus though. So it is possible that the {package-name} class get its used count from somewhere else.

I guess, I should create an explicit test for this case. Looking at it.

@aburmeis
Copy link
Author

aburmeis commented Apr 14, 2022

It seems the problem only exists if a suffix for model names is configured, sorry for confusion:

options:
  model-name-suffix: Dto
map:
  types:
      - type: MyResultPage => org.springframework.data.domain.Page<{package-name}.model.MyResultDto>

hauner added a commit that referenced this issue Apr 15, 2022
hauner added a commit that referenced this issue Apr 15, 2022
hauner added a commit that referenced this issue Apr 15, 2022
hauner added a commit that referenced this issue Apr 15, 2022
hauner added a commit that referenced this issue Apr 15, 2022
@hauner hauner added the bug Something isn't working label Apr 15, 2022
@hauner hauner added this to the 2022.4 milestone Apr 15, 2022
@hauner
Copy link
Member

hauner commented Apr 15, 2022

yes, suffix wasn't handled.

Thanks for reporting :-)

@hauner hauner closed this as completed Apr 15, 2022
@aburmeis
Copy link
Author

Much more thanks for fixing!

@hauner
Copy link
Member

hauner commented Apr 19, 2022

released in io.openapiprocessor:openapi-processor-spring:2022.3

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants