Skip to content
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

JSON schema improvements - Add constraints, enum values #109

Open
floydtree opened this issue Sep 10, 2024 · 0 comments
Open

JSON schema improvements - Add constraints, enum values #109

floydtree opened this issue Sep 10, 2024 · 0 comments

Comments

@floydtree
Copy link
Contributor

floydtree commented Sep 10, 2024

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"

@floydtree floydtree changed the title Include data-type constraints in the JSON schema JSON schema improvements - Add constraints, enum values Sep 12, 2024
@floydtree floydtree mentioned this issue Oct 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant