-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow pre-BUILD mixins #37
Allow pre-BUILD mixins #37
Conversation
@@ -11,8 +11,6 @@ use constant DEBUG => $ENV{OPENAPI_CLIENT_DEBUG} || 0; | |||
|
|||
our $VERSION = '1.03'; | |||
|
|||
my $BASE = __PACKAGE__; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can't remember why I used $BASE and not $class (or $parent). I have to look at the git log too see if I added a comment about it...
Can you rebase in main so we get automatic testing? |
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
<#37 (comment)>
:
> 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
<#37 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AFURPKWQ4D5SI7M7XXE3WX3VM25IJANCNFSM5XOSGJPA>
.
You are receiving this because you were assigned.Message ID:
***@***.***>
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll merge it since I can't remember why I used $BASE. Guess I have to fix that later on if someone reports a bug 👍
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.