Error "Duplicate schemaIds detected" without schema name.
See original GitHub issueTry to access http://localhost:52840/swagger/docs/v1
I got this message
Conflicting schemaIds: Duplicate schemaIds detected for types and . See the config setting - "UseFullTypeNameInSchemaIds" for a potential workaround
Use c.UseFullTypeNameInSchemaIds()
in SwaggerConfig.cs
still not help.
<Error>
<Message>An error has occurred.</Message>
<ExceptionMessage>
Conflicting schemaIds: Duplicate schemaIds detected for types and . See the config setting - "UseFullTypeNameInSchemaIds" for a potential workaround
</ExceptionMessage>
<ExceptionType>System.InvalidOperationException</ExceptionType>
<StackTrace>
at Swashbuckle.Swagger.SchemaRegistry.CreateRefSchema(Type type) at Swashbuckle.Swagger.SchemaRegistry.CreateInlineSchema(Type type) at Swashbuckle.Swagger.SchemaRegistry.GetOrRegister(Type type) at Swashbuckle.Swagger.SwaggerGenerator.CreateOperation(ApiDescription apiDesc, SchemaRegistry schemaRegistry) at Swashbuckle.Swagger.SwaggerGenerator.CreatePathItem(IEnumerable`1 apiDescriptions, SchemaRegistry schemaRegistry) at Swashbuckle.Swagger.SwaggerGenerator.<>c__DisplayClass7.<GetSwagger>b__4(IGrouping`2 group) at System.Linq.Enumerable.ToDictionary[TSource,TKey,TElement](IEnumerable`1 source, Func`2 keySelector, Func`2 elementSelector, IEqualityComparer`1 comparer) at Swashbuckle.Swagger.SwaggerGenerator.GetSwagger(String rootUrl, String apiVersion) at Swashbuckle.Application.SwaggerDocsHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken) at System.Net.Http.HttpMessageInvoker.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken) at System.Web.Http.Dispatcher.HttpRoutingDispatcher.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken) at System.Net.Http.DelegatingHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken) at System.Web.Http.HttpServer.<SendAsync>d__0.MoveNext()
</StackTrace>
</Error>
Issue Analytics
- State:
- Created 7 years ago
- Comments:11 (1 by maintainers)
Top Results From Across the Web
swagger error: Conflicting schemaIds: Duplicate ...
Every class in the swagger JSON must have a unique schemaId. Swashbuckler tries to just use the class name as a simple schemaId, ......
Read more >Swashbuckle Duplicate SchemaId Detected
Swashbuckle Duplicate SchemaId Detected ... Use the default implementation of the Class Name (without Namespace) when possible.
Read more >Duplicate schemaIds detected for types A and B-asp.net-web ...
I am using Asp.net Core 2.1. This error resulted when I tried to show Swagger UI. Every class in the swagger JSON must...
Read more >C# – swagger error: Conflicting schemaIds: Duplicate ...
Using Web API and using swashbuckle to generate swagger documentation, I defined two different classes with the same name in two different namespaces....
Read more >Swagger duplicate schemaIds #5190
Hi - Swagger is throwing the following error. I already added c.UseFullTypeNameInSchemaIds(); to WebApiModule.cs file.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Every class in the swagger JSON must have a unique schemaId.
Swashbuckler tries to just use the class name as a simple schemaId, however if you have two classes in different namespaces with the same name (as you do) this will not work.
As the error suggests, you can use the config setting “UseFullTypeNameInSchemaIds” for a potential workaround.
if your concern is How to use “UseFullTypeNameInSchemaIds” in .NetCore middleware? you can achieve the same behavior via options.CustomSchemaIds(x => x.FullName).
Here is an example:
for more information
http://wegotcode.com/microsoft/swagger-fix-for-dotnetcore/
This has been fixed when using UseFullTypeNameInSchemaIds option.