/// <summary>Adds a document to the registry.</summary> /// <param name="registry">The registry.</param> /// <param name="configure">The configure action.</param> /// <returns>The registry.</returns> public static ISwaggerDocumentBuilder AddOpenApiDocument(this ISwaggerDocumentBuilder registry, Action <SwaggerDocumentSettings> configure = null) { return(AddSwaggerDocument(registry, settings => { settings.SchemaType = SchemaType.OpenApi3; configure?.Invoke(settings); })); }
/// <summary>Adds a document to the registry.</summary> /// <param name="registry">The registry.</param> /// <param name="configure">The configure action.</param> /// <returns>The registry.</returns> public static ISwaggerDocumentBuilder AddSwaggerDocument(this ISwaggerDocumentBuilder registry, Action <SwaggerDocumentSettings> configure = null) { var settings = new SwaggerDocumentSettings(); settings.SchemaType = SchemaType.Swagger2; configure?.Invoke(settings); var generator = new AspNetCoreToSwaggerGenerator(settings, settings.SchemaGenerator ?? new SwaggerJsonSchemaGenerator(settings)); return(((SwaggerDocumentRegistry)registry).AddDocument(settings.DocumentName, generator)); }