Use case
Representing different property imperative configurations across validationModes
Proposal
For a particular subset of validationMode (e.g. C1Request, C2Request) a specific imperativeConfiguration should be applied.
If no matching validationMode is found for the current mode, the default values for the imperativeConfiguration from the model root should be used. This means that validationMode and imperativeConfiguration properties are only required in the model where there is variance in their use between modes, otherwise the default can be used without cluttering the model files.
If a matching validationMode is found for the current mode, then the imperativeConfiguration it references should be used and the values of requiredFields, recommendedFields, shallNotInclude in the model root should be completely ignored
shallNotInclude should be added just within imperativeConfiguration, to represent properties that are not expected to be found in a particular imperativeConfiguration, but are still in the spec.
Example
{
"type":"Lease",
"subClassOf": "https://schema.org/Thing",
"validationMode":{
"C1Request": "request",
"C2Request": "request"
}
"imperativeConfiguration":{
"request":{
"hasId":false,
"requiredFields":[
"type",
"leaseExpires"
],
"recommendedFields":[
],
"shallNotInclude":[
],
"requiredOptions":[
]
}
},
Implementation requirements
Rules
- New rule to recognise
shallNotInclude (called ShallNotIncludeFieldsRule?) and produce error messages as appropriate (note that shallNotInclude does not exist in the default mode, and only exists in imperativeConfiguration)
- Update to the existing
RequiredFieldsRule, RequiredOptionalFieldsRule and RecommendedFieldsRule to respect the input validationMode and resolve/use the relevant imperativeConfiguration instead of the default.
Data model tests
- Data model tests to ensure that all fields featured in the
imperativeConfiguration within requiredFields, recommendedFields, shallNotInclude, and requiredOptions exist in inSpec within the same model
- Data model tests to ensure that all
validationModes specified are valid (valid list is inferred from meta.json see below)
- Data model tests to ensure that all
validationModes reference valid imperativeConfigurations within the same model
Making modes accessible
The data model library should include an accessible enumeration of validationModes which are configured in meta.json.
This should be the source of truth for available validationMode values, and can be used to drive the validator GUI.
"validationModeGroup":[
{
"name": "Opportunity Data Publishing"
"validationModeList": [
{
"validationMode": "RPDEFeed" // note will just be handled as default everywhere as unrecognised
"name": "Open Data Listings RPDE Feed"
},
{
"validationMode": "BookableRPDEFeed"
"name": "Open Data Bookable RPDE Feed"
}
]
},
{
"name": "Open Booking API"
"validationModeList": [
{
"validationMode": "C1Request"
"name": "C1 Request"
},
{
"validationMode": "C1Response"
"name": "C1 Response"
},
{
"validationMode": "C2Request"
"name": "C2 Request"
}
...
]
}
]
Representation in the Validator GUI
The validation group mentioned above can then be represented in the Validator GUI as a button next to the "VALIDATE" button, that uses existing design patterns to allow selection of the validation mode.
The validation mode must also be able to be set in the URL of the validator, such that someone hyperlinking to that a specific sample has the mode preset

Sample grouping
The existing example_list.json needs to be adjusted as below to include grouping capability similar to the above.
[
{
"name": "Opportunity Data Publishing"
"exampleList": [
{
"file": "sessionseries_example_1.json",
"name": "SessionSeries with ScheduledSession Example"
},
{
"file": "scheduledsession_example_1.json",
"name": "ScheduledSession with SessionSeries Example"
},
{
"file": "sessionseries-split_example_1.json",
"name": "SessionSeries Example"
}
]
},
{
"name": "Open Booking API"
"exampleList": [
{
"file": "c1_request_example_1.json",
"name": "C1 Request Example",
"validationMode": "C1Request"
},
{
"file": "c1_response_example_1.json",
"name": "C1 Response Example (simple)",
"validationMode": "C1Response"
},
{
"file": "c1_response_example_2.json",
"name": "C1 Response Example (with Attendee Details)"
"validationMode": "C1Response"
}
]
}
Samples within the Validator GUI
The GUI of the validator then needs to render these groups for the examples.
As the example list is quite long, consider how the list will scale as the number of examples increases.

Use case
Representing different property imperative configurations across validationModes
Proposal
For a particular subset of
validationMode(e.g.C1Request,C2Request) a specificimperativeConfigurationshould be applied.If no matching
validationModeis found for the current mode, the default values for theimperativeConfigurationfrom the model root should be used. This means thatvalidationModeandimperativeConfigurationproperties are only required in the model where there is variance in their use between modes, otherwise the default can be used without cluttering the model files.If a matching
validationModeis found for the current mode, then theimperativeConfigurationit references should be used and the values ofrequiredFields,recommendedFields,shallNotIncludein the model root should be completely ignoredshallNotIncludeshould be added just withinimperativeConfiguration, to represent properties that are not expected to be found in a particularimperativeConfiguration, but are still in the spec.Example
Implementation requirements
Rules
shallNotInclude(calledShallNotIncludeFieldsRule?) and produce error messages as appropriate (note thatshallNotIncludedoes not exist in the default mode, and only exists inimperativeConfiguration)RequiredFieldsRule,RequiredOptionalFieldsRuleandRecommendedFieldsRuleto respect the inputvalidationModeand resolve/use the relevantimperativeConfigurationinstead of the default.Data model tests
imperativeConfigurationwithinrequiredFields,recommendedFields,shallNotInclude, andrequiredOptionsexist ininSpecwithin the same modelvalidationModes specified are valid (valid list is inferred from meta.json see below)validationModes reference validimperativeConfigurations within the same modelMaking modes accessible
The data model library should include an accessible enumeration of
validationModes which are configured in meta.json.This should be the source of truth for available
validationModevalues, and can be used to drive the validator GUI.Representation in the Validator GUI
The validation group mentioned above can then be represented in the Validator GUI as a button next to the "VALIDATE" button, that uses existing design patterns to allow selection of the validation mode.
The validation mode must also be able to be set in the URL of the validator, such that someone hyperlinking to that a specific sample has the mode preset
Sample grouping
The existing
example_list.jsonneeds to be adjusted as below to include grouping capability similar to the above.Samples within the Validator GUI
The GUI of the validator then needs to render these groups for the examples.
As the example list is quite long, consider how the list will scale as the number of examples increases.