-
Notifications
You must be signed in to change notification settings - Fork 108
ESQL: define the tables
parameter
#2706
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
Conversation
I'm not sure what's up with the failure here. It looks like it doesn't like:
The |
I would model it like this: // the naming should probably get improved
export type TableValuesData = long | int | string | double
export type TableValuesDataPayload = TableValuesData | TableValuesData[] tables?: Dictionary<
string,
Dictionary<string, SingleKeyDictionary<TableValuesType, TableValuesDataPayload[]>>
> Btw: |
Gotcha. I'll do it like you said without |
@flobernd have a look now! |
Following you can find the validation results for the APIs you have changed.
You can validate these APIs yourself by using the |
Hey! I was testing that with |
Following you can find the validation results for the APIs you have changed.
You can validate these APIs yourself by using the |
export interface TableValuesInteger { | ||
integer: TableValuesIntegerValue[] | ||
} | ||
type TableValuesIntegerValue = integer | integer[] | ||
export interface TableValuesKeyword { | ||
keyword: TableValuesKeywordValue[] | ||
} | ||
type TableValuesKeywordValue = string | string[] | ||
export interface TableValuesLong { | ||
long: TableValuesLongValue[] | ||
} | ||
type TableValuesLongValue = long | long[] | ||
export interface TableValuesDouble { | ||
double: TableValuesLongDouble[] | ||
} | ||
type TableValuesLongDouble = double | double[] |
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.
Since these types are mutually exclusive, we should consider modelling them as a container
like:
/** @variants container */
export interface TableValues
{
integer?: integer | integer[]
keyword?: string | string[]
long?: long | long[]
double?: double | double[]
}
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 that work with your code-generators @Anaethelion @l-trotta ?
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 did it this way because you can't specify more than one key in the object. Is that what @container
does?
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.
nit: for it to be a proper container all the fields should be optional.
To explain further the @container
was designed primarily for query
in search where the fields you set defines the type of query you use. Thus each QueryContainer can only have one field populated. link to modeling guide
I think it fits the intent.
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 did it this way because you can't specify more than one key in the object. Is that what @container does?
Yes, the keys inside the container are mutually exclusive. I updated the above code with the missing optional ?
modifier.
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 updated the above code
I don't see a push. I'm willing to make the update myself if you'd like. Just getting out from other stuff.
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.
Oh sorry, I meant the code with the container example in the above comment.
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.
Cool. I've pushed some updates.
profile?: boolean | ||
/** | ||
* The ES|QL query API accepts an ES|QL query string in the query parameter, runs it, and returns the results. | ||
*/ | ||
query: string | ||
/** | ||
* Tables to use with the LOOKUP operation. |
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.
We should probably document the dictionary keys a little bit more in detail. I assume the outer key is the table name and the inner one the column name?
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.
👍
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.
Done.
Following you can find the validation results for the APIs you have changed.
You can validate these APIs yourself by using the |
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've pushed another update based on suggestions.
profile?: boolean | ||
/** | ||
* The ES|QL query API accepts an ES|QL query string in the query parameter, runs it, and returns the results. | ||
*/ | ||
query: string | ||
/** | ||
* Tables to use with the LOOKUP operation. |
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.
Done.
Following you can find the validation results for the APIs you have changed.
You can validate these APIs yourself by using the |
import { double, integer, long } from '@_types/Numeric' | ||
|
||
/** @variants container */ | ||
export interface TableValues { |
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.
export interface TableValues { | |
export interface TableValueContainer { |
Just a naming suggestion to be consistent with the existing specification, LGTM otherwise!
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.
(or TableValuesContainer
- not sure if singular or plural makes more sense here)
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 think plural does. I'll make the change.
* Tables to use with the LOOKUP operation. The top level key is the table | ||
* name and the next level key is the column name. | ||
*/ | ||
tables?: Dictionary<string, Dictionary<string, TableValues>> |
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.
tables?: Dictionary<string, Dictionary<string, TableValues>> | |
tables?: Dictionary<string, Dictionary<string, TableValueContainer>> |
Following you can find the validation results for the APIs you have changed.
You can validate these APIs yourself by using the |
Following you can find the validation results for the APIs you have changed.
You can validate these APIs yourself by using the |
Renamed. I've marked this auto-merge because I think that's what we want. I think I'm waiting on a final review. |
Following you can find the validation results for the APIs you have changed.
You can validate these APIs yourself by using the |
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.
LGTM! Thanks for the effort 🙂
Thanks for the feedback folks! |
Adds support for the
tables
parameter and documents theprofile
option.