-
-
Notifications
You must be signed in to change notification settings - Fork 155
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
[v3] Option to move referenced definitions/responses/etc. from other files into the relevant keys in the main document #16
Comments
+1 |
Yep, this feature has been requested by several people - including myself :) - so it's definitely going to be in v3.0.0. I'm working on it this week, as a matter of fact. |
Sweet! 🍠 |
@BigstickCarpet Did you make any progress on this? |
Sorry for the silence. I got swamped for a couple of weeks with a work project, so I just resumed working on the Swagger stuff this past weekend. I've stubbed the |
No worries, thanks for the update. 😃 |
Good news! The the |
Well, the good news is that the file size went from 208 KB to 157 KB, the bad news is, I get errors (in Swagger editor). Our setup is like this:
This doesn't seem to be working when using |
Ah, crap. That's a scenario I hadn't accounted for. You're not actually referencing the entire I'll add a test to my test suite to cover this. It might be a few days before I get it fixed though. This is a busy week for me. In the meantime, you can workaround the bug by referencing the entire definitions:
videos-paths:
$ref: operations/videos/videos.yaml |
No rush, thanks James. |
Any news here? |
Sorry, I was away on holiday for most of October (I'm actually sitting in the airport right now, catching-up on a month's worth of emails). I had hoped to get this issue fixed before I left for the month, but that didn't happen. :( The next week or two are going to be really hectic for me, as I'm catching-up on a month's worth of stuff and also starting a new job (at Postman) tomorrow! So I might not get this fixed for a few more weeks. Sorry it's taking so long. :( In the meantime, if you want to take a stab at fixing it and submit a PR, I'd be glad to review and merge it. I don't think it will be a very significant code change, though I could be mistaken. |
No worries. I wouldn't even know where to start, so I think that it's best if I wait for you. Would it be too pushy if I pinged you again in 4-6 weeks? 😟 Good luck at your new job! |
Yes, please feel free to ping me in 4-6 weeks. I promise I'll do my best to have it done by then, but I can't predict what might come up. :) |
Ping =) |
Good news! I finally got around to fixing this! It's fixed in the latest version of JSON Schema $Ref Parser, but I had to make some breaking changes, so I still need to update Swagger Parser to work with it. I should be able to knock that out tomorrow. |
That's great news, I just started using this parser tonight and ran into this issue. Glad to hear it should be fixed very soon! |
Awesome! |
In case you're wondering why this isn't done yet, I'm working on another breaking change in JSON Schema $Ref Parser, so it makes sense to wait to get that in too, rather than releasing two major versions of Swagger Parser back-to-back. |
Thanks for the update. =) |
Any news here? |
Yep. Just resumed working on it yesterday. I was completely swamped for the past three months and haven't been able to work on any of my open-source projects (except the ones that I work on as part of my job). But things are finally back to normal, so I'm trying to get caught-up now. |
Swagger Parser v4.0 beta is now available, and includes the fix for this issue. |
Unfortunately I'm seeing errors like this:
Do you have any ideas? |
@glen-84 Can you post a sample schema that reproduces the error? I'll dig into it. |
It seems to be affecting the
I hope I've included everything. If not, please let me know. Note: It's possible that this was affecting more recent versions of the 3.x series as well. |
@glen-84 Are you sure you ran the 4.0.0-beta-1 version of Swagger Parser? I ran your example above, and it bundled and dereferenced fine on Node 0.12, 4.0, and 5.0. Here's the code I ran. You can run it yourself to verify. |
@BigstickCarpet Now copy the contents of |
@glen-84 - Ah, I didn't realize the errors you were getting were from Swagger Editor, not from Swagger Parser. This appears to be a bug in Swagger Editor. I've opened an issue for it. |
@glen-84 - As a temporary workaround though... you could move the definitions to the |
@BigstickCarpet Thanks! I'll keep an eye on that issue. |
I'm using v3 to dereference my Swagger spec which is broken out into many separate files. It works to create a single file, however the file is unnecessarily large as everything is inlined. It would be really great if you could configure it to move referenced definitions/responses, etc. to the relevant container keys in the main document, instead of inlining everything.
In other words, rewrite the references to point to local keys in the main document, to avoid the repetition.
The text was updated successfully, but these errors were encountered: