generative-ai-js icon indicating copy to clipboard operation
generative-ai-js copied to clipboard

Allow Schema types to be written as inline string literals.

Open rictic opened this issue 1 year ago • 2 comments

Declaring SchemaType as an enum means that users must reference the schema type off the enum, like SchemaType.OBJECT. That's useful, but it's also nice to be able to just write 'object', and with TypeScript that's equally type safe, IDEs are equally helpful with autocomplete, etc!

This is a backwards compatible change that allows users to write it either way.

rictic avatar Nov 12 '24 23:11 rictic

I rebased and regenerated the docs

rictic avatar Nov 20 '24 22:11 rictic

I had previously submitted the same PR here with a simpler approach https://github.com/google-gemini/generative-ai-js/pull/279

getting either of these merged in would be great

hapticdata avatar Dec 16 '24 21:12 hapticdata