-
Notifications
You must be signed in to change notification settings - Fork 65
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
Add additionalProperties to ErrorCause and fix creation_date type for list_dangling_indices #462
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -53,7 +53,7 @@ export function determine_possible_schema_types (doc: OpenAPIV3.Document, schema | |
if (schema?.anyOf !== undefined) return collect_all(schema.anyOf) | ||
if (schema?.oneOf !== undefined) return collect_all(schema.oneOf) | ||
|
||
if (schema == null || Object.keys(schema).filter(k => k !== 'description').length == 0) return SCHEMA_OBJECT_TYPES | ||
if (schema == null || Object.keys(schema).filter(k => k !== 'description' && k !== 'title').length == 0) return SCHEMA_OBJECT_TYPES | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could you please explain this change? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If nothing is specified in the schema other than "informational" properties (ie. description or title) than it can be any type. |
||
|
||
throw new Error(`Unable to determine possible types of schema: ${to_json(schema)}`) | ||
} | ||
|
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.
I'm thinking we might want some way of annotating properties as being the human readable variant of another property and dependent on
?human
. Would be useful for documentation or want to do some custom logic in clients/generators.Maybe something like:
Thoughts @dblock @nhtruong?
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.
It does feel a little too special, applying only to the
_cat
API. Are there exceptions where something likex
always have a pair ofx_millis
and lives only under_cat
?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.
Well it's not only the
_cat
api as this particular one is in the dangling_indices api and not only applies to _millis variants, also bytes oneshttps://github.com/search?q=repo%3Aopensearch-project%2FOpenSearch%20humanReadableField&type=code
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.
Would it be over-engineering to hide it under a type?
would get automatically expanded as
total
andtotal_in_bytes
when spec gets generated?I'm just thinking out loud. The drawback of
x-human-readable-of
is that it's a relationship that needs to be validated. If you think it's the cleanest way to do it, go for it - and maybe @nhtruong has some other ideas?