Skip to content

ServiceGovernance/ServiceGovernance.Repository

Repository files navigation

ServiceGovernance.Repository

Build status NuGet Version License

ServiceRepository is a combination of middleware and services. All configuration is done in your startup class.

Usage

You add the ServiceRepository services to the DI system by calling:

public void ConfigureServices(IServiceCollection services)
{
    services.AddServiceRepository();
}

public void Configure(IApplicationBuilder app)
{
    ...
    app.UseServiceRepository();
    ...
    app.UseMvc();
}

Optionally you can pass in options into this call.

This will return you a builder object that in turn has a number of convenience methods to wire up additional services.

In-Memory stores

The "in-memory" configuration APIs allow for configuring ServiceRepository from an in-memory list of configuration objects.

Use of these configuration APIs are designed for use when prototyping, developing, and/or testing where it is not necessary to dynamically consult database at runtime for the configuration data.

  • AddInMemoryApiStore Registers IApiStore implementation storing apis as in-memory list. Optional arguments are api documents which will be added to the store.
public void ConfigureServices(IServiceCollection services)
{
    services.AddServiceRepository()
        .AddInMemoryApiStore();
}

Other stores

Available persistence libraries are:

Custom stores

Use one of the following extension method to register your custom store:

  • AddApiStore Adds IApiStore implementation for reading and storing api descriptions.

APIs

Following APIs are provided by this library:

Publish api description

This endpoint publishes an api description in the service repository.

Url Method Type
/v1/api/{serviceId} POST application/json

Parameter

serviceId The unique service identitier to publish the document to.

body:

{
    OpenApiDocument (v3)    
}

Specification for the OpenApi v3 see here.

Response

text/plain HTTP 200

Get Api

This endpoint returns the published api description.

Url Method Type
/v1/api/{serviceId} Get

Parameter

serviceid The service you want to retrieve

Response

application/json HTTP 200

The endpoint returns the published api description.

{
    "serviceId": "UniqueServiceId",
    "apiDocument": OpenApiDocument (v3)    
}

Specification for the OpenApi v3 see here.

Get all Apis

This endpoint returns all published api descriptions.

Url Method Type
/v1/api Get

Parameter

Response

application/json HTTP 200

The endpoint returns all published api descriptions.

[
    {
        "serviceId": "UniqueServiceId",
        "apiDocument": OpenApiDocument (v3) 
    },
    {
        ...
    }
]

Specification for the OpenApi v3 see here.

About

ASP.NET core middleware for providing a Service Repository

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published