Exemplo n.º 1
0
        private SwaggerGenerator Subject(
            Action <FakeApiDescriptionGroupCollectionProvider> setupApis = null,
            Action <SwaggerGeneratorSettings> configure = null)
        {
            var apiDescriptionsProvider = new FakeApiDescriptionGroupCollectionProvider();

            setupApis?.Invoke(apiDescriptionsProvider);

            var options = new SwaggerGeneratorSettings();

            options.SwaggerDocs.Add(
                "v1",
                new SwaggerDocumentDescriptor(new Info {
                Title = "API", Version = "v1"
            })
                );

            configure?.Invoke(options);

            return(new SwaggerGenerator(
                       apiDescriptionsProvider,
                       new SchemaRegistryFactory(new JsonSerializerSettings(), new SchemaRegistrySettings()),
                       options
                       ));
        }
Exemplo n.º 2
0
 public SwaggerGenerator(
     IApiDescriptionGroupCollectionProvider apiDescriptionsProvider,
     ISchemaRegistryFactory schemaRegistryFactory,
     SwaggerGeneratorSettings settings = null)
 {
     _apiDescriptionsProvider = apiDescriptionsProvider;
     _schemaRegistryFactory   = schemaRegistryFactory;
     _settings = settings ?? new SwaggerGeneratorSettings();
 }