Currently the ocsf-validator is treating the attributes tag of categories the same as any other attributes, which involves merging them with the dictionary. This is incorrect behavior, as attributes of categories do not have any of the characteristics imbued by the dictionary.
This is currently causing a problem in https://github.com/ocsf/ocsf-schema/pull/1066, which adds a remediation category, because remediation is an event attribute elsewhere, with an entry in the dictionary.
This PR changes the validator's logic, such that categories are skipped when the validator merges in dependencies (a.k.a. extends, profiles, includes, or advanced attributes) as categories should have none of these.
Tested against the branch from the PR above, and it fixes the original problem:
SUMMARY
PASSED: Schema definitions can be loaded
PASSED: Schema types can be inferred
PASSED: Check observable type_id definitions
PASSED: Dependency targets are resolvable and exist
PASSED: Required keys are present
PASSED: There are no unrecognized keys
PASSED: All attributes in the dictionary are used
PASSED: All attributes are defined in dictionary.json
PASSED: Names are not used multiple times within a record type
PASSED: Attribute type references are defined
PASSED: Event class categories are defined
PASSED: JSON files match their metaschema definition
Currently the
ocsf-validator
is treating theattributes
tag ofcategories
the same as any other attributes, which involves merging them with thedictionary
. This is incorrect behavior, as attributes ofcategories
do not have any of the characteristics imbued by the dictionary.This is currently causing a problem in https://github.com/ocsf/ocsf-schema/pull/1066, which adds a
remediation
category, becauseremediation
is an event attribute elsewhere, with an entry in thedictionary
.This PR changes the validator's logic, such that
categories
are skipped when the validator merges in dependencies (a.k.a.extends
,profiles
,includes
, or advancedattributes
) ascategories
should have none of these.Tested against the branch from the PR above, and it fixes the original problem: