codegen of $ref JSON pointer references

55 views
Skip to first unread message

Lex Luthra

unread,
Oct 24, 2016, 7:14:56 PM10/24/16
to Swagger
I recently created a new OpenAPI project using YAML and generated a client using codegen module. As per some of the advice on this and other forums, I subsequently split my spec into several files and used JSON pointer references to link them. However, I noticed that when using codegen to generate Java client classes there are a few classes missing, namely those that come from a different file and that are referenced using the said JSON pointers.

Is there a way to coerce codegen to generate ALL required classes?


tony tam

unread,
Oct 25, 2016, 12:41:46 AM10/25/16
to swagger-sw...@googlegroups.com
Hi Lex,
If you could please share some details of your structure, we can look at it.  There are a couple known issues with swagger-parser (the underlying parse/resolve utility for codegen) that are being worked on right now.  If you have additional test cases, I’d love to get them in.

See here:


On Oct 24, 2016, at 4:14 PM, Lex Luthra <alex....@gmail.com> wrote:

I recently created a new OpenAPI project using YAML and generated a client using codegen module. As per some of the advice on this and other forums, I subsequently split my spec into several files and used JSON pointer references to link them. However, I noticed that when using codegen to generate Java client classes there are a few classes missing, namely those that come from a different file and that are referenced using the said JSON pointers.

Is there a way to coerce codegen to generate ALL required classes?



--
You received this message because you are subscribed to the Google Groups "Swagger" group.
To unsubscribe from this group and stop receiving emails from it, send an email to swagger-swaggers...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Lex Luthra

unread,
Oct 27, 2016, 8:22:01 PM10/27/16
to Swagger
Hi Tony,

I am attaching a standalone test harness that can be used to test the said issue (codegen not generating *all* Java classes for some JSON pointer references in the spec).

Cheers,
Lex.
To unsubscribe from this group and stop receiving emails from it, send an email to swagger-swaggersocket+unsub...@googlegroups.com.
oai-test-harness.tar.gz

tony tam

unread,
Oct 27, 2016, 11:20:55 PM10/27/16
to swagger-sw...@googlegroups.com
Hi Lex, please pull master and test it.  A major update was pushed today to the swagger-parser which addresses the relative references that you seem to have in your doc.


To unsubscribe from this group and stop receiving emails from it, send an email to swagger-swaggers...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.
<oai-test-harness.tar.gz>

Lex Luthra

unread,
Oct 28, 2016, 1:50:33 AM10/28/16
to Swagger
Hi Tony,

I can confirm the issue has been fixed on master: 31b32a8 - Merge pull request #4094 from swagger-api/issue-4090

Thanks,
Alex
<oai-test-harness.tar.gz>

tony tam

unread,
Oct 28, 2016, 11:51:58 AM10/28/16
to swagger-sw...@googlegroups.com
Great, thanks for the follow-up

To unsubscribe from this group and stop receiving emails from it, send an email to swagger-swaggers...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages