public OpenApiDocument Generate(HttpContext httpContext, IAppEntity app, IEnumerable <ISchemaEntity> schemas) { document = NSwagHelper.CreateApiDocument(httpContext, urlOptions, app.Name); schemaGenerator = new OpenApiSchemaGenerator(settings); schemaResolver = new OpenApiSchemaResolver(document, settings); statusSchema = GenerateStatusSchema(); GenerateSchemasOperations(schemas, app); var context = new DocumentProcessorContext(document, Enumerable.Empty <Type>(), Enumerable.Empty <Type>(), schemaResolver, schemaGenerator, settings); foreach (var processor in settings.DocumentProcessors) { processor.Process(context); } return(document); }
public async Task <SwaggerDocument> Generate(HttpContext httpContext, IAppEntity app, IEnumerable <ISchemaEntity> schemas) { document = NSwagHelper.CreateApiDocument(httpContext, urlOptions, app.Name); schemaGenerator = new SwaggerJsonSchemaGenerator(settings); schemaResolver = new SwaggerSchemaResolver(document, settings); GenerateSchemasOperations(schemas, app); await GenerateDefaultErrorsAsync(); var context = new DocumentProcessorContext(document, Enumerable.Empty <Type>(), Enumerable.Empty <Type>(), schemaResolver, schemaGenerator, settings); foreach (var processor in settings.DocumentProcessors) { await processor.ProcessAsync(context); } return(document); }