Repository F# setup
open Reified
open Reified.Refinements
open Reified.ResultSecrets
Secret<'value> is a sealed reference type in Reified.Refinements. Its invariant is redacted display, not a
validation rule. It has reference equality, not structural equality. ToString, %O, %A and JavaScript
JSON.stringify display <redacted>. The supported payload accessor is Secret.reveal:
open Reified.Refinements
let password = Secret.create "example-password"
assert (string password = "<redacted>")
let suppliedToClient = Secret.reveal password
ReifiedRefinementspassword: Secret<string>Reified.Refinements.SecretExplicit creation and access for secret values.
create: 'a -> Secret<'a>Seals a value without inspecting it. let password = Secret.create "credential"
string: 'T -> stringConverts the argument to a string using ToString. For standard integer and floating point values and any type that implements IFormattableToString conversion uses CultureInfo.InvariantCulture. The input value. The converted string. string 'A' // evaluates to "A" string 0xff // evaluates to "255" string -10 // evaluates to "-10"
(=): 'T -> 'T -> boolStructural equality The first parameter. The second parameter. The result of the comparison. 5 = 5 // Evaluates to true 5 = 6 // Evaluates to false [1; 2] = [1; 2] // Evaluates to true (1, 5) = (1, 6) // Evaluates to false
suppliedToClient: stringreveal: Secret<'value> -> 'valueExplicitly accesses the sealed value. let plain = Secret.create "credential" |> Secret.reveal
This is not encryption or access control. The value remains in memory. Do not log the result of reveal or the
original string, and do not expect a raw Data tree or a caller-written serializer to infer which strings are
secrets. No key-name heuristic is used.
Declare a secret field
The field resolver supplies the canonical schema for Secret<'value>, recursively resolving the payload schema.
Use Schema.secret<'value> () for a standalone canonical schema, or Schema.secretWith payloadSchema for explicit
payload validation:
open Reified
open Reified.Refinements
open Reified.SchemaDSL
type Credentials = { Password: Secret<string> }
let credentials = schema<Credentials> {
field _.Password
construct (fun password -> { Password = password })
}
let passwordSchema = Schema.text |> Schema.constrain (Constraint.minLength 12) |> Schema.secretWith
let parsed = Schema.parse passwordSchema (Data.Text "example-password")
ReifiedRefinementsReified.SchemaDSLThe concise schema-definition vocabulary: the record computation expression, its field and constructor forms, and the collection-schema operations. Optional and opt-in, in the same shape as Reified.DataDSL and Reified.ConstraintDSL: open Reified.Schema for Schema, then open Reified.SchemaDSL for this vocabulary. There is no constraint catalogue here. One Constraint vocabulary serves direct checking, refinement, and Schema, so a field block reaches for Constraint.email or an opened Reified.ConstraintDSL exactly as standalone code does. Boundary supply is Schema-owned and stays here as mustSupply and mayOmit.
FsLiveDocsGeneratedPage36_1A4D411B7043.CredentialsPassword: Secret<string>Reified.Refinements.Secret`1A reference-equality value with redacted display and explicit Secret.reveal access. The payload is captured in a private closure rather than an enumerable raw field. This is redaction, not encryption or access control. Caller-owned plaintext and explicitly revealed values remain the caller's responsibility.
stringAn abbreviation for the CLI type . Basic Types
credentials: Schema<Credentials>schema: SchemaCeBuilder.SchemaBuilder<'model>Record-schema computation expression.
``.ctor``: Quotations.Expr<(Credentials -> Secret<string>)> -> field<Credentials,Secret<string>>Declares a field, deriving its camel-cased wire name from the property getter. type Signup = { Email: string } field (fun (s: Signup) -> s.Email) // wire name "email"
_arg1: Credentialsconstruct: 'constructor -> SchemaCeBuilder.ConstructorStep<'model,'constructor>Closes a record schema with a total constructor.
password: Secret<string>passwordSchema: Schema<Secret<string>>Reified.SchemaConstruction, composition, parsing, and checking for universal schemas.
text: Schema<string>Describes text input.
(|>): 'T1 -> ('T1 -> 'U) -> 'UApply a function to a value, the value being on the left, the function on the right The argument. The function. The function result. let doubleIt x = x * 2 3 |> doubleIt // Evaluates to 6
constrain: Constraint<'a> -> Schema<'a> -> Schema<'a>Requires a schema's values to satisfy a constraint. The same Constraint value serves direct checking, refinement, and Schema. For a value schema the constraint runs at that layer; for a model schema it runs after successful field admission and construction. Schema.text |> Schema.constrain (Constraint.lengthBetween 2 40)
Reified.ConstraintModuleCreates, executes, composes, and inspects constraints.
minLength: int -> Constraint<^value>Requires text or a collection to have at least the supplied size. Literal size, so a single space satisfies minLength 1. Use present to reject whitespace. let tags : Constraint<string list> = Constraint.minLength 1
secretWith: Schema<'a> -> Schema<Secret<'a>>Seals a payload schema behind a redacted parse/check/codec boundary. Errors collapse to a value-free issue at the secret field path. Codecs accept the payload wire shape but encode the string <redacted>, not the payload; encoding is deliberately not a round trip. Only Secret.reveal returns the payload. This is log redaction, not memory encryption. let passwordSchema = Schema.secretWith Schema.text
parsed: Result<Secret<string>,SchemaErrors>parse: Schema<'a> -> Data -> Result<'a,SchemaErrors>Parses source-neutral structured data, runs constraints and refinements, and invokes record constructors.
Reified.DataA portable tree for structured data. Data preserves null, text, number, Boolean, list, and object distinctions without depending on a serializer or input format. Data is a structured-value model, not a source syntax tree. It does not model whitespace, comments, source locations, or other format-specific syntax. Number values currently retain a lexical token so adapters do not narrow arbitrary-size integers, decimal precision, or exponent notation to one runtime numeric type.
TextA text value.
Schema.parse and Schema.check run payload validation inside the secret boundary. Any rejected payload becomes
one value-free secret.invalid issue with message <redacted> at the secret field's path. Inner map keys, actual
values, authored validator messages and constraint operands are not kept in that issue. SchemaCheck.complete
also redacts violations. Exceptions from callbacks remain exceptions, but their message and inner exception are
withheld. Schema.inspectUnderlying rejects secret schemas: unsealing requires Secret.reveal.
Schema.parseRetainingInput replaces declared secret inputs with the placeholder before returning its Input, on
success or failure. Field names and aliases are matched ordinal-ignore-case, so PASSWORD is redacted for a
Password secret field even when the parse rejects it. Collections and aliases are covered. A union that can
contain secrets is retained as one redacted subtree; it is not a lossless redisplay source. The original input
supplied by the caller is not mutated. Use Schema.parseRetainingInputWith to apply parse options such as
Schema.ignoreKeyCase while retaining input.
JSON accepts payloads but never writes them
open Reified
open Reified.Refinements
let codec = Json.compile (Schema.secretWith Schema.int)
let decoded = Json.deserialize codec "5432"
assert (Secret.reveal decoded = 5432)
assert (Json.serialize codec decoded = "\"<redacted>\"")
ReifiedRefinementscodec: JsonCodec<Secret<int>>Reified.JsonFunctions for compiling and running JSON codecs over built model schemas.
compile: Schema<'model> -> JsonCodec<'model>Compiles a completed schema into a reusable JSON codec. Compile once per schema, typically at startup, and reuse the codec for every value. Constructor-last object schemas retain a typed record plan, including checked constructors. Constructor failures surface as during decoding. Thrown when is null. Thrown when is incomplete. open Reified.SchemaDSL open Reified.ConstraintDSL type Customer = { Name: string; Email: string } let customerSchema = schema<Customer> { field _.Name { constrain present } field _.Email { constraints [ present; email ] } construct (fun name email -> { Name = name; Email = email }) } let customer = { Name = "Ada"; Email = "ada@example.org" } let codec = Json.compile customerSchema let json = Json.serialize codec customer let roundTripped = Json.deserialize codec json
Reified.SchemaConstruction, composition, parsing, and checking for universal schemas.
secretWith: Schema<'a> -> Schema<Secret<'a>>Seals a payload schema behind a redacted parse/check/codec boundary. Errors collapse to a value-free issue at the secret field path. Codecs accept the payload wire shape but encode the string <redacted>, not the payload; encoding is deliberately not a round trip. Only Secret.reveal returns the payload. This is log redaction, not memory encryption. let passwordSchema = Schema.secretWith Schema.text
int: Schema<int>Describes a 32-bit integer.
decoded: Secret<int>deserialize: JsonCodec<'model> -> string -> 'modelDeserializes a JSON string to a trusted model through a compiled codec. Thrown when or is null. Thrown when the JSON does not match the schema's wire shape.
Reified.Refinements.SecretExplicit creation and access for secret values.
reveal: Secret<'value> -> 'valueExplicitly accesses the sealed value. let plain = Secret.create "credential" |> Secret.reveal
(=): 'T -> 'T -> boolStructural equality The first parameter. The second parameter. The result of the comparison. 5 = 5 // Evaluates to true 5 = 6 // Evaluates to false [1; 2] = [1; 2] // Evaluates to true (1, 5) = (1, 6) // Evaluates to false
serialize: JsonCodec<'model> -> 'model -> stringSerializes a trusted model to a JSON string through a compiled codec. Thrown when is null.
Decoding accepts the payload's ordinary wire shape. Encoding always writes the JSON string "<redacted>", even
for a numeric or object payload. This is deliberately not a round-trip codec and must not be used to persist
credentials for later recovery. Codec failures under the secret boundary have redacted details too.
Inspection reports SchemaShape.Secret, withholding payload defaults, descriptions and constraints. JSON Schema
emits writeOnly: true and x-reified-secret: true, without claiming to describe the hidden payload constraints.
Schema-derived generation fails closed for this opaque shape; supply test secrets explicitly. Defaults declared on
a payload schema are sealed before they are returned as field values or through Schema.defaultValue.