Using Multiple JSON files with Swagger UI 2.0

4,620 views
Skip to first unread message

mkbry...@gmail.com

unread,
Oct 3, 2014, 1:15:06 PM10/3/14
to swagger-sw...@googlegroups.com
Hello all!

I've got my 2.0 spec up and working great but I have maintainability and scalability concern.  While in Swagger UI 1.2 you could have multiple Json files feed into the UI so there was a separation of resources it looks like Swagger UI 2.0 you must put all of your JSON in one JSON file.  If you're dealing with hundreds of resources this is very hard to maintain and it is much easier to utilize the modular JSON model of 1.2.  My question is, is there any current support for multiple json files being interpreted by the current 2.0 UI and editor? And if not are there any plans in the future for adding this in? I noticed you added in external refs recently but it seems like these are more for traveling to external html pages rather than pulling in internal json docs into one file for the editor to interpret.


Ron

unread,
Oct 3, 2014, 1:18:59 PM10/3/14
to swagger-sw...@googlegroups.com
Hi,

We do plan to offer a way to collate several micro-services, but it is not published yet.
We hope to publish it soon for the benefit of the users.

Ron

On 3 October 2014 20:15, <mkbry...@gmail.com> wrote:
Hello all!

I've got my 2.0 spec up and working great but I have maintainability and scalability concern.  While in Swagger UI 1.2 you could have multiple Json files feed into the UI so there was a separation of resources it looks like Swagger UI 2.0 you must put all of your JSON in one JSON file.  If you're dealing with hundreds of resources this is very hard to maintain and it is much easier to utilize the modular JSON model of 1.2.  My question is, is there any current support for multiple json files being interpreted by the current 2.0 UI and editor? And if not are there any plans in the future for adding this in? I noticed you added in external refs recently but it seems like these are more for traveling to external html pages rather than pulling in internal json docs into one file for the editor to interpret.


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

kany...@fonality.com

unread,
Jul 1, 2015, 7:02:06 PM7/1/15
to swagger-sw...@googlegroups.com
Hi Ron,

Is this feature in the latest swagger, yet ???? Please  let me know ASAP.

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

Josh Ponelat

unread,
Jul 2, 2015, 1:09:02 AM7/2/15
to swagger-sw...@googlegroups.com
Hey,

Ron is on vacation, he'll be back soon...
Regarding remote references (I think that is what you're talking about)
You can "pull-in" different files (accessible via http(s) ) to make up on spec, as far as swagger-ui is concerned.

I'm not sure if you can simply have two separate and complete specs, then merge them (we'll have to wait for Ron for that info)
But at the very least you can reuse... paths, operations, models and parameters.

So if I have a complete spec file...

---
swagger: '2.0'
...
paths:
   /some-path:
     $ref: 'http://my-path-def.com/#internal-ref'            #note the hasbang for referencing elements 'within' the remote file

Then /some-path would have all the operations defined in...'http://my-path-def.com', and under the key '#internal-ref'

Swagger implementations should treat yaml/json as interchangeable, so a json file can reference a yaml file and vice-versa.


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.

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

kany...@fonality.com

unread,
Jul 13, 2015, 8:15:13 PM7/13/15
to swagger-sw...@googlegroups.com
I assume this below feature isn't in version 1.1, right ?

Ron Ratovsky

unread,
Jul 14, 2015, 1:05:21 AM7/14/15
to swagger-sw...@googlegroups.com
Swagger 1.1 was already split into several files, so not sure what you're asking here.
-----------------------------------------
http://swagger.io
https://twitter.com/SwaggerApi
-----------------------------------------

vin...@gmail.com

unread,
Dec 7, 2015, 3:41:19 PM12/7/15
to Swagger
Hi,

  How can we refer to the models defined in a separate json files from the interface file. Does the specification allows us to do so. If yes please help us in using the feature. We are using Swagger 2.0 specifications.Thanks


Regards,
Vinay.
To unsubscribe from this group and stop receiving emails from it, send an email to swagger-swaggersocket+unsub...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

--
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-swaggersocket+unsub...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

--
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-swaggersocket+unsub...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Ron

unread,
Dec 7, 2015, 5:22:57 PM12/7/15
to Swagger
Hi Vinay,

You would simply use a full URL to that JSON file. Please read https://github.com/swagger-api/swagger-spec/blob/master/guidelines/REUSE.md for more information.

vin...@gmail.com

unread,
Dec 10, 2015, 1:43:25 PM12/10/15
to Swagger
Thanks Ron. It worked.

-Vinay.
Reply all
Reply to author
Forward
0 new messages