openapi-processor / openapi-processor-core

moved into openapi-processor-base
Apache License 2.0
7 stars 5 forks source link

does not generate model class if it is only referenced in a type mapping #50

Closed hauner closed 3 years ago

hauner commented 3 years ago

Having an openapi description with a model schema that is not directly referenced anymore after considering the mappings, is not generated even if it still referenced by a mapping.

This can happen if the there is a paged response that is mapped to the Spring framework Page class and there is no other endpoint that uses the page content type.

map:
  types:
    - type: FooPage => org.springframework.data.domain.Page<generated.model.Foo>

The details of the mapped openapi schema (which describes the page response in this case) are not considered anymore. It is replaced by the mapping so there is no need to generate the page content type.

The processor should recognize that the type is used and should generate the type.

Workaround:

a possible workaround is to create a dummy schema under components.schemas that references the missing type.