Skip to content
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

Closed
fehguy opened this issue Feb 26, 2015 · 7 comments
Closed

drop 1.0, 1.1, 1.2 code, build a 2.0 transformer #259

fehguy opened this issue Feb 26, 2015 · 7 comments
Assignees
Milestone

Comments

@fehguy
Copy link
Contributor

fehguy commented Feb 26, 2015

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.

@fehguy fehguy added this to the v2.1-M2 milestone Feb 26, 2015
@mohsen1
Copy link
Contributor

mohsen1 commented Feb 26, 2015

We build a convertor from 1.2 to 2.0 here
https://github.com/apigee-127/swagger-converter

@whitlockjc
Copy link
Contributor

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.

@fehguy
Copy link
Contributor Author

fehguy commented Feb 26, 2015

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?

@whitlockjc
Copy link
Contributor

I don't know the API well enough yet to answer but when I do, I'll let you know.

@fehguy
Copy link
Contributor Author

fehguy commented Feb 27, 2015

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) {
  // ...
}

@fehguy
Copy link
Contributor Author

fehguy commented Mar 4, 2015

this would allow us to remove the entire swagger-compat.js class.

@fehguy
Copy link
Contributor Author

fehguy commented Mar 22, 2015

see here: #309

Remaining tasks:

  • migrate api descriptions to tags
  • add security definitions
  • handle .{format} on execute

fehguy added a commit that referenced this issue Mar 23, 2015
fehguy added a commit that referenced this issue Mar 24, 2015
fehguy added a commit that referenced this issue Mar 24, 2015
@fehguy fehguy closed this as completed Mar 24, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants