Closed
Description
Describe the bug
- When using complex on Spring REST API - type is incorrectly defined on the API schema (type = object instead of $ref) if it implements Map interface
To Reproduce
Steps to reproduce the behavior:
- Try to use complex model object as RequestBody with @Schema definitions.
- On the API schema we have:
"requestBody":{"content":{"application/json":{"schema":{"type":"object","additionalProperties":{"type":"object","description":"Body","example":{"key":"value"}},"description":"Body","example":{"key":"value"}}}},"required":true}
instead of
"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Body"}}},"required":true}
Expected behavior
- Type should be properly marked on schema/ui with $ref instead of type=object
- Schema model should be available on "Models" section on UI
- No need for additional schema definition on RequestBody annotation
Repository with example
https://github.com/infoShare/swagger-requestbody-schema
P.S.
It there any option to hide interface methods on the API without custom code (check MapExclusion interface and usage on example repository which is used to hide isEmpty() method from the API schema)