Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Stackoverflow when using the copy constructor of an OpenApiSchema. #1095

Copy link
Copy link
@Sventric

Description

@Sventric
Issue body actions

Using version 1.4.4 of Microsoft.OpenApi.

Describe the bug
When using the copy constructor of OpenApiSchema it comes in a recursive call and end with a stackoverflow exception.

To Reproduce

    OpenApiSchema baseSchema = new OpenApiSchema()
    {
        Type = "string",
        Format = "date"
    };

    OpenApiSchema actualSchema = new OpenApiSchema(baseSchema)
    {
        Nullable = true
    };

The "perpetrator" is the property "AdditionalProperties", this in itself is also a schema but is "copied" with AdditionalProperties = new(schema?.AdditionalProperties); so if null the constructor is again called the original parameter 'schema' and when not null it calls the constructor with AdditionalProperties as a parameter, and this is repeated untill it encounters a null and crashes.

Expected behavior
I expected to get a new OpenApiSchema with the properties from the baseSchema and the explicitly set new properties.

Reactions are currently unavailable

Metadata

Metadata

Assignees

Labels

type:bugA broken experienceA broken experience

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    Morty Proxy This is a proxified and sanitized view of the page, visit original site.