예제 #1
0
        /// <summary>
        /// Registers an Open API YAML file stored as an embedded resource.
        /// </summary>
        /// <typeparam name="T">The service type for which to register the Open API definition.</typeparam>
        /// <param name="documents">The Open API documents registry.</param>
        public static void RegisterOpenApiServiceWithEmbeddedDefinition <T>(
            this IOpenApiDocuments documents)
            where T : IOpenApiService
        {
            OpenApiDocument openApiDocument = OpenApiServiceDefinitions.GetOpenApiServiceFromEmbeddedDefinition <T>();

            documents.Add(openApiDocument);
        }
예제 #2
0
        /// <summary>
        /// Registers an Open API YAML file stored as an embedded resource.
        /// </summary>
        /// <param name="documents">The Open API documents registry.</param>
        /// <param name="assembly">The assembly in which the resource is stored.</param>
        /// <param name="resourceName">The name of the embedded resource.</param>
        public static void RegisterOpenApiServiceWithEmbeddedDefinition(
            this IOpenApiDocuments documents,
            Assembly assembly,
            string resourceName)
        {
            OpenApiDocument openApiDocument = OpenApiServiceDefinitions.GetOpenApiServiceFromEmbeddedDefinition(assembly, resourceName);

            documents.Add(openApiDocument);
        }
예제 #3
0
 /// <summary>
 /// Adds the /swagger endpoint to your host.
 /// </summary>
 /// <param name="documents">
 /// The Open API document provider.
 /// </param>
 public static void AddSwaggerEndpoint(this IOpenApiDocuments documents)
 {
     documents.Add(SwaggerService.BuildSwaggerDocument());
 }
예제 #4
0
 /// <summary>
 /// Creates an instance of the <see cref="OpenApiHostConfiguration"/>.
 /// </summary>
 /// <param name="documents">The document collection.</param>
 /// <param name="exceptionMap">The exception map.</param>
 /// <param name="linkMap">The link map.</param>
 public OpenApiHostConfiguration(IOpenApiDocuments documents, IOpenApiExceptionMap exceptionMap, IOpenApiLinkOperationMap linkMap)
 {
     this.Documents  = documents;
     this.Exceptions = exceptionMap;
     this.Links      = linkMap;
 }