Forum Discussion

alex-estela's avatar
alex-estela
New Contributor
8 years ago

Codegen feature not working

Hi all,

 

I am trying to use the "Codegen" feature of SwaggerHub. However it always results in a "SwaggerHub Error".

 

The spec of my API is valid according to the SwaggerHub parser. I also configured the generation feature using the "Edit Codegen Options" window. I tried different types of generation (client, server, different languages) but it still results in an error.

 

Are there other attention points I could have missed ? Any advice on how to debug this issue ?

 

Thanks in advance for your support.

Alex

5 Replies

  • Hi Alex,

     

    Sorry to hear! Is your definition public?  If so I'd be happy to look at it to see what is putting the codegen in a tizzy.  Also what language/target are you building?

      • fehguy's avatar
        fehguy
        Staff

        Hi, thanks for sharing.  I've found a couple things:

         

        * The swagger-parser (used by codegen) doesn't seem to like having an "allOf" item with just one value.  I've logged that and we'll get it fixed in SwaggerHub as well as OSS.

        * The codegen seems to like having the $ref as the first array item.  It shouldn't care, so that's a bug.  To work around it, just move the $ref to the first item

         

        With that, here's your definition updated and working for java client and inflector.  Note that for the allOf constructs with one item, I just made it a simple model.  You may need to change that if you're going to extend them.

         

        https://swaggerhub.com/api/fehguy/piframe/0.0.3

         

        Let me know when you have pulled the changes into your version and I'll delete my fork.