Skip to content

OpenApiSchema copy constructor does not copy Extensions #1261

@srev-saxo

Description

@srev-saxo

Describe the bug
The OpenApiSchema copy constructor, i.e. OpenApiSchema.OpenApiSchema(OpenApischema schema) does not copy the OpenApiSchema.Extensions property.

To Reproduce
The following snippet will reproduce the problem:

using Microsoft.OpenApi.Any;
using Microsoft.OpenApi.Models;

var schema = new OpenApiSchema
{
    Extensions =
    {
        { "x-myextension", new OpenApiInteger(42) }
    }
};

var schemaCopy = new OpenApiSchema(schema);

if (schemaCopy.Extensions.Count != 1)
    Console.WriteLine("Extensions were not copied");

Expected behavior
The Extensions property should be copied by the copy constructor.

Metadata

Metadata

Assignees

Labels

type:bugA broken experience

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions