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

fix(go): allow multiple schemas using picoschema #1400

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

alonsopec89
Copy link
Contributor

Allow multiple type in picoschema

Checklist (if applicable):

  • Tested (manually, unit tested, etc.)
  • Changelog updated
  • Docs updated

@pavelgj pavelgj changed the title [GO] Fix: allow multiple schemas using picoschema fix(go): allow multiple schemas using picoschema Nov 26, 2024
@pavelgj
Copy link
Collaborator

pavelgj commented Nov 26, 2024

please follow https://www.conventionalcommits.org/en/v1.0.0/ for PRs

@@ -97,3 +100,54 @@ func replaceEmptySchemas(m map[string]any) any {
}
return m
}

func replaceAnyOfWithTypeArray(schema map[string]any) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you help me understand what this is for? Is it only needed for the test or everywhere?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that it is a helper function, to match exactly the test cases with the string expected, without it we have error because the serializate func outputs something like string("red", "blue") and we want AnyOf("red", "blue"), but the important refactor I think it is about: picoschema.go https://github.com/firebase/genkit/pull/1400/files#diff-d643807a9a75f3e4805fd792bbd253ad99819a506fcfb5bdf9ffa20660d87a4eR109

Copy link
Collaborator

@apascal07 apascal07 Dec 6, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a sample with an actual dotprompt file that uses these features that weren't supported before? The tests are good but we're doing quite a bit of extra logic here so I want to make sure that it actually works in practice. There's a lot happening here so it's hard for me to tell if this is correct or not.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seems like dotpromot have now his own project,

@alonsopec89 alonsopec89 linked an issue Dec 13, 2024 that may be closed by this pull request
@alonsopec89 alonsopec89 requested a review from apascal07 January 10, 2025 18:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: No status
Development

Successfully merging this pull request may close these issues.

[Go] picoschema does not implement all the features of JS
3 participants