-
Notifications
You must be signed in to change notification settings - Fork 136
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
Linting controls #1063
Linting controls #1063
Conversation
This commit introduces a notion of "lint" setting, which is to be used to configure linting behavior for tools that can automatically validate that conventions are being followed. Also marks several historical attributes as behaving unconventionally, specifically: - activity_id's sibling is called activity_name instead of activity - the enums for opcode_id and disk_level_id enum are based on external standards and hence do not follow the 0/99 convention Signed-off-by: Donovan Kolbly <[email protected]>
Signed-off-by: Donovan Kolbly <[email protected]>
I will note that the validator in |
The OcsfAttr = TypedDict(
"OcsfAttr",
{
"$include": NotRequired[str],
# "caption": NotRequired[str],
"caption": str,
"default": NotRequired[Any],
"description": NotRequired[str],
"enum": NotRequired[Dict[str, OcsfEnumMember]],
"group": NotRequired[str],
"is_array": NotRequired[bool],
"lint": NotRequired[Sequence[str]],
"max_len": NotRequired[int],
"name": NotRequired[str],
"notes": NotRequired[str],
"observable": NotRequired[int],
"range": NotRequired[Sequence[int]],
"regex": NotRequired[str],
"requirement": NotRequired[str],
"sibling": NotRequired[str],
"type": NotRequired[str],
"type_name": NotRequired[str],
"profile": NotRequired[Optional[Sequence[str]]],
"values": NotRequired[Sequence[Any]],
"@deprecated": NotRequired[OcsfDeprecationInfo],
},
) (I say "I believe..." because I haven't tried this change against the modified schema myself.) |
I will try it out! |
Do we have rules for naming conventions for fields like this? Thinking about:
Should |
@alanisaac great question... I don't have an opinion on that, really. There are lots of other properties that directed at the compiler (i.e., that do not appear in the produced concrete schema, e.g., JSONSchema) like |
I see a couple things:
(I'm quite interested because I'm adding a new event validation API, and I'll want to add support for these suppressions to that API.) |
@rmouritzen-splunk I'm not sure exactly where to write this down, but the intention is that both of these checks represent the conventions described here: https://github.com/ocsf/ocsf-docs/blob/main/Understanding%20OCSF.md#attributes Specfically,
and for
|
Is it possible to add this in the metaschema's JSON Schema itself? |
Signed-off-by: Donovan Kolbly <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for getting this in!
Related Issue:
#1061 Support linting of enum and sibling conventions
Description of changes:
suppress_checks
option to the metaschema to configure turning off certain linting rulesdata_lifecycle_state_id
to follow the enum convention by adding a 99 (Other) enumerand and articulating that it should be used for "other"