-
Notifications
You must be signed in to change notification settings - Fork 80
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 _connector API #2367
Add _connector API #2367
Conversation
8e44f4e
to
ba8f107
Compare
…e-update-delete-list-get
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.
Left a few comments.
I've also taken the liberty to add the links to the documentation within the endpoints, feel free to edit/update if I made any mistake.
Co-authored-by: Laurent Saint-Félix <[email protected]>
Co-authored-by: Laurent Saint-Félix <[email protected]>
Co-authored-by: Laurent Saint-Félix <[email protected]>
…e-update-delete-list-get
Hey @Anaethelion thank you for review and adding the documentation links 👍 . I addressed your feedback and also updated the json spec files with correct doc links. Given the release timeline is it still ok to keep the There are couple of more endpoints to be added (related to |
Hey @swallez 👋 since Anaethelion is OOO this week, I was suggested to add you as a reviewer to this PR. Could you take a look? |
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.
Thanks for this big PR! I left a number of comments related to the style and constraints expected by the API specification.
Some comments only appear once but have many occurrences, so let me restate them here:
string | number | boolean | null
should be replaced byScalarValue
, orFieldValue
if it actually also accepts objects- the use of ' | null' should be avoided unless
null
has a special meaning. Use optional fields instead.
} | ||
|
||
enum DisplayType { | ||
TEXTBOX = 'textbox', |
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.
For enums you don't need to specify both identifier and value if they are the same (even with a different casing). Language generators will take care of using their casing convention. So this can be
enum DisplayType {
textbox,
textarea,
numeric...
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.
Thank you for pointing this out 👍 I'm guilty of just copy-pasting most of the types from defs in Kibana
display: DisplayType | ||
label: string | ||
options: SelectOption[] | ||
order?: number | null |
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.
Is the value null
different from missing (i.e. optional) field? If not, remove null
(many occurrences).
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 revised the types and I think for majority of cases we can safely mark fields as optional (instead of having them nullable).
The are some exceptions like: error
fields that are (string | null), I can think of some situations where we want to mark error as null (when connector gets back to a healthy state).
Also, last_sync...
fields can have explicit null
value in index. Could marking them optional instead of nullable break things, given that we use Connector
type to describe return type of get/list endpoints?
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.
Ok. So we have to implement #2049 that clearly distinguishes "null as optional" and "null as an actual value" in the spec. Adding that on my immediate todo list.
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.
Does it imply that this PR needs to wait until #2049 is implemented? We are not in a rush, just want to clarify
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.
Yes, because currently null
is considered as the equivalent of "missing" in languages where objects are represented as data structures and not dictionaries (i.e. all strictly typed languages). #2049 is meant to capture "null is an actual value" in the API spec so that we can generate code that correctly handles this.
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.
… type, add CustomSchedulingConfigurationOverrides type
…e-update-delete-list-get
Hey @Anaethelion @swallez I hope that all feedback is addressed now, can you take a look at this PR again? |
CI steps are breaking in the
Ahh probably it's github issue, see https://www.githubstatus.com/ - rerunning manually fixed it |
…e-update-delete-list-get
…e-update-delete-list-get
…e-update-delete-list-get
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.
Looking good! There are a few minor naming issues left, and we'll be good to go!
/** | ||
* A comma-separated list of connector index names to fetch connector documents for | ||
*/ | ||
index_name?: Fields |
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.
Fields
is meant to hold a list of index field names. If these are ES indices, then Indices
should be used.
/** | ||
* A comma-separated list of connector names to fetch connector documents for | ||
*/ | ||
connector_name?: Fields |
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.
Use Names
instead
/** | ||
* A comma-separated list of connector service types to fetch connector documents for | ||
*/ | ||
service_type?: Fields |
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.
Are service type identifiers? Then use Ids
, or otherwise Names
.
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.
They are arbitrary strings, so it is Names
for our case
configuration: ConnectorConfiguration | ||
custom_scheduling: ConnectorCustomScheduling | ||
description?: string | ||
error: WithNullValue<string> |
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.
Is this field really required? Will it always be present? If yes, this means that null
will mean "meaningful null" in responses. What does this mean?
Same question for a few other uses of required WithNullValue
fields in this PR.
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.
Yes, I do agree with you here. Since the Connector
denotes a response type. In a response, a missing (optional) field does indicate that the field is in fact null.
I will adapt this, but I the meaningful is needed for requests definitions to set certain fields to null.
"Validate APIs / build" was failing because of me, I fixed it and retried the build. |
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! 🎉
* The connector index name | ||
*/ | ||
body: { | ||
index_name: WithNullValue<string> |
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.
@swallez @Anaethelion I'm late to the party, but shouldn't we use the IndexName
alias instead of string
at these places?
Like:
index_name: WithNullValue<IndexName>
👋 Hey, I'm not sure if it's a best practice to add the client types after the FF. If I mislabelled it please let me know. The connectors API actions are introduced in
8.12
.Changes
update_last_sync
, we should followup to fix this in 8.13 on ES side