Esempio n. 1
0
 public SwaggerDefinitionsFactory(IApiActionResponseInfoFactory responseInfoFactory,
                                  ISwaggerSchemaFactory schemaFactory, ISwaggerDefinitionNameProvider definitionNameProvider,
                                  ISwaggerTypeProvider typeProvider)
 {
     _responseInfoFactory    = responseInfoFactory ?? throw new ArgumentNullException(nameof(responseInfoFactory));
     _schemaFactory          = schemaFactory ?? throw new ArgumentNullException(nameof(schemaFactory));
     _definitionNameProvider =
         definitionNameProvider ?? throw new ArgumentNullException(nameof(definitionNameProvider));
     _typeProvider = typeProvider ?? throw new ArgumentNullException(nameof(typeProvider));
 }
Esempio n. 2
0
        public SwaggerPathFactory(IApiActionInfoProvider infoProvider, IOptions <SwaggerOptions> optionsAccessor,
                                  ISwaggerResponseFactory responseFactory,
                                  ISwaggerDefinitionNameProvider definitionNameProvider,
                                  ISwaggerSchemaFactory schemaFactory)
        {
            if (optionsAccessor == null)
            {
                throw new ArgumentNullException(nameof(optionsAccessor));
            }
            _infoProvider           = infoProvider ?? throw new ArgumentNullException(nameof(infoProvider));
            _responseFactory        = responseFactory ?? throw new ArgumentNullException(nameof(responseFactory));
            _definitionNameProvider =
                definitionNameProvider ?? throw new ArgumentNullException(nameof(definitionNameProvider));
            _schemaFactory = schemaFactory ?? throw new ArgumentNullException(nameof(schemaFactory));

            var options = optionsAccessor.Value;

            _defaultMethods = options.DefaultMethods ?? new[] { "GET" };
        }