The correct way to pull stuff from classpath in $ref

1,315 views
Skip to first unread message

Sohrab

unread,
May 24, 2016, 5:02:00 AM5/24/16
to Swagger
Looking at the swagger-parser source code, Swagger Codegen definitely supports pulling stuff for a $ref from the classpath. But for the life of me, I cannot figure out how to make it work.

To demonstrate my problem, I just put together a quick git repo: https://github.com/sohrab-/swagger-classpath-ref

In there, I have a common project and a service project, that depends on common. The Swagger YAML file in service attempts to pull a parameter which is defined in common but with little success. The file is definitely there in the common-1.0.jar.

To replicate my issue, do a mvn clean install in the common directory first. Then try mvn clean install in the service directory. It'll fail with

Failed to execute goal io.swagger:swagger-codegen-maven-plugin:2.1.6:generate (default) on project service: Execution default of goal io.swagger:swagger-codegen-maven-plugin:2.1.6:generate failed: Unable to load RELATIVE ref: ./parameters.yaml: Could not find ./parameters.yaml on the classpath


Obviously if you copy common/src/main/resources/parameters.yaml into service/src/main/resources, then it all works. But my goal is to keep the common stuff in their own project.


Anyone know what I am doing wrong or if this is even possible?

tony tam

unread,
May 24, 2016, 12:49:49 PM5/24/16
to swagger-sw...@googlegroups.com
Can you please open an issue on swagger-parser for this?

--
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.

Sohrab

unread,
May 24, 2016, 8:58:40 PM5/24/16
to Swagger
Done: https://github.com/swagger-api/swagger-parser/issues/249

So do you think it's an actual bug? I just thought I wasn't using it right (it is pretty hard to find examples of this usage in the wild).
To unsubscribe from this group and stop receiving emails from it, send an email to swagger-swaggersocket+unsub...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages