示例#1
0
        public static void WriteResponse(IParseNodeWriter writer, Response response)
        {
            writer.WriteStartMap();

            writer.WriteStringProperty("description", response.Description);
            if (response.Content != null)
            {
                var mediatype = response.Content.FirstOrDefault();
                if (mediatype.Value != null)
                {
                    writer.WriteObject("schema", mediatype.Value.Schema, WriteSchemaOrReference);

                    if (mediatype.Value.Example != null)
                    {
                        writer.WritePropertyName("examples");
                        writer.WriteStartMap();
                        writer.WritePropertyName(mediatype.Key);
                        AnyNode.Write(writer, mediatype.Value.Example);
                        writer.WriteEndMap();
                    }
                }
            }
            writer.WriteMap("headers", response.Headers, WriteHeaderOrReference);
            writer.WriteExtensions(response.Extensions);

            writer.WriteEndMap();
        }
示例#2
0
 public static void Write(IParseNodeWriter writer, AnyNode node)
 {
     node.Write(writer);
 }