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

Strong validation on putDistribution #27

Merged
merged 1 commit into from
Oct 13, 2017

Conversation

zhouzhuojie
Copy link
Collaborator

Strong validation on putDistribution

  • Checks sum of percent
  • Checks integrity of variants

@zhouzhuojie
Copy link
Collaborator Author

curl --request PUT \
  --url http://localhost:18000/api/flags/2/segments/2/distributions \
  --header 'content-type: application/json' \
  --data '{\n	"distributions": [\n		{\n			"percent": 50,\n			"variantID": 3,\n			"variantKey": "control"\n		},\n		{\n			"percent": 50,\n			"variantID": 4,\n			"variantKey": "treatment"\n		}\n	]\n}'

{
	"message": "status_code: 400. error finding variantID 5 under this flag. expecting [3 4]"
}

{
	"message": "status_code: 400. error matching variantID 4 with variantKey treatment1. expecting treatment."
}

Copy link
Contributor

@lucidrains lucidrains left a comment

Choose a reason for hiding this comment

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

🏴

@zhouzhuojie zhouzhuojie merged commit 480ce1f into master Oct 13, 2017
@zhouzhuojie zhouzhuojie deleted the zz/validate-distributions branch October 13, 2017 18:57
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