-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
imperativeStatus and validationModes #41
Comments
these aren't yet added to the model specifications but based on the plan in #41
@nickevansuk I have made a start on some of the rules and model specs for this as you can see in the two PRs linked above. Third one to follow soon (work done just need to push it when I can access it again). This probably marks about the end of the initial timebox for working on the model validator library's rules (I might be able to squeeze in moving the source of truth for available validation modes from the validator library to the data-models repo). |
@nickevansuk I am getting through the work for this issue and so thinking a bit how these changes will be deployed. Adding validationModeGroup to the metadata in However, the changes to the examples/samples is more complex as rather than a pure addition it is a change to Basically do you agree with me updating the npm package's version to 2.0.0 in #46 ? |
yep updating the models to 2.0 is fine, we're doing fairly major tooling work across the board so makes sense to me |
If I understand this correctly does this mean we will also have to bump major in |
@thtg88 Other than the change to the Barcode.json file name none of the changes I'm making effect the models-lib (yet) and even the file rename doesn't seem to be an issue for the code generator either so you shouldn't HAVE to but it may probably be wise to update the version in models-lib once it's released to avoid failing behind. |
I have noticed that the Rules in data-model-validator lib are quite highly coupled to a version of the spec in data-models lib due to the way rules are target fields, models and validation modes. This is unavoidable - for new versions of the spec there will need to be some new rules and some old rules will no longer apply. However, the way it is currently implemented means the rules are at risk of accidentally being ignored due to types in the strings used by targetFields, targetModels and targetValidationModes. At some point I guess it will be necessary to have per-version collections of the rules to apply during validation and therefore more explicitly include version when constructing a new include of a Rule class (maybe this is already possible since constructor takes an OptionsHelper object) and add some validation of the values of targetModels, targetFields and targetValidationModes against the models, fields and validation modes that exist in the data models spec for that version. |
Yes great point about having the rules target specific versions - if this isn't there already, presumably the way to do this would be by adding We had a design discussion originally about versions of the model and decided that we didn't want a set of model files for each minor version, as that would be a nightmare to maintain! Instead we opted for I'm not sure what version ends up being used by the time you get to the rule itself (i.e. So if
If
Could we add " |
With the merging of the changes to the validator site above (openactive/data-model-validator-site#56), I believe that completes the work for this issue (bar possibly our comments about validating validationModes, targetModels and targetFields - this has been added to bottom of spreadsheet and perhaps belongs in it's own issue). Work is merged into master but I will leave to you to confirm all is good and to deploy the updates to the production site (not least because I don't know how it's hosted!). |
@henryaddison still getting an error at https://validator-staging.openactive.io/ ? Assume it works on your machine? |
In fact @henryaddison here's the logs from Heroku:
|
Ah I'd foolishly assumed the issues with the staging site were unrelated. I will take a look. |
On plus side can re-create on my machine with |
Use case
Representing different property imperative configurations across validationModes
Proposal
For a particular subset of
validationMode
(e.g.C1Request
,C2Request
) a specificimperativeConfiguration
should be applied.If no matching
validationMode
is found for the current mode, the default values for theimperativeConfiguration
from the model root should be used. This means thatvalidationMode
andimperativeConfiguration
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 theimperativeConfiguration
it references should be used and the values ofrequiredFields
,recommendedFields
,shallNotInclude
in the model root should be completely ignoredshallNotInclude
should 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 thatshallNotInclude
does not exist in the default mode, and only exists inimperativeConfiguration
)RequiredFieldsRule
,RequiredOptionalFieldsRule
andRecommendedFieldsRule
to respect the inputvalidationMode
and resolve/use the relevantimperativeConfiguration
instead of the default.Data model tests
imperativeConfiguration
withinrequiredFields
,recommendedFields
,shallNotInclude
, andrequiredOptions
exist ininSpec
within the same modelvalidationMode
s specified are valid (valid list is inferred from meta.json see below)validationMode
s reference validimperativeConfiguration
s within the same modelMaking modes accessible
The data model library should include an accessible enumeration of
validationMode
s 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.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.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.
The text was updated successfully, but these errors were encountered: