Open djbusby opened 7 years ago
having the same problem and found this:
Places Where $ref Can Be Used
A common misconception is that $ref is allowed anywhere in an OpenAPI specification file. Actually $ref is only allowed in places where the OpenAPI 3.0 Specification explicitly states that the value may be a reference.
For example, $ref cannot be used in the info section and directly under paths:
openapi: 3.0.0
info: $ref: info.yaml paths: $ref: paths.yaml
Individual path reference allowed according to document
However, you can $ref individual paths, like so: paths: /users: $ref: '../resources/users.yaml' /users/{userId}: $ref: '../resources/users-by-id.yaml'
@djbusby did you get solution, how did u solve this. I am getting same error. Considering this thread is 5 year old, any memory brush up u can do.....
same problem here with @vivek1082
@vivek1082 and @kusman28 here is where some code I made sorta-solves this: https://github.com/openthc/api/blob/master/bin/build-openapi.php#L54
That script takes the source with the '$ref', then recursively tries to resolve them to build a single output file. Then that output file is fed to code-gen.
I have a swagger.yaml file that is getting huge, 10K+ lines, so it makes sense to break this into logical pieces. Documentation suggests I use '$ref' for this purpose.
I tried this:
Followed by:
Rather than including the contents of the ./swagger/info.yaml file, we get this:
It's similar to this issue maybe? https://github.com/swagger-api/swagger-editor/issues/233
Since I have to represent almost 100 paths, I was hoping to have a paths section that looks like:
As it stands now, even when $ref resolves information in the same file (like Models) my paths section is too dang tall; the file is getting hard to manage.
Coming from asciidoc background I miss the
include::path/file.ad[]
option.