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

Validate value object required fields in the constructor #1488

Merged
merged 4 commits into from
Jul 1, 2023

Conversation

stof
Copy link
Member

@stof stof commented Jul 1, 2023

Relates to #1481

'PROPERTY' => GeneratorHelper::normalizeName($member->getName()),
'NAME' => $member->getName(),
'CLASS' => $objectClass->getName(),
'FALLBACK' => $fallback,
Copy link
Member

Choose a reason for hiding this comment

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

only when the class is used in Input? 🤔

Do we need to assert the content returned by the provider. Or we can blindly trust the data, and remove all this boilerplate like we do in output generated code.

Copy link
Member Author

Choose a reason for hiding this comment

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

For now, I will keep the isset check for all value objects instead of changing depending on whether it is used in input. It makes the code simpler and your suggestion would not always avoid checking that for responses anyway given that some value objects are used both in input and responses.

stof added 4 commits July 1, 2023 18:58
Optional array fields still need to consider the property as nullable
even though the getter will return an empty array as AWS does not treat
absent lists the same than empty lists in input.
This is already validated in the constructor now.
@stof stof force-pushed the better_object_error_handling branch from f788b69 to bc0a48e Compare July 1, 2023 17:27
@stof stof requested a review from jderusse July 1, 2023 17:39
@stof stof merged commit 868ebbe into async-aws:master Jul 1, 2023
@stof stof deleted the better_object_error_handling branch July 1, 2023 20:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants