Skip to content

Schemas that make much use of $ref can cause Newtonsoft to if schema validation fails #326

@idg10

Description

@idg10

If Menes detects that input fails schema validation, it attempts to produce a 400 response that describes the problem, and which includes a copy of the schema that has been violated.

At some point (we think somewhere mid 2022) the Microsoft OpenAPI libraries started including reference details where $ref has been used, that end up including a pointer back to the whole OpenAPI doc. This causes Menes to crash because we end up with loops when trying to serialize the schema. But in any case, we shouldn't even be trying to copy the entire open API doc.

We need to work out how to stop it doing this. That might entail using the OpenApi library's built in functionality for serializing schemas. Or it might involve customizing how we serialize the thing.

First, we need to make the problem repro in the PetStore project, and then fix that.

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