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 string values passed for enum arguments #10

Merged
merged 4 commits into from
Aug 3, 2023
Merged

Conversation

kooyunmo
Copy link
Collaborator

PR Description

Summary

This PR validates the string values passed for enum arguments of some SDK functions.

Motivation and Context

Several SDK functions get enum arguments but those enums are not exposed to users directly. For example, in the case of Deployment.create, CloudType enum value should be passed to the cloud argument like cloud=CloudType.AWS, which means users have to import the CloudType with from PeriFlow.enums import Cloud.

Instead of importing the enum types, this PR makes the SDK allow passing the proper string values and validating the value. (Of course, enum values are also allowed.)

Type of Change

  • Breaking change
  • Documentation update

@kooyunmo kooyunmo requested a review from pigbug419 July 26, 2023 21:38
Copy link
Collaborator

@pigbug419 pigbug419 left a comment

Choose a reason for hiding this comment

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

LGTM with a question!

@@ -254,7 +261,7 @@ def create(
"infrequest_log": logging,
**config,
}
if description:
if description is not None:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is there any reason to change?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This change considers the case when the value of description is "" (empty string).

@kooyunmo kooyunmo merged commit 2c28885 into main Aug 3, 2023
3 checks passed
@kooyunmo kooyunmo deleted the allow-str-enums branch August 3, 2023 03:03
kooyunmo pushed a commit that referenced this pull request Sep 5, 2023
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