pyswagger icon indicating copy to clipboard operation
pyswagger copied to clipboard

support open api 3.0 spec

Open mission-liao opened this issue 9 years ago • 5 comments

For anyone interested in supporting OAI 3.0.0, this part would be done in pyopenapi and would be integrated back here (as a separated python package) once finished.

It's the root issue of supporting OpenAPI 3.0 spec.

according to this, 3.0 spec would be released at Feb, 28, 2017, below is the TODO items:

  • [x] investigate the difference between 2.0 and 3.0 (5hrs)
    • host, basePath -> Server Object
    • collectionFormat is much more general -> Style Object, explode
    • "Content-Type" is now handled by Media Object and Encoding Object
      • "file" parameter is also handled by Content Object: {"multipart/form-data": Media Object}
  • [x] implement 3.0 parser (10 hrs)
  • [x] implement 2.0 to 3.0 upgrader (6 hrs)
  • [x] implement migration in pyswagger.core (>20 hrs)
  • [ ] re-implement existing components on 3.0 objects
    • [ ] io
    • [ ] security
    • [ ] renderer
    • [ ] Operation.call
  • [ ] new features in 3.0
    • [ ] multiple hosts (Server Object)
    • [ ] static link between response and operations (Link Object)
    • [ ] operation callback(Callback Object) <-- seems nothing to do @ client-side
    • [ ] anyOf, oneOf, not (Schema Object) <-- non-deterministic way would not be supported
      • [ ] ~~not: see if we can add a bypass mode: encode without type info (1.5 hr)~~
      • [ ] ~~anyOf~~
      • [ ] ~~oneOf~~
  • [ ] fix found bugs
    • [ ] discriminator is missed in 2.0, need to add it back
    • [ ] a parameter is identified by the combination of "name" and "location", we need a way to resolve when names are conflict
    • [ ] better way to convert pyswagger.primitives to python primitives (DateTime)
  • [x] ~~version schema change to follow open-api's version (we only use the last part: 0.0.0.x)~~
  • [ ] documentation for deprecation from 2.0 if any

would update my progress on this issue.

mission-liao avatar Feb 04 '17 08:02 mission-liao

Is there code to test?

edevil avatar Jul 16 '18 13:07 edevil

@edevil I've wrote a migrator (from 1.2, 2.0 to 3.0), however still didn't have time to integrate it back to pyswagger. If you are willing to give it a try, its path is here and any feedback is welcome.

Its usage is simple and can be demo in this code snippet:

# load an OpenAPI spec (could be either 1.2 or 2.0), and migrate it to 3.0
app = SampleApp.create(doc_path, to_spec_version='3.0.0')
# resolve a JSON Reference in the migrated 2.0 spec, and get corresponding 3.0 JSON object
app.resolve_obj(''#/paths/~1p1/get', from_spec_version='2.0', to_spec_version='3.0.0')

mission-liao avatar Jul 17 '18 14:07 mission-liao

Has this moved any bit? pyswagger is listed as the only openapi client for python, yet it's still listed as under construction for openapi3 [1]. I'm new to openapi3 (openapi or swagger general), and I'm quite confused as to the fragmentation and number half implemented openapi3 libs around on pypi [2]. Is there an official front that python user can go to and follow progress? I just have a openapi 3 spec yaml at a URL and would like to make a client for it, but don't know how to use the SampleApp example you've written.

[1] https://openapi.tools/ [2] https://pypi.org/search/?q=openapi

ruffsl avatar Dec 03 '18 09:12 ruffsl

Development of support for OpenAPI v3.0 has stagnated. Are there still plans to do this, or is this off the table for now?

advance512 avatar Apr 21 '19 15:04 advance512

I'll take it off openapi.tools if we're definitely not moving forward here? I know life can get in the way of stuff so maybe we can find a new maintainer, or maybe we can just call it a day and mark it as archived?

philsturgeon avatar Aug 22 '19 17:08 philsturgeon