8000 feat(go/dotprompt): Modify the JSONSchema to jsonschema.Schema type by rutujaD1999 · Pull Request #111 · google/dotprompt · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

feat(go/dotprompt): Modify the JSONSchema to jsonschema.Schema type #111

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

Merged
merged 1 commit into from
Mar 13, 2025

Conversation

rutujaD1999
Copy link
Collaborator
@rutujaD1999 rutujaD1999 commented Mar 13, 2025
  • Modify JSONSchema of type map[string]any to jsonschema.Schema from https://pkg.go.dev/github.com/invopop/jsonschema package
  • This is done to make it compatible with Genkit implementation where this package is used extensively
  • All test changes are done based on the same.

@github-actions github-actions bot added the go label Mar 13, 2025
@yesudeep yesudeep requested review from yesudeep and apascal07 March 13, 2025 17:11
"fmt"
"slices"
"sort"
"strings"

"github.com/invopop/jsonschema"
orderedmap "github.com/wk8/go-ordered-map/v2"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Have you considered https://github.com/elliotchance/orderedmap instead? It has more stars and the most recent release was in January of this year rather than mid 2023.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The jsonschema package uses orderedmap for Schema.Properties type from "github.com/wk8/go-ordered-map/v2" package as mentioned here. Hence we are going ahead with the same.

"additionalProperties": false,
schema := &jsonschema.Schema{
Type: "object",
Properties: orderedmap.New[string, *jsonschema.Schema](),
Copy link
Collaborator

Choose a reason for hiding this comment

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

Curious, why is an ordered map needed here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It is used by the jsonschema package for Schema type : https://pkg.go.dev/github.com/invopop/jsonschema#Schema

@yesudeep yesudeep merged commit 340ec1b into main Mar 13, 2025
7 checks passed
< 88C9 circle cx="8" cy="8" r="7" stroke="currentColor" stroke-opacity="0.25" stroke-width="2" vector-effect="non-scaling-stroke" fill="none" />
@yesudeep yesudeep deleted the drutuja/jsonschema branch March 13, 2025 22:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
0