Hello,
I am trying to import VISA Alias Lifecycle Management API's json api reference file using Visual Studio 2019 / Nswag.
however, code generation is failing due to the below error:
System.InvalidOperationException: The properties 'type' are defined multiple times. at NJsonSchema.JsonSchema.get_ActualProperties().
Have anyone faced this issue with this api reference file? noting that for other files (ie: VISA Direct) I have no issues.
Thanks,
Rami
Hi @RamiC, Thank you for reaching out. One of our agents will look into this and get back to you soon. Until then, if any community members have information that may help, feel free to reply to this thread.
Hello @SyedSa ,
thanks you for you reply, did any of your agents get the chance to look into this?
Regards,
Rami
Hi @RamiC,
To investigate the error, please provide the information below.
1. End Point
2. Request Header
3. Request Body
4. Response Header (include the x-correlation-id)
5. Response Body
You can find the x-correlation-id in the response header.
Dear @API_Products,
thank you for you reply, my problem is not while calling the API, my problem is when trying to add the api-reference.json file to Visual Studio 2019 as openApi client, i get the following error noting that for other Visa APIs i have no issue:
Failed adding service reference(s). Code generation for file NSwag.exe failed.
Command line: openapi2csclient /input:"C:\Users\rchamass.CSC\Desktop\ADS_api_ref.json" /classname:Visa_ADS /namespace:VISA_API /output:"\\csclebanon.com\Shares\DEVDEP\PM\WEB Projects\VISA PROJECTS\VISA_Alias\Visa_Alias_Management\OpenAPIs\ADS_api_ref.cs"
Output: NSwag command line tool for .NET 4.6.1+ WinX64, toolchain v13.8.2.0 (NJsonSchema v10.2.1.0 (Newtonsoft.Json v11.0.0.0))
Visit http://NSwag.org for more information.
NSwag bin directory: C:\Users\rchamass.CSC\AppData\Local\Microsoft\VisualStudio\16.0_43dd5d27\WebTools\Downloads\NSwag.MSBuild\13.8.2\tools\Win
System.InvalidOperationException: The properties 'type' are defined multiple times.
at NJsonSchema.JsonSchema.get_ActualProperties()
at NJsonSchema.JsonSchema.get_IsDictionary()
at NJsonSchema.CodeGeneration.CSharp.CSharpTypeResolver.IsDefinitionTypeSchema(JsonSchema schema)
at NJsonSchema.CodeGeneration.TypeResolverBase.RegisterSchemaDefinitions(IDictionary`2 definitions)
at NSwag.CodeGeneration.CSharp.CSharpGeneratorBase.CreateResolverWithExceptionSchema(CSharpGeneratorSettings settings, OpenApiDocument document)
at NSwag.Commands.CodeGeneration.SwaggerToCSharpClientCommand.<<RunAsync>b__92_0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at NSwag.Commands.CodeGeneration.SwaggerToCSharpClientCommand.<RunAsync>d__92.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at NSwag.Commands.CodeGeneration.SwaggerToCSharpClientCommand.<RunAsync>d__91.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at NConsole.CommandLineProcessor.<ProcessSingleAsync>d__12.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at NConsole.CommandLineProcessor.<ProcessAsync>d__11.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at NConsole.CommandLineProcessor.Process(String[] args, Object input)
at NSwag.Commands.NSwagCommandProcessor.Process(String[] args)
Hi @RamiC.
Please provide the include the x-correlation-id that can be found in the Response Header so that I can investigate the error.
Hi @API_Products ,
As i mentioned before the error I'm receiving is not while calling the API, there is no request/response here so there is no x-correlation-id.
the error is occurring when Visual Studio is trying to generate code api client code from the api_reference.json file related to Visa Alias Directory Services API.
HI @RamiC,
I logged incident INC18350305 for the engineering team to investigate the error. I'll reply to you when I hear back from engineering.
Thank you, if it helps, I believe the problem is related to CardDetailsRequest and BankAccountDetails having "type" defined multiple times. I
Hi @RamiC,
I'll let the engineering team know.