-
-
Notifications
You must be signed in to change notification settings - Fork 50
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support $ref references to separate files in OpenAPI specifications. #192
Comments
@naaeef thanks for taking the time to report this I was unaware of this feature in the OpenAPI spec. Do you have an example spec that does this? I use NSwag to parse the OpenAPI spec, it might even already be supported out of the box, but I don't know |
@christianhelle Hello, |
@kami-poi Thanks for the example. This will be a big help! I'll see what I can do over the holidays |
@kami-poi I was looking into this today using the repo you provided and it seems like NSwag just doesn't support multiple OAS files. I'll experiment with how far I can get with using the Microsoft OpenAPI toolchain OpenAPI validation seems to work fine and prints out
I would hate to have to generate the contracts by hand using the MS OpenAPI toolchain since this is already a solved problem by NSwag |
@christianhelle It seems that NSwag has some issues with $ref. Refitter can find other OAS files but failed on processing other files' $ref field. So maybe we can load all OAS files and combine them into a single file, and then send it to refitter gengrator. It's similar to preprocessing, and it can make NSwag to correctly handle the following steps. |
@kami-poi This is exactly what I ended up doing!
Currently, it supports having external references to files within the same folder, or remotely. But it won't work if the remote file has local external references. These scenarios work:
This scenario doesn't work:
If you can live with this @kami-poi @naaeef then I will merge in my working solution to the main branch and publish a release |
@christianhelle This is already sufficient for my usage scenario, thank you! |
Is your feature request related to a problem? Please describe.
I'd like to generate the refit internfaces for an OpenAPI specification that consists of multiple files that are linked to each other using $ref (see https://swagger.io/docs/specification/using-ref/).
Describe the solution you'd like
It would be great if refitter would support $ref.
Describe alternatives you've considered
The alternative would be to merge the files first using a different tool. But it would be much easier, if this extra step could be avoided.
Additional context
Thank you for your help.
The text was updated successfully, but these errors were encountered: