You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Microsoft.AspNetCore.Server.IIS.Core.IISHttpServer: Error: Connection ID "18302628887244308571", Request ID "8000005e-0000-fe00-b63f-84710c7967bb": An unhandled exception was thrown by the application.
Swashbuckle.AspNetCore.SwaggerGen.SwaggerGeneratorException: Failed to generate Operation for action - Microsoft.Examples.V1.OrdersController.Post (SwaggerODataSample). See inner exception
---> Swashbuckle.AspNetCore.SwaggerGen.SwaggerGeneratorException: Failed to generate schema for type - Microsoft.Examples.Models.Order. See inner exception
---> System.InvalidOperationException: Can't use schemaId "$Order" for type "$Microsoft.Examples.Models.Order". The same schemaId is already used for type "$Microsoft.Examples.Models.Order"
at Swashbuckle.AspNetCore.SwaggerGen.SchemaRepository.RegisterType(Type type, String schemaId)
at Swashbuckle.AspNetCore.SwaggerGen.SchemaGenerator.GenerateReferencedSchema(DataContract dataContract, SchemaRepository schemaRepository, Func`1 definitionFactory)
at Swashbuckle.AspNetCore.SwaggerGen.SchemaGenerator.GenerateConcreteSchema(DataContract dataContract, SchemaRepository schemaRepository)
at Swashbuckle.AspNetCore.SwaggerGen.SchemaGenerator.GenerateSchemaForParameter(ParameterInfo parameterInfo, SchemaRepository schemaRepository)
at Swashbuckle.AspNetCore.SwaggerGen.SchemaGenerator.GenerateSchema(Type type, SchemaRepository schemaRepository, MemberInfo memberInfo, ParameterInfo parameterInfo)
at Swashbuckle.AspNetCore.SwaggerGen.SwaggerGenerator.GenerateSchema(Type type, SchemaRepository schemaRepository, PropertyInfo propertyInfo, ParameterInfo parameterInfo)
--- End of inner exception stack trace ---
at Swashbuckle.AspNetCore.SwaggerGen.SwaggerGenerator.GenerateSchema(Type type, SchemaRepository schemaRepository, PropertyInfo propertyInfo, ParameterInfo parameterInfo)
at Swashbuckle.AspNetCore.SwaggerGen.SwaggerGenerator.GenerateRequestBodyFromBodyParameter(ApiDescription apiDescription, SchemaRepository schemaRepository, ApiParameterDescription bodyParameter)
at Swashbuckle.AspNetCore.SwaggerGen.SwaggerGenerator.GenerateRequestBody(ApiDescription apiDescription, SchemaRepository schemaRepository)
at Swashbuckle.AspNetCore.SwaggerGen.SwaggerGenerator.GenerateOperation(ApiDescription apiDescription, SchemaRepository schemaRepository)
--- End of inner exception stack trace ---
at Swashbuckle.AspNetCore.SwaggerGen.SwaggerGenerator.GenerateOperation(ApiDescription apiDescription, SchemaRepository schemaRepository)
at Swashbuckle.AspNetCore.SwaggerGen.SwaggerGenerator.GenerateOperations(IEnumerable`1 apiDescriptions, SchemaRepository schemaRepository)
at Swashbuckle.AspNetCore.SwaggerGen.SwaggerGenerator.GeneratePaths(IEnumerable`1 apiDescriptions, SchemaRepository schemaRepository)
at Swashbuckle.AspNetCore.SwaggerGen.SwaggerGenerator.GetSwagger(String documentName, String host, String basePath)
at Swashbuckle.AspNetCore.Swagger.SwaggerMiddleware.Invoke(HttpContext httpContext, ISwaggerProvider swaggerProvider)
at Microsoft.AspNetCore.Server.IIS.Core.IISHttpContextOfT`1.ProcessRequestAsync()
In the Swagger UI page, this is how it looks like:
Do you know how to solve it please? I'm learning on how to display OData parameters ($filter, $skip, $count) for a OData endpoint in Swagger (either by using Swashbuckle or NSwag) and this example looks very promising.
Thanks for your help on this.
Regards,
Jorge
The text was updated successfully, but these errors were encountered:
Hi @commonsensesoftware
Yes, it seems the same issue, I think there is a workaround in one of the last comments in that issue, something about using a unique SchemaId.
I'm looking forward to having a solution for this. Thanks!
As mentioned in the other issue, this specific problem was in Swashbuckle and has been fixed. You shouldn't see any more issues related to duplicate models, but you might run into other bugs in API Versioning that haven't been released yet. You can peek at this branch on how you might be able to fix things while you're waiting for the patch.
Uh oh!
There was an error while loading. Please reload this page.
Hi all,
I'm writing this issue because I was running the projects under the samples folder and found an error when running the SwaggerODataSample.csproj project, located at https://github.com/microsoft/aspnet-api-versioning/tree/master/samples/aspnetcore/SwaggerODataSample. When selecting a Swagger definition in the Swagger UI page, either for V1, V2 or V3, this error appears in the output console:
In the Swagger UI page, this is how it looks like:

Do you know how to solve it please? I'm learning on how to display OData parameters ($filter, $skip, $count) for a OData endpoint in Swagger (either by using Swashbuckle or NSwag) and this example looks very promising.
Thanks for your help on this.
Regards,
Jorge
The text was updated successfully, but these errors were encountered: