Skip to content

Commit 7094c42

Browse files
the-ultclaude
andcommitted
docs: document runtimeValidation both strategy
Update the angular, angular-query and fetch `runtimeValidation` reference entries to document the object form `{ strategy: 'throw' | 'both' }` and the log-then-throw behaviour of `both`. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 09560d2 commit 7094c42

1 file changed

Lines changed: 16 additions & 3 deletions

File tree

  • docs/content/docs/reference/configuration

docs/content/docs/reference/configuration/output.mdx

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1282,11 +1282,13 @@ Force a specific version for generated hooks.
12821282

12831283
### runtimeValidation
12841284

1285-
**Type:** `Boolean`
1285+
**Type:** `boolean | { strategy: 'throw' | 'both' }`
12861286
**Default:** `false`
12871287

12881288
Enable Zod runtime validation for Angular query responses. Requires `schemas: { type: 'zod' }`. When enabled, responses are validated via `Schema.parse()` in the RxJS pipeline. Skipped for primitive types and custom mutators.
12891289

1290+
The boolean form is preserved for backward compatibility: `true``{ strategy: 'throw' }`. With `{ strategy: 'both' }` an invalid response is first logged through `console.error('[orval] <operation> response validation failed', error)` with the raw `ZodError`, then re-thrown — so the failure still surfaces through the client's native error channel while giving production visibility into contract drift.
1291+
12901292
---
12911293

12921294
## override.swr
@@ -1668,7 +1670,7 @@ scope clearer.
16681670

16691671
### runtimeValidation
16701672

1671-
**Type:** `Boolean`
1673+
**Type:** `boolean | { strategy: 'throw' | 'both' }`
16721674
**Default:** `false`
16731675

16741676
Enable Zod runtime validation for Angular output. Requires
@@ -1679,6 +1681,13 @@ Enable Zod runtime validation for Angular output. Requires
16791681
- For generated `httpResource` functions, eligible JSON resources receive a
16801682
`parse: Schema.parse` option.
16811683

1684+
The boolean form is preserved for backward compatibility: `true`
1685+
`{ strategy: 'throw' }`. With `{ strategy: 'both' }` an invalid response is first
1686+
logged through `console.error('[orval] <operation> response validation failed', error)`
1687+
with the raw `ZodError`, then re-thrown — so the failure still surfaces through
1688+
the client's native error channel (RxJS error / `resource.error()` signal) while
1689+
giving production visibility into contract drift.
1690+
16821691
Validation is skipped for primitive types, non-JSON responses,
16831692
`observe: 'events' | 'response'`, and custom mutator paths that bypass the
16841693
generated validation flow.
@@ -1906,11 +1915,13 @@ Custom JSON reviver function (useful for date parsing).
19061915

19071916
### runtimeValidation
19081917

1909-
**Type:** `Boolean`
1918+
**Type:** `boolean | { strategy: 'throw' | 'both' }`
19101919
**Default:** `false`
19111920

19121921
Enable Zod runtime validation for fetch client responses. Requires `schemas: { type: 'zod' }`. When enabled, JSON responses are validated via `Schema.parse()` before being returned.
19131922

1923+
The boolean form is preserved for backward compatibility: `true``{ strategy: 'throw' }`. With `{ strategy: 'both' }` an invalid response is first logged through `console.error('[orval] <operation> response validation failed', error)` with the raw `ZodError`, then re-thrown (rejecting the returned promise) — giving production visibility into contract drift while still failing fast.
1924+
19141925
### arrayFormat
19151926

19161927
**Type:** `'repeat' | 'brackets' | 'comma'`
@@ -2014,6 +2025,8 @@ export const load = async ({ fetch }) => {
20142025
| `fetch` | `override.fetch.runtimeValidation` || Validates JSON responses via `Schema.parse()` |
20152026
| any client with custom mutator | varies | ⚠️ | Runtime validation may be bypassed depending on mutator path and signature (see [#2858](https://github.com/orval-labs/orval/issues/2858)) |
20162027

2028+
All three supporting clients accept the object form `{ strategy: 'throw' | 'both' }`. `throw` (the default, equivalent to `true`) parses and throws; `both` additionally `console.error`s the raw `ZodError` before re-throwing, for production observability without giving up fail-fast behaviour.
2029+
20172030
---
20182031

20192032
## override.mock

0 commit comments

Comments
 (0)