I suggest you use a command-line tool to build a composed YAML file that uses a $include tag like this https://github.com/javanile/yamlinc Consider a group of YAML file as a subproject and compose it like gulp-concat compose multiple JS files. $ref is more restricted for large project (It is only my opinion)
Il giorno venerdì 15 aprile 2016 20:08:54 UTC+2, tony tam ha scritto: > > Hi, you can certainly use references to other files, relative or absolute > are supported. Any place you see a $ref supported in the spec, you can use > them. > > The references can be to YAML or JSON structured files. It should be > trivial to split your definition up using those constructs. I suggest you > look at the specification itself: > > https://github.com/OAI/OpenAPI-Specification > > Or samples in the specification repository. > > Tony > > On Apr 15, 2016, at 3:28 AM, lucien combe <[email protected] > <javascript:>> wrote: > > > > On Friday, 15 April 2016 11:25:29 UTC+1, lucien combe wrote: >> >> >> Hello Tony, >> >> You are right sorry. I am a new Swagger user and i am trying to became a >> champion :) . >> >> Actually, i am describing my API using YAML. To be able to re use models >> i split files using the structure below : >> >> - api/commons/ >> - *definitions.yaml* >> - api/myApi_1/ >> - *swagger-my_Api_1.yaml* >> - api/myApi_1/ >> - *swagger-my_Api_1.yaml* >> >> Hence, in my *swagger-my_Api_1.yaml and **swagger-my_Api_1.yaml *i got >> some *$ref* like *'../commons/defintions.yaml#/MyModel'* . >> This works like a charm. >> >> Now, i need to have a JSON version of each file. Here come problems, as i >> am not able to make reference to external files. >> >> - It doesn't work with *URL* reference too. This solution breaks my >> directory structure logic anyway. >> - I am not able to find a complete example of *JSON* external >> references to be able to check mine. >> - When using external models, do i have to use the *definitions* >> markup ? (I do not while using YAML and it works) >> - Is relative path working using *JSON* ? >> - I am using Swagger 2.0 >> >> Thanks for your help >> >> >> >> >> >> On Tuesday, 12 April 2016 18:46:21 UTC+1, tony tam wrote: >>> >>> Lucien, please explain more what you’re trying to do. The question is >>> poor as well :) >>> >>> On Apr 12, 2016, at 2:48 AM, lucien combe <[email protected]> wrote: >>> >>> The documentation on the official web site is poor, as you are not the >>> only one wondering for this. They don't give explicit example. >>> >>> Any help please ? >>> >>> On Friday, 3 April 2015 05:00:39 UTC+1, Bailey Smith wrote: >>>> >>>> Sorry to bring this back from the dead, but I'm working with >>>> development, staging and production environments, so I'd love to get $ref >>>> to work with relative paths for the definitions at least. Emily, did you >>>> find a solution that worked for you? >>>> >>>> On Monday, October 27, 2014 at 1:10:49 PM UTC-7, [email protected] >>>> wrote: >>>>> >>>>> All right, thanks Tony. Interesting. I will look into this and see if >>>>> I can get it to work. Thanks! >>>>> >>>>> Emily >>>>> >>>> >>> -- >>> 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 [email protected]. >>> 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 [email protected] <javascript:>. > 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 [email protected]. For more options, visit https://groups.google.com/d/optout.
