Skip to main content

to_json_schema

Function to_json_schema 

Source
pub fn to_json_schema(
    model: &DataModel,
    root: &str,
    openai: bool,
) -> Result<SchemaObject, String>
Expand description

Converts a DataModel into a JSON schema representation.

§Arguments

  • model - A reference to the DataModel to be converted.
  • root - The root object name in the model.
  • openai - A boolean flag indicating whether to use the OpenAI schema.

§Returns

A Result containing the SchemaObject or an error message.