-
Notifications
You must be signed in to change notification settings - Fork 71
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
Allow 'any' examples in JSON schema #2289
base: main
Are you sure you want to change the base?
Conversation
@@ -79,7 +79,7 @@ type Schema struct { | |||
|
|||
// Examples of the value for properties in the schema. | |||
// https://json-schema.org/understanding-json-schema/reference/annotations | |||
Examples []any `json:"examples,omitempty"` | |||
Examples any `json:"examples,omitempty"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also probably we could remove this field and add some custom field instead to use in docsgen. Currently it doesn't get any examples from doc and used only to keep this annotation example linked with particular json schema node
@@ -122,7 +124,11 @@ func (p *openapiParser) extractAnnotations(typ reflect.Type, outputPath, overrid | |||
if err != nil { | |||
return err | |||
} | |||
err = yaml.Unmarshal(b, &overrides) | |||
overridesDyn, err := yamlloader.LoadYAML(overridesPath, bytes.NewBuffer(b)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Replaced marshaller with our custom loader because it was expecting "yaml" tags in structure while we use "json" everywhere
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you explain where/how the examples
field is not an array?
github.com/databricks/databricks-sdk-go/service/apps.AppResource: | ||
"job": | ||
github.com/databricks/databricks-sdk-go/service/apps.AppDeployment: | ||
"create_time": |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why did the reordering happen?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems that previously there lines were added manually but now it was auto-sorted after regenerating
Will keep an eye in it to see if there are any issues with ordering
return "" | ||
} | ||
return examples[0].(string) | ||
return examples[0] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can call getExamples
to avoid duplicate type casts.
The docs state that examples must be an array (ref). |
Changes
any
examples in json-schema type since we have many of them in open api specTests