Skip to content

Commit

Permalink
Merge pull request #3156 from alphagov/content-modelling/932-improve-…
Browse files Browse the repository at this point in the history
…validation-for-rate-amounts

(932) Improve validation for rate amounts
  • Loading branch information
pezholio authored Feb 21, 2025
2 parents a2d06c9 + 52a6fe8 commit 73dcb21
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,7 @@
"properties": {
"amount": {
"type": "string",
"pattern": "£[0-9]+\\.[0-9]+"
"pattern": "^£{1}[1-9]{1,3}(,\\d{3})*(\\.\\d{2})?"
},
"cadence": {
"type": "string",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@
"properties": {
"amount": {
"type": "string",
"pattern": "£[0-9]+\\.[0-9]+"
"pattern": "^£{1}[1-9]{1,3}(,\\d{3})*(\\.\\d{2})?"
},
"cadence": {
"type": "string",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,18 @@
"amount": "£221.20",
"cadence": "a week",
"description": "Your weekly pension amount"
},
"rate-2": {
"name": "Rate without decimal point",
"amount": "£221",
"cadence": "a week",
"description": "Your weekly pension amount"
},
"rate-3": {
"name": "Rate with big value",
"amount": "£1,223",
"cadence": "a week",
"description": "Your weekly pension amount"
}
}
},
Expand Down
2 changes: 1 addition & 1 deletion content_schemas/formats/content_block_pension.jsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ local utils = import "shared/utils/content_block_utils.jsonnet";
{
amount: {
type: "string",
pattern: "£[0-9]+\\.[0-9]+",
pattern: "^£{1}[1-9]{1,3}(,\\d{3})*(\\.\\d{2})?",
},
cadence: {
type: "string",
Expand Down

0 comments on commit 73dcb21

Please sign in to comment.