Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

[php] enhance type mapping #10457

Merged
merged 6 commits into from
Sep 25, 2021
Merged

[php] enhance type mapping #10457

merged 6 commits into from
Sep 25, 2021

Conversation

wing328
Copy link
Member

@wing328 wing328 commented Sep 23, 2021

  • map decimal to float
  • revise logic in getting the type
  • treat \DateTime, \SplFileObject as primitive types (not models) - except php-mezzio-ph, php-dt

Tested php client locally and the result is good:

................................................................. 65 / 73 ( 89%)
........                                                          73 / 73 (100%)

Time: 00:02.630, Memory: 12.00 MB

OK (73 tests, 220 assertions)

PR checklist

  • Read the contribution guidelines.
  • Pull Request title clearly describes the work in the pull request and Pull Request description provides details about how to validate the work. Missing information here may result in delayed response from the community.
  • Run the following to build the project and update samples:
    ./mvnw clean package 
    ./bin/generate-samples.sh
    ./bin/utils/export_docs_generators.sh
    
    Commit all changed files.
    This is important, as CI jobs will verify all generator outputs of your HEAD commit as it would merge with master.
    These must match the expectations made by your contribution.
    You may regenerate an individual generator by passing the relevant config(s) as an argument to the script, for example ./bin/generate-samples.sh bin/configs/java*.
    For Windows users, please run the script in Git BASH.
  • File the PR against the correct branch: master (5.3.0), 6.0.x
  • If your PR is targeting a particular programming language, @mention the technical committee members, so they are more likely to review the pull request.

cc @jebentier (2017/07), @dkarlovi (2017/07), @mandrean (2017/08), @jfastnacht (2017/09), @ackintosh (2017/09) ❤️, @ybelenko (2018/07), @renepardon (2018/12)

@wing328
Copy link
Member Author

wing328 commented Sep 23, 2021

@Articus this PR results in some changes to php-dt, mezzio samples. Can you please review to see if you're ok with these changes?

@Articus
Copy link
Contributor

Articus commented Sep 23, 2021

Treating \DateTime and \SplFileObject as primitive types breaks code generated by both php-mezzio-ph and php-dt :( In terms of PHP language these types are not scalar and generator templates were written assuming that isPrimitiveType and isDateTime are mutually exclusive flags. So now in generated code serializator is given conflicting instructions how to handle DTO fields with these types.

I can investigate this issue further during weekend to check what else should be adjusted.

@wing328
Copy link
Member Author

wing328 commented Sep 23, 2021

@Articus thanks for the review. I'll try to workaround it.

@wing328
Copy link
Member Author

wing328 commented Sep 23, 2021

@Articus worked around via 6ed7568. Please review the latest again when you've time. Thanks.

@wing328
Copy link
Member Author

wing328 commented Sep 25, 2021

Merged as I've other enhancements for the php client generator.

@wing328 wing328 merged commit c9047a6 into master Sep 25, 2021
@wing328 wing328 deleted the php-decimal branch September 25, 2021 04:09
# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants