openai-schemars

Crates.ioopenai-schemars
lib.rsopenai-schemars
version0.1.0
created_at2025-08-12 07:39:45.890619+00
updated_at2025-08-12 07:39:45.890619+00
descriptionA Rust utility to generate JSON Schemas compatible with OpenAI's function calling API
homepage
repositoryhttps://github.com/sensorial-systems/openai-schemars
max_upload_size
id1791551
size10,962
Danilo Guanabara (notdanilo)

documentation

https://docs.rs/openai-schemars

README

openai-schemars

A Rust utility to generate JSON Schemas compatible with OpenAI's function calling API, using schemars and serde_json.

Features

  • Converts any schemars::JsonSchema type to a JSON Schema.
  • Enforces OpenAI-compatible subset:
    • Removes unsupported fields (e.g., format, pattern, etc.).
    • Replaces oneOf/allOf with anyOf.
    • Sets additionalProperties to false for all objects.
    • Ensures all properties are listed as required.

Example

Commit count: 0

cargo fmt