danielgtaylor / openapi-cli-generator

Generate a CLI from an OpenAPI 3 specification
MIT License
181 stars 49 forks source link

Nested objects in args #23

Closed caesterlein closed 5 years ago

caesterlein commented 5 years ago

Thanks so much for this awesome project! I have been able to use it to quickly create a CLI for my web API.

However, my more complex search queries require nested objects and lists.

For example, my POST body would look like this- '{"queries":[{"type":"queryText","value":"climate"}],"filters":[{"type":"geometry","geometry":{"type":"Polygon","coordinates":[[[-176.64917,0.197754],[-124.790955,0.197754],[-124.790955,34.85889],[-176.64917,34.85889],[-176.64917,0.197754]]]}}],"facets":true,"page":{"max":20,"offset":0}}'

How would I write this on the command line? No matter what I try, I get an error like this-

FATAL openapi.go:1101 Unable to get body stdin:1:73 (72): no match found, expected: [^,:}], [^:] or EOF

Am I doing it wrong or is this a limitation of the json parsing?

caesterlein commented 5 years ago

Never mind, figured it out thanks to the docs here- https://github.com/danielgtaylor/openapi-cli-generator/tree/master/shorthand

Thanks again!