Closed eaurele closed 5 years ago
thanks for the issue @eaurele
I'm not sure that pets API is working. Can you confirm it works outside of the context of this pkg?
regardless, you are right that this pkg is not working. I just pushed some commits https://github.com/ropenscilabs/apipkgen/commits/master
See the README https://github.com/ropenscilabs/apipkgen#swaggeropenapi for an example of using an openapi spec.
I tried the pet store one but it seems like the API is down.
Let me know if it works or not.
Awesome!
I just picked petstore
as an example, but yes, seems to work, e.g.
$ curl -X GET "https://petstore.swagger.io/v2/store/inventory" -H "accept: application/json"
{"toto":1,"New":1,"availible":1,"unavailable":87,"available":15150,"delivered":1,"ullamco amet cupidata":1,"available\n":1,"shipping":2,"notfailable":1,"avaliable":1,"FAFA":1,"StringValue":1,"tada":4,"10":2,"new":3,"solid":1,"test":1,"Invalid_status_XXX":1,"Nonavailable":1,"3.14":1,"Offline":1,"test pet's status":16,"labor":1,"1":1,"NA":1,"rrr":1,"null":1,"fsf":1,"string-shortDesc":1,"avakkilable":1,"booked":1,"string":227,"hidden":5,"nisi pariatur eu in":1,"pending":176,"available;pending;sold":1,"dead":1,"ava":1,"1234":9,"not available":1,"avaidlable":1,"ok":1,"avㄹㅇㄹailable":1,"sold":360,"avaliabe":1,"available1":1,"available0":1,"fasfaf":1,"Alive":1,"availabl":2,"processed":1,"string (optional)":1,"traininig":8,"bussy":3,"Pending":1,"nulla":1}
Now to my real world example: https://data.castoredc.com/api/swagger
Some endpoints have dashes -
, those seem to be a problem in auto-generated function names. Would you like a separate issue for that?
Regarding the Swagger example in the updated README: it downloads a JSON and gives it a .yaml
extension. But it works anyway, which is great!
Also, would you like a very simple PR for the dash issue?
I'm thinking adding backquotes in sprintf("`%s` <- function(%s, ...) {", ....
or removing dashes altogether in gsub("\\{|\\}|-", "", ....
or gsub("[{}-]", ....
sorry I was mistaken abou petstore not working 😬
-
those seem to be a problem in auto-generated function names. Would you like a separate issue for that?
yes, thanks - and yes a PR would be good
* it downloads a JSON and gives it a `.yaml` extension
sorry about that eg, will fix. the parser we use to parse swagger specs is yaml::yaml.load_file()
and it works for json and yaml
i think this is sorted now
Thank you for this package, I really like the idea!
I meant to try with a swagger file, but it doesn't seem to work.
Created on 2019-02-13 by the reprex package (v0.2.1)
Wondering if this comes from https://github.com/ropenscilabs/apipkgen/commit/3d6c27f7e9d568c8dde299ca8fe15331f33862e4 ?