Schema Module
Helpers for building explicit schemas and reusing common built-in shapes. This is the main authoring surface for `CodecMapper`. Build a `Schema<'T>` once, then compile it into JSON or XML codecs.
Functions and values
| Function or value |
Description
|
|
|
A schema for `bool`.
|
|
|
|
A schema for `byte`.
|
|
A schema for `char` backed by a single-character string.
|
|
Full Usage:
collection inner
Parameters:
Schema<'T>
Returns: Schema<ICollection<'T>>
Modifiers: inline Type parameters: 'T |
Builds a schema for `ICollection<'T>`. This preserves the normal array wire shape while interoperating with common mutable collection interfaces from .NET APIs.
|
|
|
Full Usage:
create def
Parameters:
SchemaDefinition
Returns: Schema<'T>
Modifiers: inline Type parameters: 'T |
Creates a schema from a raw structural definition. This is public for advanced integrations, but most callers should prefer the higher-level helpers in this module.
|
|
A schema for `DateTimeOffset` using the round-trippable `"O"` string format.
|
A schema for `decimal`.
|
|
Pipeline DSL helpers. The pipeline starts by capturing the curried constructor up front so subsequent field steps only describe the wire layout. We still ask for `'T` explicitly because relying on field-label inference alone becomes brittle as soon as multiple record types share names like `Id` or `Name`. Starts a pipeline schema definition for `'T`.
|
|
|
|
|
|
|
|
|
|
A schema for `float`.
|
|
Full Usage:
formatFloat value
Parameters:
float
Returns: string
|
Keep the .NET path using round-trip float formatting, but let Fable use the host number string form instead of rejecting the `"R"` specifier.
|
A schema for `int`.
|
|
A schema for `int16`.
|
|
A schema for `int64`.
|
|
|
|
|
|
|
|
|
|
|
|
|
Empty strings are often accidental placeholders rather than meaningful values. This helper keeps that validation explicit and reusable.
|
|
|
|
|
|
Positive identifiers and counters are a common wire-level constraint, and `tryMap` keeps that rule opt-in rather than global.
|
Full Usage:
readOnlyList inner
Parameters:
Schema<'T>
Returns: Schema<IReadOnlyList<'T>>
Modifiers: inline Type parameters: 'T |
Builds a schema for `IReadOnlyList<'T>`. Keep the wire form identical to arrays while still allowing .NET-facing APIs to expose read-only collection interfaces.
|
|
|
|
|
A schema for `sbyte`.
|
|
A schema for `string`.
|
|
|
Some contracts normalize surrounding whitespace at the boundary rather than making every caller remember to trim before encode and after decode.
|
|
|
A schema for `uint16`.
|
|
A schema for `uint32`.
|
|
A schema for `uint64`.
|
|
CodecMapper