Skip to content

ServiceGovernance/ServiceGovernance.Repository.Agent

Repository files navigation

ServiceGovernance.Repository.Agent

Build status NuGet Version License

Provides an Agent (client) for the ServiceRepository. This agent publishes the API documentation of your ASP.NET Core application to the repository.

Usage

Either use the base NuGet package ServiceGovernance.Repository.Agent and provide an custom implementation for IApiDescriptionProvider or use the ServiceGovernance.Repository.Agent.SwaggerV3 NuGet package with built-in support for Swagger.

Example configuration for using with Swagger (you only need ServiceGovernance.Repository.Agent.SwaggerV3 package).

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.

Releases

No releases published

Packages

No packages published