REST Swagger not loading

Hi all,

I’ve got a bit of a strange one, wondering if anyone else has experienced this and if they were able to resolve.

I’ve been tasked with adding a new function to an existing library. During dev I’ve turned to the Swagger to test but the Swagger fails to load API definition for this particular library. And only this library - all others work as normal. I get this:

We run three instances on prem - Dev, Test and Live. So I tried Swagger on the other instances and get the same thing. Only this one library seems to error, all others work as usual. Any idea what’s going on here? How have I broken it this time? :blush:

Cheers,

Ryan

1 Like

What is the error in the server event viewer?

1 Like

Is this library included in the Access Scope for the API Key you are testing with?

1 Like

Hi Dan,

Yes, the scope includes all BO’s and references used. I’ve tested functions in this library previously without issue and haven’t had to add any new BO’s to the scope.

Cheers,

Ryan

I think you might be onto something here Olga.

Ice.Common.EpicorServerException: Failed to generate Schema for type - Erp.Tablesets.QuoteTableset. See inner exception
—> Swashbuckle.AspNetCore.SwaggerGen.SchemaGeneratorException: Failed to generate Schema for type - Erp.Tablesets.QuoteTableset. See inner exception
—> Swashbuckle.AspNetCore.SwaggerGen.SchemaGeneratorException: Failed to generate Schema for type - Erp.Tablesets.HedTaxSumTable. See inner exception
—> Swashbuckle.AspNetCore.SwaggerGen.SchemaGeneratorException: Failed to generate Schema for type - Erp.Tablesets.HedTaxSumRow. See inner exception
—> System.InvalidOperationException: Can’t use schemaId “$Erp.Tablesets.HedTaxSumRow” for type “$Erp.Tablesets.HedTaxSumRow”. The same schemaId is already used for type “$Erp.Tablesets.HedTaxSumRow”
at Swashbuckle.AspNetCore.SwaggerGen.SchemaRepository.RegisterType(Type type, String schemaId)
at Swashbuckle.AspNetCore.SwaggerGen.SchemaGenerator.GenerateReferencedSchema(Type type, SchemaRepository schemaRepository, Func`1 definitionFactory)
at Swashbuckle.AspNetCore.SwaggerGen.SchemaGenerator.GenerateSchemaForType(Type type, SchemaRepository schemaRepository)
at Swashbuckle.AspNetCore.SwaggerGen.SchemaGenerator.GenerateSchema(Type type, SchemaRepository schemaRepository, MemberInfo memberInfo, ParameterInfo parameterInfo)
— End of inner exception stack trace —

There was an inclusion made to one of the existing functions in this library at the end of last year (yes, by me!) and I haven’t run the function through the Swagger since. The function is still working without incident in our live enviro so it hasn’t raised my attention until now.

I use Solution Workbench to port versions of the function between instances. I’ll try later today to import the version previous to the last update into our test environment and see if it gets rid of the issue there. That will at least let me know if this change caused the problem. If so I’ll probably have more questions on how to debug and fix this problem…

Cheers,

Ryan

The problem for this library started a few iterations ago. I’ve been unaware of it because the functions still perform as expected, and I’ve built my own debugging output log files to help during dev. These too continue to work. While it’s not crucial that I fix the Swagger access to this library I’d like to repair it for continuity.

So… where do I begin??? The error message doesn’t mean much to me other than telling me the problems started when I linked the project to the Quote tables.

A little background - this library houses all functions that perform EDI Sales Order entry for us, all developed in-house. The iteration of the program that started having issues was requested to also have the ability to add quotes through the same EDI interface.

From the error messages, how can I narrow down the cause of this problem? The error mentions duplication of SchemaID’s but this is all foreign to me! Can you offer any advice on my next steps to resolve this?

Many thanks in advance,

Ryan

I cannot say anything specific without your function. Looks what is HedTaxSumRow and how it is used in your function.