wcatron / ionic-cloud-sdk-php

Ionic Cloud SDK for PHP
MIT License
2 stars 2 forks source link

Consider using swagger spec #8

Closed imhoffd closed 8 years ago

imhoffd commented 8 years ago

A specification for the API is being manually written in JSON, but the API has a swagger/OpenAPI Spec.

If these JSON files could be downloaded into this repository, it might be easier:

We'll still need to somewhere store the class (e.g. "\\Ionic\\Users\\Models\\User"), but it should be a lot easier to track API changes if the swagger files are put in version control.

Take a look at:

wcatron commented 8 years ago

Okay, researched this thoroughly. Definitely want to use those swagger specs. It will help tremendously when we get to versioning. I looked into the swagger code generator which "works" but it's generated code and looks very messy. It doesn't use guzzle although I saw an open pull request for them to do that. It's also problematic because it only covers one end point so we'd have to merge them some how since we want to cover all of them.

I'll start work on a RouteParser for the swagger.json files.

imhoffd commented 8 years ago

Yeah, I figured we'd need to do something custom to group the stuff together because swagger itself has no concept of RESTful endpoints. RouteParser sounds awesome 👍

This should be easier than maintaining that JSON file =)

wcatron commented 8 years ago

So there's no way around mainting some sort of JSON file. So alternatively I've created a script that takes the swagger parameter information and inserts it into the API Json file. It's not great but it can be rerun if the apis change. I added a concept of versioning. I can't say I'm a huge fan of swagger the end goal is to map a command with parameters to a Request. I'm going to look into this project as it has a lot of similar code and see if it had a more complete swagger implementation. Until then I think what I've got will get us up and running. I may replace it if there's a good alternative.