Skip to content

JSON schema improvements - Add constraints, enum values #109

@floydtree

Description

@floydtree

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 -

  1. https://json-schema.org/understanding-json-schema/reference/const
  2. https://json-schema.org/understanding-json-schema/reference/regular_expressions
  3. https://json-schema.org/understanding-json-schema/reference/string
  4. 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) #112


The string sibling values should also be added as an enum for the corresponding properties


Add requirements based on OCSF "constraints"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions