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.
Procedures
Section titled “Procedures”validateJsonSchema
Section titled “validateJsonSchema”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].
Arguments
Section titled “Arguments”| Name | Type | Default |
|---|---|---|
schema |
JsonNode |
|
path |
inferred |
"$" |
validateOpenAiStrictSchema
Section titled “validateOpenAiStrictSchema”Restrictions imposed by OpenAI’s strict structured-output dialect.
proc validateOpenAiStrictSchema(schema: JsonNode): seq[string] {. raises: [KeyError], tags: [], forbids: [].}Returns: seq[string].
Arguments
Section titled “Arguments”| Name | Type | Default |
|---|---|---|
schema |
JsonNode |
jsonEqual
Section titled “jsonEqual”Compare JSON values, treating equivalent integer and float values alike.
proc jsonEqual(a, b: JsonNode): bool {.raises: [KeyError], tags: [], forbids: [].}Returns: bool.
Arguments
Section titled “Arguments”| Name | Type | Default |
|---|---|---|
a |
JsonNode |
|
b |
JsonNode |
validateSchema
Section titled “validateSchema”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].
Arguments
Section titled “Arguments”| Name | Type | Default |
|---|---|---|
value |
JsonNode |
|
schema |
JsonNode |
|
path |
inferred |
"$" |
prepareWireSchema
Section titled “prepareWireSchema”Copy. Objects without additionalProperties get false (OpenAI/Anthropic strict).
proc prepareWireSchema(schema: JsonNode): JsonNode {.raises: [KeyError], tags: [], forbids: [].}Returns: JsonNode.
Arguments
Section titled “Arguments”| Name | Type | Default |
|---|---|---|
schema |
JsonNode |