google-gemini/generative-ai-dart

Add Schema named constructors for various types

natebosch opened this issue · 0 comments

The current pattern is Schema(SchemaType.object, properties:..., Schema(SchemaType.string, description: ...

This API is more verbose than it needs to be (Schema repeated twice, Type is a noise word).
This API is also less discoverable than it could be, because some named constructor arguments don't apply to all schema types - the enumValues, format, items, properties, and requiredProperties fields only apply to a subset of schema types.

I think it would be an improvement to add Schema.object(properties: ..., Schema.string(description: ..., Schema.enum(values: ..., etc