@my-swu/simulator-client / createSchemaValidator
Function: createSchemaValidator()
createSchemaValidator():
SchemaValidator
Defined in: packages/ts-sdk/src/validators.ts:369
Builds the schema-backed validator for createSimulatorClient.
Boundary validation is off by default. Naming this function is what opts a build in — and what makes the generated schema map plus Ajv reachable from the client, which is roughly 90% of the SDK's minified bundle. Leave it unreferenced and a bundler removes both.
The returned validator carries a warmUp, which createSimulatorClient schedules on an idle callback so the first schema compile does not land on the first server frame.
Example:
ts
import { createSchemaValidator, createSimulatorClient } from '@my-swu/simulator-client'
// Boundary validation is off until a validator is named, which is also what
// pulls the generated schema map into the bundle.
const simulatorClient = createSimulatorClient({
baseUrl: 'http://127.0.0.1:4000',
validate: createSchemaValidator(),
})
console.log(await simulatorClient.system.health())Returns
Example
ts
import { createSchemaValidator, createSimulatorClient } from '@my-swu/simulator-client'
const simulatorClient = createSimulatorClient({
baseUrl: 'http://127.0.0.1:4000',
validate: createSchemaValidator(),
})