LangSchema.Keyword behaviour (LangSchema v0.2.0)

View Source

Defines the behaviour for modules that handle JSON Schema keywords.

If no specific keyword module exists, default behavior is provided by LangSchema.Keyword.Default.

Summary

Callbacks

Converts and attaches a specific keyword to the JSON schema.

Callbacks

convert(json_schema, keyword, value)

@callback convert(json_schema :: map(), keyword :: atom(), value :: any()) ::
  json_schema :: map()

Converts and attaches a specific keyword to the JSON schema.

This function defines how a single keyword-value pair should be applied to the given JSON schema map.

The keyword argument is provided in snake_case format (e.g., min_length), and the implementer is responsible for converting it to the appropriate camelCase JSON Schema field (e.g., minLength) if necessary.

This allows fine-grained control over the transformation of each keyword during schema generation.