public AsyncApiMiddleware(RequestDelegate next, IOptions <AsyncApiOptions> options, IAsyncApiDocumentProvider asyncApiDocumentProvider, IAsyncApiDocumentSerializer asyncApiDocumentSerializer) { _next = next; _asyncApiDocumentProvider = asyncApiDocumentProvider; _asyncApiDocumentSerializer = asyncApiDocumentSerializer; _options = options.Value; }
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); }