Skip to content

Instantly share code, notes, and snippets.

@pmhsfelix
Created October 16, 2020 09:40
Show Gist options
  • Save pmhsfelix/5bab730bd470b637d9b5d5dd27329336 to your computer and use it in GitHub Desktop.
Save pmhsfelix/5bab730bd470b637d9b5d5dd27329336 to your computer and use it in GitHub Desktop.
// l10n example based on the https://tools.ietf.org/html/rfc7807 example
{
"type": "https://example.net/validation-error",
"title": "Your request parameters didn't validate.",
"titleKey": "invalid.parameters.key"
"invalid-params": [ {
"name": "age",
"reason": "must be a positive integer",
"reasonKey": "must.be.positive.integer"
},
{
"name": "color",
"reason": "must be 'green', 'red' or 'blue'",
"reasonKey": "must.be.primary.color"
}
]
}
- In this example "titleKey" is indeed redundant, since "type" could also be used to act as an unique and stable identififier.
- However we also need identifiers (i.e. keys) to the "invalid-params" reasons.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment