pyopenapi / pyswagger

An OpenAPI (fka Swagger) client & converter in python, which is type-safe, dynamic, spec-compliant.
MIT License
385 stars 89 forks source link

How to instantiate App from a json string? #86

Closed skasturi closed 8 years ago

skasturi commented 8 years ago

I am storing the JSON in a database and would like to access it from there. Is there a way to create App from a string?

mission-liao commented 8 years ago

It was provided before Swagger 1.2, but removed after 2.0. I could add it back with these concerns in mind:

SwaggerApp.load(....)
SwaggerApp.prepare(...)

I'll try this part this weekend. before that, the only way for you is save it to a temporarily file and load it back (looks really dumb)

skasturi commented 8 years ago

Thanks. I will give it a shot once you add it.

mission-liao commented 8 years ago

I just implement this part in master branch, please refer to this document for its usage. There is some limitation for multiple documents case, but should be fine for single document. Feedback is welcome.