type defs as map[string]any

This commit is contained in:
Shreyas Goenka 2024-09-04 11:03:33 +02:00
parent 8575c47626
commit 46585bbd3f
No known key found for this signature in database
GPG Key ID: 92A07DF49CCB0622
2 changed files with 2 additions and 2 deletions

View File

@ -45,7 +45,7 @@ type constructor struct {
// For example:
// {"a/b/c": "value"} is converted to {"a": {"b": {"c": "value"}}}
// the $ref for "value" would be "#/$defs/a/b/c" in the generated JSON schema.
func (c *constructor) Definitions() any {
func (c *constructor) Definitions() map[string]any {
defs := maps.Clone(c.definitions)
// Remove the root type from the definitions. We don't need to include it in

View File

@ -15,7 +15,7 @@ import (
type Schema struct {
// Definitions that can be reused and referenced throughout the schema. The
// syntax for a reference is $ref: #/$defs/<path.to.definition>
Definitions any `json:"$defs,omitempty"`
Definitions map[string]any `json:"$defs,omitempty"`
// Type of the object
Type Type `json:"type,omitempty"`