You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There are some conventions that are not necessary to build a well-formed schema, but yet are commonplace in OCSF and have considerable utility.
We should support linting (convention validation) of those things.
The two I am aware of are:
naming conventions for sibling fields where the original field ends in _id or _uid
the presence of a 0 enumerand to denote Unknown and a 99 enumerand to denote Other
I have sketched out some ideas over in my fork for what this might look like. I took a TDD (Test Driven Development) approach by first implementing the linting rules and then adding lint control options to address the failures.
The basic proposal is to add a lint property (currently only on attributes) that can be a list of strings that configure different lint controls, initially just:
no-enum-convention to denote an attribute that does not follow the 0/99 enumeration convention, and
no-sibling-convention to denote an attribute that does not follow the _id/_uid sibling attribute naming convention.
I added lint control options where I could see they made sense, but one occurrence remained for the former that might be an actual bug. To discuss. It is this one:
Here is what I imagine a lint property might look like, as applied to the historical activity_id which by convention should have a sibling of activity but doesn't:
"activity_id": {
"caption": "Activity ID",
"description": "The normalized identifier of the activity that triggered the event.",
"enum": {
"99": {
"caption": "Other",
"description": "The event activity is not mapped. See the <code>activity_name</code> attribute, which contains a data source specific value."
},
"0": {
"caption": "Unknown",
"description": "The event activity is unknown."
}
},
"sibling": "activity_name",
"lint": ["no-sibling-convention"],
"type": "integer_t"
},
There are some conventions that are not necessary to build a well-formed schema, but yet are commonplace in OCSF and have considerable utility.
We should support linting (convention validation) of those things.
The two I am aware of are:
_id
or_uid
0
enumerand to denoteUnknown
and a99
enumerand to denoteOther
I have sketched out some ideas over in my fork for what this might look like. I took a TDD (Test Driven Development) approach by first implementing the linting rules and then adding lint control options to address the failures.
The basic proposal is to add a
lint
property (currently only on attributes) that can be a list of strings that configure different lint controls, initially just:no-enum-convention
to denote an attribute that does not follow the 0/99 enumeration convention, andno-sibling-convention
to denote an attribute that does not follow the_id
/_uid
sibling attribute naming convention.I added lint control options where I could see they made sense, but one occurrence remained for the former that might be an actual bug. To discuss. It is this one:
Here is what I imagine a
lint
property might look like, as applied to the historicalactivity_id
which by convention should have a sibling ofactivity
but doesn't:corresponding linter support in my validator: https://bitbucket.org/dkolbly/osf-meta/pull-requests/7
The text was updated successfully, but these errors were encountered: