Skip to content

ServiceGovernance/ServiceGovernance.Repository.Agent.SwaggerV3

Repository files navigation

ServiceGovernance.Repository.Agent.SwaggerV3

Build status NuGet Version License

Provides an Agent (client) for the ServiceRepository. This agent publishes the API documentation, by using Swagger, to the repository.

Usage

Install the NuGet package ServiceGovernance.Repository.Agent.SwaggerV3.

public void ConfigureServices(IServiceCollection services)
{
    ...
    services.AddSwaggerGen(c =>
    {
        c.SwaggerDoc("v1", new Info { Title = "My API", Version = "v1" });
    });

    services.AddServiceRepositoryAgent(options => {
        options.Repository = new Uri("http://localhost:5005");
        options.ServiceIdentifier = "Api1";                
    }).UseSwagger("v1");
}

public void Configure(IApplicationBuilder app, IHostingEnvironment env)
{
    ...
    app.UseSwagger();    
    app.UseServiceRepositoryAgent();
}

Configuration

It's also possible to provide these options via the configuration:

public void ConfigureServices(IServiceCollection services)
{
    ...
    services.AddServiceRepositoryAgent(options => Configuration.Bind("ServiceRepository", options));
}
{
    "ServiceRepository": {
        "Repository": "https://myservicerepository.mycompany.com",
        "ServiceIdentifier": "Api1"
    }
}

Background

This agent collects the Api Descriptions as OpenApi document and sends it to the ServiceRepository where it can be viewed among other Api documentations from other services.

About

Service Repository Agent using Swagger to provide the Api Description

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published