Skip to main content

wrap_unstructured_inline_for_schema

Function wrap_unstructured_inline_for_schema 

Source
pub fn wrap_unstructured_inline_for_schema(
    graph: &SchemaGraph,
    ty: &SchemaType,
    raw: SchemaValue,
) -> Result<SchemaValue, UnstructuredError>
Expand description

Wrap a raw text / binary value as the canonical unstructured inline case (case 0) when ty (resolved against graph) is an unstructured variant { inline, url } wrapper; otherwise return the raw value unchanged (for a bare Text / Binary rich scalar).

This is the inverse of decode_unstructured_value’s inline case: callers that turn a raw transport payload into a schema value (e.g. an HTTP request body) use it so the produced value matches the field’s schema regardless of whether that schema is the wrapper or the bare rich scalar.