Skip to content
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

feat(php): use strings for request enums + other small fixes #4741

Merged
merged 11 commits into from
Sep 25, 2024
Merged

Conversation

dcb6
Copy link
Contributor

@dcb6 dcb6 commented Sep 24, 2024

changelog:

    - type: feat
      summary: >-
        Represent enums in objects as strings.
    - type: fix
      summary: >-
        Generated wrapped requests now implement `SerializableType`.
        Represent enums in objects as strings.
    - type: fix
      summary: >-
        Fix a bug where we don't set the request options baseurl properly.
    - type: fix
      summary: >-
        Fix bugs in our numeric type serde and add tests.

also:

  • some initial support for unions, which is leftover from a previous enum handling implementation

@dcb6 dcb6 marked this pull request as ready for review September 25, 2024 00:33
@dcb6 dcb6 requested a review from dsinghvi as a code owner September 25, 2024 00:33
Copy link
Contributor

@amckinney amckinney left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, only a few nits + suggestions!

generators/php/sdk/versions.yml Outdated Show resolved Hide resolved
generators/php/codegen/src/context/PhpAttributeMapper.ts Outdated Show resolved Hide resolved
Comment on lines +61 to +64
new ClassReference({
name: "JsonSerializable",
namespace: ""
})
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: We should make this a function on the abstract context, so we can just read:

writer.addReference(this.context.getJsonSerializableClassReference())

Check out getJsonExceptionClassReference for an example.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we don't have context in Ast classes though right?

seed/php-sdk/alias-extends/src/SeedClient.php Show resolved Hide resolved
Comment on lines +20 to +24
/*
* By default, we represent enums as strings, with a phpstan phpdoc referencing the generated enum. If this flag is
* is true, then we reference the enum type directly.
*/
preserveEnums?: boolean;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this still used? I don't see anywhere that sets it to true.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nope not anymore! ok if we leave it around in case, or you want it gone?

@dcb6 dcb6 enabled auto-merge (squash) September 25, 2024 01:05
@dcb6 dcb6 merged commit 47d5c9d into main Sep 25, 2024
47 checks passed
@dcb6 dcb6 deleted the db/square-fixes branch September 25, 2024 01:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants