Skip to content

Recurssion in subtypes when combining Jackson and Swagger #2872

@oyee91

Description

@oyee91

When using both Jackson and Swagger the open api specification gives a recursive behaviour structure that is extremely annoying in Stoplight Elements. Visualisation in other tools like Swagger UI/Readocly does not give the same behaviour. This is generated when a abstract class have subtypes and the subtypes inherits from the parent. So for example if we add "@Schema(oneOf={SubclassA, SubClassB})" from Swagger for the schema specification and you have "@JsonSubtypes(SubclassA, SubClassB)" from Jackson in order for the deserialisation to work the jackson annotation sets the allOf and points to the parent on the child and the swagger schema oneOf annotation sets oneOf on the parent and points to the child, both of them together creates recursion. However this only breaks the view in Stoplight Elements and not in the other tools.

openapi-recursion-example.yaml

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions