-
Notifications
You must be signed in to change notification settings - Fork 14
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
Add support for generating hack enums from json def #81
Conversation
Thanks for the contribution! Unfortunately we can't verify the commit author(s): Steven Cobb <s***@s***.com>. One possible solution is to add that email to your GitHub account. Alternatively you can change your commits to another email and force push the change. After getting your commits associated with your GitHub account, sign the Salesforce Inc. Contributor License Agreement and this Pull Request will be revalidated. |
a02e10d
to
a06beb8
Compare
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.
LGTM, ty for doing this.
@@ -146,6 +168,9 @@ protected function getCheckMethod(): CodegenMethod { | |||
<<__Override>> | |||
public function getType(): string { | |||
if (Shapes::keyExists($this->typed_schema, 'hackEnum')) { | |||
if ($this->typed_schema['generateHackEnum'] ?? false) { | |||
return $this->typed_schema['hackEnum']; |
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.
Hmm it’s a bummer that we have to fork here. I bet we could update the pre-existing branch to drop the leading \
without causing issues, though it would require regenerating a lot of code.
public function testStringEnum(): void { | ||
$cases = vec[ | ||
shape( | ||
'input' => darray['enum_string' => 'one'], |
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.
Nit: we should use dicts not darrays, darrays are legacy.
When users provide enum, hackEnum, and generateHackEnum: true, we'll generate a class they can use.
Known issues: