Skip to content

Terminal colon in string properties produces invalid YAML #380

Closed

Description

String property values that end with a colon are not quoted/escaped when writing YAML. The code below produces the following output, which seems to be invalid (not accepted by editor.swagger.io):

title: Title:
description: Description
using Microsoft.OpenApi.Models;
using Microsoft.OpenApi.Writers;
using System;

namespace ConsoleApp2
{
    class Program
    {
        static void Main(string[] args)
        {
            var writer = new OpenApiYamlWriter(Console.Out);
            var schema = new OpenApiSchema
            {
                Title = "Title:",
                Description = "Description"
            };
            schema.SerializeAsV3(writer);
            Console.WriteLine();
        }
    }
}

Activity

  1. added a commit that references this issue on Feb 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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