AshOaskit.Schemas.Nullable (AshOasKit v0.4.1)

View Source

Adds null to a schema without discarding its constraints.

OpenAPI 3.1 uses type arrays for simple schemas; 3.0 uses an explicit type with nullable: true. References and compositions use anyOf, since oneOf rejects null when the original schema already accepts it. Atom keys are the default; TypeMapper requests string keys.

Summary

Functions

Makes a schema nullable, preserving enum values and composition constraints.

Makes a complex schema nullable. The historical name is retained for compatibility.

Functions

make_nullable(schema, version, keys \\ :atom)

@spec make_nullable(map(), String.t(), :atom | :string) :: map()

Makes a schema nullable, preserving enum values and composition constraints.

make_nullable_oneof(schema, version)

@spec make_nullable_oneof(map(), String.t()) :: map()

Makes a complex schema nullable. The historical name is retained for compatibility.