Type alias NumberProcessing

NumberProcessing: "parse" | "serialize" | "auto" | "reject" | undefined

Number value processing policy.

The input number without 0n prefix may be parsed as BigInt when expected by schema. The number processing policy controls this behavior.

The policy is one of:

  • 'parse' or undefined (the default) to parse the input number without 0n prefix as BigInt. If this fails, an error is reported.
  • 'serialize' is the same as 'parse', but also serializes BigInt values as numbers without 0n prefix.
  • 'auto' is the same as 'serialize' if the value can be represented as number, i.e. it is between MIN_SAFE_INTEGER and MAX_SAFE_INTEGER. Otherwise, a 0n prefix is added.
  • 'reject' to reject the input numbers without 0n prefix. This is the default behavior for schema-less processing, but not when BigInt expected by schema.

For JSON this setting is ignored when string option is set to 'serialize'. Otherwise, it can be one of:

  • 'serialize' serializes BigInt values as numbers. Note that receiver may fail to handle big values in this case. ChURI is ok.
  • 'auto' or undefined (the default) is the same as 'serialize' if the value can be represented as number, i.e. it is between MIN_SAFE_INTEGER and MAX_SAFE_INTEGER. Otherwise, it is represented as string.
  • 'parse' and 'reject' mean the same as 'auto'.

Generated using TypeDoc