Skip to content

Converting YAML doc with date types to JSON creates invalid JSON doc #332

@gregbair

Description

@gregbair

Microsoft.OpenApi version 1.1.0 -

I'm pulling in a YAML OpenApi doc with the following property in a schema:

orderedOn:
    type: string
    description: The date the order was submitted.
    format: date
    readOnly: true
    example: "2018-01-23"

When using the serializer (doc.Serialize(ms, openApiVersion, format);, where ms is a MemoryStream, openApiVersion is OpenApiSpecVersion.OpenApi3_0, and format is OpenApiFormat.Json, the JSON output is:

"orderedOn": {
    "type": "string",
    "description": "The date the order was submitted.",
    "format": "date",
    "readOnly": true,
    "example": 2018-01-23T00:00:00.0000000-05:00
}

which is invalid JSON (the date is not properly quoted)

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