CodeSet
JSON Schema provides the “enum” keyword to require a value from an array, which can be used to implement CodeSet validation.
"Authorisation1Code": {
"description": "Specifies the level of approval ...",
"enum":["AUTH","FDET","FSUM","ILEV"]
}
This can be enhanced to include documentation on what each value means,
using the oneOf/enum pattern:
"Authorisation1Code": {
"description": "Specifies the level of approval ...",
"enum":["AUTH","FDET","FSUM","ILEV"],
"oneOf":[
{"enum":["AUTH"],
"title":"PreAuthorisedFile",
"description":"Indicates a file has been pre authorised ..."},
...
]
}
It’s also possible to include the titles as additional permitted values.
Beware that there are a few titles longer than 80 characters, hundreds longer than 40, and many with dashes, but none with sapces, in their name.
"Authorisation1Code": {
"description": "Specifies the level of approval ...",
"enum":["AUTH","PreAuthorisedFile","FDET", ... ],
"oneOf":[
{"enum":["AUTH","PreAuthorisedFile"],
"title":"PreAuthorisedFile",
"description":"Indicates a file has been pre authorised ..."},
...
]
}