Skip to content

Conversation

@rictic
Copy link
Contributor

@rictic rictic commented Nov 13, 2024

This leverages the type system to better describe the API's requirements for schemas. For example, rather than saying that any schema might have an optional items property, we're able to express that items is required on array schemas and forbidden on all others.

More info on discriminated unions: https://www.typescriptlang.org/docs/handbook/2/narrowing.html#discriminated-unions

@rictic rictic force-pushed the discriminated-union-schema branch 2 times, most recently from 14a8662 to f7d75d5 Compare November 13, 2024 06:34
This leverages the type system to better describe the API's requirements for schemas. For example, rather than saying that any schema might have an optional `items` property, we're able to express that `items` is required on array schemas and forbidden on all others.

More info on discriminated unions: https://www.typescriptlang.org/docs/handbook/2/narrowing.html#discriminated-unions
@rictic rictic force-pushed the discriminated-union-schema branch from f7d75d5 to 0c417fb Compare November 13, 2024 06:44
@junyanxu junyanxu self-requested a review November 14, 2024 17:25
@junyanxu junyanxu merged commit 3004d3b into google-gemini:main Nov 18, 2024
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants