# Validating on the client

> experimental_validationLink checks inputs before sending and results when they arrive, against a contract.

Clients ship no schemas by default. To check calls against a contract in the browser, add `experimental_validationLink`: inputs are validated before anything is sent (the same `BAD_REQUEST` the server returns, so forms can show its issues), and results and subscription events are checked when they arrive (`BAD_RESPONSE` when the server drifted from the contract, with the issues on its `cause`):

```ts
const client = createTrpcClient({
  router: appContract,
  links: [
    experimental_validationLink({ contract: appContract }),
    httpLink({ url }),
  ],
});
```

Results are checked against the output's type side, so Effect Schema transformations don't run a second time. With `experimental_openApiLink`, whose results are plain JSON, `output: 'json'` decodes them with the Effect Schema's JSON codec, so `Date`s, `bigint`s and classes come back as their types. Standard Schema outputs are validated as they are.

See [Contract-first](https://v12.trpc.io/v12/docs/server/contract-first.md) for writing the contract, and [Calling REST from the client](https://v12.trpc.io/v12/docs/openapi/client.md) for `experimental_openApiLink`.

## Credits

`experimental_validationLink` follows oRPC's [request validation](https://orpc.dev/docs/plugins/request-validation) and [response validation](https://orpc.dev/docs/plugins/response-validation) plugins.
