Skip to main content

Pydantic models for the Open Cybersecurity Schema Framework (OCSF)

Project description

pydantic-ocsf

Pydantic models for the Open Cybersecurity Schema Framework (OCSF).

Installation

pip install pydantic-ocsf

Version Scheme

This package uses a version format of {ocsf_version}.{generation_date}:

  • OCSF Version: The latest OCSF schema version included (e.g., 1.7.0)
  • Generation Date: When the models were generated (format: YYYYMMDD)

Example: 1.7.0.20260129 means OCSF schema v1.7.0 generated on January 29, 2026

This versioning scheme ensures you can track both the OCSF schema version and when the Pydantic models were last regenerated.

Quick Start

from ocsf import File, StatusId
import time

# Create a file object (using latest v1.7.0 by default)
file = File(
    name="document.pdf",
    type_id=1,
    size=1024000,
)

# Serialize to JSON
json_str = file.model_dump_json(indent=2)
print(json_str)

# Parse from JSON
parsed = File.model_validate_json(json_str)

Supported OCSF Versions

  • ocsf.v1_7_0 - OCSF 1.7.0 (also available as from ocsf import ...)
  • ocsf.v1_6_0 - OCSF 1.6.0
  • ocsf.v1_5_0 - OCSF 1.5.0
  • ocsf.v1_2_0 - OCSF 1.2.0
  • ocsf.v1_1_0 - OCSF 1.1.0
  • ocsf.v1_0_0 - OCSF 1.0.0

License

Apache 2.0

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pydantic_ocsf-1.7.0.20260129.post1.tar.gz (612.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pydantic_ocsf-1.7.0.20260129.post1-py3-none-any.whl (1.7 MB view details)

Uploaded Python 3

File details

Details for the file pydantic_ocsf-1.7.0.20260129.post1.tar.gz.

File metadata

File hashes

Hashes for pydantic_ocsf-1.7.0.20260129.post1.tar.gz
Algorithm Hash digest
SHA256 1b61308743e889306de167ab7782839e6f0f3d5c967e96d2c93b8a59341b5b8e
MD5 900cb88c5ad65c0579b885a79d4f9aff
BLAKE2b-256 abf73f4f47f5d7072d3bd4141278558570369bfbe95ac1aad7fb4db1fa159eef

See more details on using hashes here.

File details

Details for the file pydantic_ocsf-1.7.0.20260129.post1-py3-none-any.whl.

File metadata

File hashes

Hashes for pydantic_ocsf-1.7.0.20260129.post1-py3-none-any.whl
Algorithm Hash digest
SHA256 d468b7ba2c31305aa9ffbcba4732cc15c1ec02073842118b2450b891622c8bc6
MD5 036d090b1507f1d2e316b192ce86db7e
BLAKE2b-256 d2f9e6d74a0463437b0946bdc7151fecc53bb69d9d9b98a008e9bc5397f91f8e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page