-
Notifications
You must be signed in to change notification settings - Fork 760
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
drop 1.0, 1.1, 1.2 code, build a 2.0 transformer #259
Comments
We build a convertor from 1.2 to 2.0 here |
In all honesty, 1.2 and 2.0 aren't all that different. In swagger-tools, we have one code base that works with both types without a lot of effort. It's not perfect but it felt a lot better than separating implementations only to have a bunch of copy/paste/duplication. What if we were to have a version-specific object model but a single source base that handled both intelligently? Just a thought. |
There are similarities when done right, once you fetch the apiDeclaration files. My thought was that the transformer would be rein single for fetching the additional files (with authentication as needed) by using the same underlying swaggerHttp object. We then have different transformers for each spec version. Make sense? |
I don't know the API well enough yet to answer but when I do, I'll let you know. |
My view on the API to invoke the transformer is something along these lines: var spec = ....;
var version = parseFloat(spec.version);
if(version === 1.2) {
new Swagger12Transformer().resolve(spec, // spec passed in by swagger-ui
self.buildFromSpec, // callback to build the client from a 2.0 spec
self); // scope for the callback
}
else if(version === 1.1) {
// ...
} |
this would allow us to remove the entire |
see here: #309 Remaining tasks:
|
The swagger-compat library keeps the code separate, but we should really remove it all, and add a simple converter from the 1.x specs to 2.0. Then the same 2.0 codepath can be used.
The text was updated successfully, but these errors were encountered: