Skip to content

Commit 41b5a98

Browse files
committed
clarify type validation section
1 parent 16e258c commit 41b5a98

File tree

1 file changed

+1
-25
lines changed

1 file changed

+1
-25
lines changed

fern/products/api-def/ferndef-pages/types.mdx

Lines changed: 1 addition & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ interface Person {
282282

283283
### Validating types
284284

285-
You can add validation constraints to your types (both aliases and references) to ensure data integrity. Validation constracts are automatically enforced in generated SDKs.
285+
You can add validation constraints to your types (both aliases and references) to ensure data integrity. These validation constraints are included in generated SDKs for documentation purposes, but actual validation is deferred to the server.
286286

287287
<CodeBlock title="Fern Definition">
288288
```yaml {8-11, 15-17}
@@ -305,30 +305,6 @@ types:
305305
max: 150
306306
```
307307
</CodeBlock>
308-
<CodeBlock title="Generated TypeScript SDK from Fern Definition">
309-
310-
```typescript
311-
interface Person {
312-
/** The person's full name */
313-
name: string;
314-
/** Age in years */
315-
age: number;
316-
}
317-
318-
// Validation is automatically enforced when creating Person objects
319-
const client = new YourApiClient();
320-
try {
321-
const person = await client.createPerson({
322-
name: "A", // Fails minLength validation
323-
age: -5, // Fails min validation
324-
});
325-
} catch (error) {
326-
if (error instanceof ValidationError) {
327-
console.log(`Validation failed: ${error.message}`);
328-
}
329-
}
330-
```
331-
</CodeBlock>
332308

333309
<AccordionGroup>
334310
<Accordion title="String validation reference">

0 commit comments

Comments
 (0)