Skip to content

nimgent/structured_output/jsonschema_validate

This page is generated from the module’s exported API and ## documentation comments.

JSON Schema shape validation, value validation, local references, and wire preparation for strict structured-output providers.

Validate the supported draft-07 subset before making a provider request.

proc validateJsonSchema(schema: JsonNode; path = "$"): seq[string] {.
raises: [Exception, KeyError], tags: [RootEffect], forbids: [].}

Returns: seq[string].

Name Type Default
schema JsonNode
path inferred "$"

View source

Restrictions imposed by OpenAI’s strict structured-output dialect.

proc validateOpenAiStrictSchema(schema: JsonNode): seq[string] {.
raises: [KeyError], tags: [], forbids: [].}

Returns: seq[string].

Name Type Default
schema JsonNode

View source

Compare JSON values, treating equivalent integer and float values alike.

proc jsonEqual(a, b: JsonNode): bool {.raises: [KeyError], tags: [], forbids: [].}

Returns: bool.

Name Type Default
a JsonNode
b JsonNode

View source

Return validation issues for a JSON value and schema.

proc validateSchema(value, schema: JsonNode; path = "$"): seq[string] {.
raises: [KeyError, Exception], tags: [RootEffect], forbids: [].}

Returns: seq[string].

Name Type Default
value JsonNode
schema JsonNode
path inferred "$"

View source

Copy. Objects without additionalProperties get false (OpenAI/Anthropic strict).

proc prepareWireSchema(schema: JsonNode): JsonNode {.raises: [KeyError],
tags: [], forbids: [].}

Returns: JsonNode.

Name Type Default
schema JsonNode

View source