Beispiel #1
0
        private async Task RespondWithAsyncApiSchemaJson(HttpResponse response, AsyncApiSchema.v2.AsyncApiDocument asyncApiSchema)
        {
            var asyncApiSchemaJson = JsonConvert.SerializeObject(
                asyncApiSchema,
                Formatting.None,
                new JsonSerializerSettings
            {
                NullValueHandling = NullValueHandling.Ignore
            });

            response.StatusCode  = (int)HttpStatusCode.OK;
            response.ContentType = "application/json";

            await response.WriteAsync(asyncApiSchemaJson);
        }
Beispiel #2
0
        public AsyncApiDocument Clone()
        {
            var clone = new AsyncApiDocument();

            clone.Info = Info;
            clone.Id   = Id;
            clone.DefaultContentType = DefaultContentType;
            clone.Channels           = Channels.ToDictionary(p => p.Key, p => p.Value);
            clone.Servers            = Servers.ToDictionary(p => p.Key, p => p.Value);
            foreach (var tag in Tags)
            {
                clone.Tags.Add(tag);
            }
            clone.ExternalDocs = ExternalDocs;
            clone.Components   = Components.Clone();

            return(clone);
        }
        private async Task RespondWithAsyncApiSchemaJson(HttpResponse response, AsyncApiSchema.v2.AsyncApiDocument asyncApiSchema)
        {
            var asyncApiSchemaJson = JsonSerializer.Serialize(
                asyncApiSchema,
                new JsonSerializerOptions
            {
                WriteIndented    = false,
                IgnoreNullValues = true,
                Converters       =
                {
                    new DictionaryKeyToStringConverter(),
                    new InterfaceImplementationConverter(),
                },
            }
                );

            response.StatusCode  = (int)HttpStatusCode.OK;
            response.ContentType = "application/json";

            await response.WriteAsync(asyncApiSchemaJson);
        }
Beispiel #4
0
 public ParameterReference(string id, AsyncApiDocument document) : base(id, "#/components/parameters/{0}")
 {
     _document = document;
 }
        private static async Task RespondWithAsyncApiSchemaJson(HttpResponse response, AsyncApiSchema.v2.AsyncApiDocument asyncApiSchema, IAsyncApiDocumentSerializer asyncApiDocumentSerializer, AsyncApiOptions options)
        {
            var asyncApiSchemaJson = asyncApiDocumentSerializer.Serialize(asyncApiSchema, options);

            response.StatusCode  = (int)HttpStatusCode.OK;
            response.ContentType = asyncApiDocumentSerializer.ContentType;

            await response.WriteAsync(asyncApiSchemaJson);
        }