loopback-connector-swagger
loopback-connector-swagger copied to clipboard
An item with the same key has already been added.
I'm Using same in C# ODataWebAPI
public static void GenerateOpenApiDescription()
{
IEdmModel model = GetEdmModel();
OpenApiDocument document = model.ConvertToOpenApi();
var outputJSON = document.SerializeAsJson(OpenApiSpecVersion.OpenApi3_0);
var outputYAML = document.SerializeAsYaml(OpenApiSpecVersion.OpenApi3_0);
}
public static IEdmModel GetEdmModel()
{
// load EDM model here...
}
From this link https://github.com/microsoft/OpenAPI.NET.OData but when i run its seens error like An item with the same key has already been added. how to resolve this.
This is function where i call GetEdmModel()
public static void Register(HttpConfiguration config)
{
// Web API routes
config.MapHttpAttributeRoutes();
config.Routes.MapHttpRoute
(
name: "DefaultApi",
routeTemplate: "api/{controller}/{id}",
defaults: new { id = RouteParameter.Optional }
);
config.MapODataServiceRoute("odata", "odata", GetEdmModel());
IEdmModel model = GetEdmModel();
OpenApiDocument doc = model.ConvertToOpenApi();
var JSON = doc.SerializeAsJson(OpenApiSpecVersion.OpenApi3_0);
var YAML = doc.SerializeAsYaml(OpenApiSpecVersion.OpenApi3_0);
}
@Jeegen, I am trying to understand your question.
Can you please clarify what you are doing?
Also, please provide a minimal LB3 app that demonstrates your issue, and we can try to understand and debug. thx.
@Jeegen, Closing due to inactivity. If you are still running into problems, feel free to leave a comment and I will reopen the issue.