Forum Discussion

paduffy's avatar
paduffy
Occasional Contributor
7 years ago

Client codegen errors only for specific targets (csharp, java)

I have an interface definition determined to be valid by SwaggerHub, yet csharp client code gen fails with "

SwaggerHub Error
There was an error generating the clients csharp code. Please ensure that the spec is a valid definition."
 
Any ideas?  Known code gen issues with csharp clients?
 
Tactics to quickly locate the issue?
 
Thanks
 

5 Replies

  • Hi,

     

    I did a quick test with an API and the csharp and java codegen looks to be working.  Please let us know which API you are using and if it is private please add swaggerhub-support as a collaborator so we can look further into this.

     

    Regards,

    Marcus

    SmartBear Support

      • fehguy's avatar
        fehguy
        Staff

        Hi!  Thanks for the information.  I believe the issue is in the FrameSubscription model:

         

        packetType:
          description: ...
          type: array
          items: {
              enum: ["UDP", "ICMPV6", "PA", "PAS", "PC", "PCS"]            
          }

        Please try changing the items like such:

         

        packetType:
          description: ...
          type: array
          items:
            type: string
            enum: ["UDP", "ICMPV6", "PA", "PAS", "PC", "PCS"]            
        

        While it is legal in JSON Schema to let the type of an attribute (items in this case) be defined by the enum, it is not supported in the specification.  So being explicit with the type: string should solve the problem.