Skip to content

Strong validation on putDistribution#27

Merged
zhouzhuojie merged 1 commit into
masterfrom
zz/validate-distributions
Oct 13, 2017
Merged

Strong validation on putDistribution#27
zhouzhuojie merged 1 commit into
masterfrom
zz/validate-distributions

Conversation

@zhouzhuojie
Copy link
Copy Markdown
Collaborator

Strong validation on putDistribution

  • Checks sum of percent
  • Checks integrity of variants

@zhouzhuojie
Copy link
Copy Markdown
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
Copy Markdown
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