DoclerLabs / api-client-generator

API client generator is a console application capable of generating an API client based on OpenAPI(Swagger) specification.
MIT License
31 stars 19 forks source link

Add petstore3 API request examples #26

Closed mikemadisonweb closed 3 years ago

mikemadisonweb commented 3 years ago

image

Hohoho! The idea is to generate a whole example suite and run it during the acceptance test. Tell me what you think guys. I chose petstore3 specification, which appears to be full of sh*t, so all of the other changes are related to that fact. So acceptance test generates an example client, run it, and verifies it receives 200 responses and has no exceptions. That way example client would be always up-to-date automatically upon new features. Tests are passing for me now, but PR is not completely ready I guess. At least I need to change the docs, code style, and static analisys errors. However, I need early feedback as the changeset is quite substantial(please close your eyes while checking XmlContentTypeSerializer:grinning:).

mikemadisonweb commented 3 years ago

Oh and Merry Christmas and a Happy New Year! Whatever you like the most:smiley:

vsouz4 commented 3 years ago

(please close your eyes while checking XmlContentTypeSerializer😀).

can't we use some lib for this XML stuff? I just quickly googled it, smth like https://github.com/spatie/array-to-xml idk... or maybe there's no good lib out there 'cause nobody cares to freaking XML LOL

anyway, if we need to have it, ok, NVM, but maybe we could consider adding this serializer (or every serializer as a matter of fact) only if I define application/xml on some endpoint of my openapi yaml definition? Then at least the great majority of autogenerated clients wouldn't ever see this beautiful XML serializer file 🤣

mikemadisonweb commented 3 years ago

I am thinking about adding the serializers conditionally, only if it was mentioned in the specification. But it needs to be implemented, that is a good candidate for another PR. Yeah, XML is full of garbage, you lib for example convert array to XML, but not the other way around. I started by checking the existing XML libs, but first of all, they all work with objects, not arrays, and also I don't want the client to commit to another dependency. Don't think that it's bad to have as many serializers as possible, especially if it is tested and works as expected.

vsouz4 commented 3 years ago

I am thinking about adding the serializers conditionally, only if it was mentioned in the specification. But it needs to be implemented, that is a good candidate for another PR.

Ok, we can leave it for a follow up PR, np

vsouz4 commented 3 years ago

I've resolved some threads, also reviewed the ones you resolved, but there are open threads from the last review which are valid still, can u please check them?

mikemadisonweb commented 3 years ago

@vsouz4 I resolved everything I saw in the PR and even now, I don't see any unresolved comments. What is it, a Github bug?

EDIT: ah, I see now. It was hidden, how handy...