Skip to content

Append Format property value to root schema when serializing as v2 if contained in anyOf, allOf, oneOf of child schemas #992

@irvinesunday

Description

@irvinesunday

When a primitive type schema of the example:

var schema = new OpenApiSchema();
if (context.Settings.IEEE754Compatible)
{
    schema.OneOf = new List<OpenApiSchema>
    {
        new OpenApiSchema { Type = "number", Format = "decimal" },
        new OpenApiSchema { Type = "string" },
    };
}

The expected serialization for v2 should look like below:

Age:
  format: int64

and the expected serialization for v3:

Age:
  oneOf:
    - type: integer
       format: int64
    - type: string
  nullable: true

This should be applicable to all primitive type schemas.

Metadata

Metadata

Assignees

Labels

type:enhancementEnhancement request targeting an existing experience

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions