Skip to main content

Module neutral_to_json_schema

Module neutral_to_json_schema 

Source
Expand description

Map scythe’s neutral type strings to OpenAPI 3.1 JSON Schema fragments.

Scythe’s type system is documented at scythe-core/src/analyzer/type_conversion.rs. The canonical neutral types are: int16, int32, int64, float32, float64, string, bool, bytes, uuid, date, datetime, datetime_tz, time, time_tz, interval, json, inet, decimal, plus the composite forms array<T>, range<T>, enum::<name>, composite::<name>, and json_typed<TypeName> (produced by scythe’s @json mapping).

Nullability is layered by json_schema_for which wraps the schema with {"oneOf": [<schema>, {"type": "null"}]} when nullable is true. This is the OpenAPI 3.1 idiom (3.0’s "nullable": true flag is not used).

Structs§

BuildOptions
Build-time knobs for the neutral-type → JSON Schema mapping.

Enums§

DecimalMode
NeutralTypeError

Functions§

json_schema_for
Wrap neutral_to_json_schema’s output for nullability when the column or parameter is nullable.
neutral_to_json_schema
Translate a single neutral type string to a JSON Schema fragment. Does not apply nullability — see json_schema_for for the wrapper that does.