Closed
Description
Describe the bug
OneToMany/ManyToOne associations are missing in the generated model
To Reproduce
- Clone https://github.com/valb3r/springdoc-issue
- Launch Gradle project, via
./gradlew clean bootRun
- Go to http://localhost:8080/swagger-ui/index.html#/product-item-entity-controller/getItemResource-productitem-get
- Relations are missing in response:
Observed YAML:
EntityModelProductItem:
required:
- locationInWarehouse
type: object
properties:
quantity:
type: integer
format: int64
locationInWarehouse:
type: string
_links:
$ref: '#/components/schemas/Links'
Expected behavior
- Expected having relations in all models
- What is the expected result using OpenAPI Description (yml or json)?
Expected YAML:
EntityModelProductItem:
required:
- locationInWarehouse
type: object
properties:
quantity:
type: integer
format: int64
product:
$ref: '#/components/schemas/EntityModelProduct'
locationInWarehouse:
type: string
_links:
$ref: '#/components/schemas/Links'
It would be very helpful if it was possible to include associations everywhere (in GET /entities/id, GET /entities ....) as relationships can be exposed via Excerpts, but currently generated YAML is not usable due to missing relationships references in spec
Currently, desired result is achievable from RepositoryRestConfigurer:
@Component
public class ExposeIdConfiguration implements RepositoryRestConfigurer {
@Override
public void configureRepositoryRestConfiguration(RepositoryRestConfiguration config, CorsRegistry cors) {
config.exposeIdsFor(Product.class, ProductItem.class);
}
}
But IDs exposure and entity content seem to be different concepts
Metadata
Metadata
Assignees
Labels
No labels