jhthorsen / openapi-client

A client for talking to an Open API powered server
11 stars 17 forks source link

Allow pre-BUILD mixins #37

Closed rabbiveesh closed 2 years ago

rabbiveesh commented 2 years ago

This is an implementation of what I meant for #35. Again, the issue I was having is that I wanted to mix in a role which had defaults for attributes and other things that would normally happen at BUILD time. Since I could only mix the behavior in after instantiation, I had to manually pass through some of the behavior that I wanted to.

This PR simply replaces the fixed $BASE that OpenAPI::Client uses to be the parent for generated class to instead be the dynamic one that's called.

jhthorsen commented 2 years ago

Can you rebase in main so we get automatic testing?

rabbiveesh commented 2 years ago

Yes, will account for all the comments, thanks!

Wrt new on an object: after I did the change, I realized that new on an object wouldn't really make sense. Should it die, or should it just crash when it naturally would?

On Wed, Jun 1, 2022, 04:38 Jan Henning Thorsen @.***> wrote:

@.**** commented on this pull request.

In t/client.t https://github.com/jhthorsen/openapi-client/pull/37#discussion_r886251435 :

isa_ok($client, 'OpenAPI::Client'); can_ok($client, 'addPet');

+subtest 'pre-mixing roles' => sub {

Can you also update https://github.com/jhthorsen/openapi-client/blob/main/.github/workflows/ci-ubuntu.yml#L25 to install Role::Tiny?

— Reply to this email directly, view it on GitHub https://github.com/jhthorsen/openapi-client/pull/37#discussion_r886251435, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFURPKWQ4D5SI7M7XXE3WX3VM25IJANCNFSM5XOSGJPA . You are receiving this because you were assigned.Message ID: @.***>