ocsf-server
ocsf-server copied to clipboard
JSON schema improvements - Add constraints, enum values
The current json-schema, e.g. https://schema.ocsf.io/schema/1.3.0/objects/network_endpoint doesn't include the data-type constraints defined in the dictionary - https://github.com/ocsf/ocsf-schema/blob/main/dictionary.json#L4839.
These constraints are in the form of regex, max_length, range and values. All these can be represented in the json-schema that is rendered by our server, helping json-schema based validation use-cases and perform value specific validation. JSON spec has a few built-in string formats that can be leveraged as well.
Further, we can also add constant values for attributes such as class_name, category_name etc, as we render the json-schema of an event class.
References -
- https://json-schema.org/understanding-json-schema/reference/const
- https://json-schema.org/understanding-json-schema/reference/regular_expressions
- https://json-schema.org/understanding-json-schema/reference/string
- https://json-schema.org/understanding-json-schema/reference/numeric#range
We should also include "additionalProperties": false, key in the generated schema to make validation use-cases more feasible. (for each object definition and the event class definition) https://github.com/ocsf/ocsf-server/pull/112
The string sibling values should also be added as an enum for the corresponding properties
Add requirements based on OCSF "constraints"
@floydtree was this resolved by https://github.com/ocsf/ocsf-server/pull/112? Could it be closed out or does it need additional effort?
@mikeradka nope, it was partially fixed. There are a few more to go.