Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use lowercase SchemaType enum values #229

Merged
merged 1 commit into from
Sep 11, 2024

Conversation

mike-marcacci
Copy link
Contributor

@mike-marcacci mike-marcacci commented Aug 19, 2024

This fixes the serialized values of the SchemaType enum to follow the swagger doc referenced in comments, and the json-schema spec upon which the swagger spec is based.

This change makes this package compatible with the myriad other tools (like AJV) that allow the definition of validators, types, etc using standard json-schema.

I've tested sending lowercased values to gemini, and this appears to work perfectly, despite the TypeScript errors that this PR resolves.

@hsubox76
Copy link
Collaborator

Thanks! Can you do 2 things:
Run yarn docs to regenerate reference docs.
Run yarn changeset to generate a changeset file (choose "minor" as this causes an API surface change).

This fixes the serialized values of the `SchemaType` enum to follow [the referenced doc](https://swagger.io/docs/specification/data-models/data-types/) and [the json-schema spec](https://json-schema.org/draft/2020-12/json-schema-core#section-4.2.1) on which the reference is based.

This change makes the JS gemini SDK compatible with the myriad tools like [AJV](https://ajv.js.org/guide/typescript.html) that allow the definition of validators, types, etc using standard json-schema.

In practice the lowercased values appear to work perfectly, but show TypeScript errors.
@mike-marcacci
Copy link
Contributor Author

mike-marcacci commented Aug 26, 2024

Hi @hsubox76 - thanks for reiterating what y'all already had in the contributing docs, and sorry for not reading those first! 🤦🏼

I've updated and rebased this PR accordingly.

@mike-marcacci
Copy link
Contributor Author

Just wanted to kindly nudge this, at least to let the unit tests run. Thanks!

@navarrodiego
Copy link

I'm waiting for this!

@hsubox76 hsubox76 merged commit 00dc7a1 into google-gemini:main Sep 11, 2024
7 checks passed
@huytool157
Copy link

huytool157 commented Sep 12, 2024

Is this PR solving #153

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.

4 participants