-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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 SearchRequest/Response proto and schema proto #15411
base: 2.16
Are you sure you want to change the base?
Conversation
Signed-off-by: Shuyi Zhang <xxamber998@gmail.com> Signed-off-by: amberzsy <xxamber998@gmail.com>
bcf6693
to
e60462e
Compare
❌ Gradle check result for bcf6693: FAILURE Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change? |
❌ Gradle check result for e60462e: FAILURE Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change? |
Signed-off-by: amberzsy <xxamber998@gmail.com>
Signed-off-by: amberzsy <xxamber998@gmail.com>
❌ Gradle check result for 2bbdb8d: FAILURE Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change? |
❌ Gradle check result for bd9c7c2: FAILURE Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change? |
Couple of thoughts:
WDYT? |
yes, technically, we definitely should have this automated and have it as part of build process. i can maybe have simple version matchAll query and related schema to unblock on grpc poc and remove all the rest of proto def. |
Probably best.
That's why I'd start automating it right away. We likely will need to incrementally fix the spec and the pipeline, add linters to avoid common mistakes in the spec that lead to something we can't convert, etc.
I personally don't have a preference. You could write a brand new converter in https://github.com/opensearch-project/opensearch-api-specification, we already parse the spec and do a lot of things to it. |
Thanks @amberzsy!
Your suggestion of using
Ultimately the code in this repository that implements the API is the source of truth. If the documentation and the api spec do not agree, then whatever is actually implemented is correct. The goal is to make the api spec match what is actually implemented (this is an ongoing manual process to build it out), then add tests that verify and enforce the actual API matches the spec. The documentation is built out in separate manual process as well so its not surprising that there are subtle differences. The goal is to also be able to generate the API documentation from the specification as well, but we're not there yet.
A custom message type (
This seems like a quirk of JSON? Like |
sounds good. i'll update the pr for more grpc poc purpose (instead of proto defs) and we can have separate discussion for the proto/specs etc. I'll provide a doc with list of gaps and plans which will need opinion from you for clarification/alignment by end of tmr. |
The doc is incorrect/is missing information. We have opensearch-project/documentation-website#7700 that we plan to take on soon.
If the spec needs changes, please contribute/open issues in https://github.com/opensearch-project/opensearch-api-specification.
See above. |
probably go with single repeated field. |
This PR is stalled because it has been open for 30 days with no activity. |
Description
Generate protobuf for SearchRequest, Response and related schemas from https://github.com/andrross/opensearch-api-specification/blob/main/spec/namespaces/_core.yaml using https://github.com/OpenAPITools/openapi-generator/tree/master.
Related Issues
Resolves #15190
Check List
Issue:
proposal:
a) use
optional
.b) use
oneOf
c) use customized wrapper
Gaps between https://opensearch.org/docs/latest/api-reference/search/ and https://github.com/andrross/opensearch-api-specification/tree/main.
a. Numeric type: number defined in specs but Integer in public docs. we might need to further specify numeric in api-specs / protobuf
b. Request body has bunch of new properties but not mentioned in https://opensearch.org/docs/latest/api-reference/search/.
We need to have criteria on muti-types as below.
in this PR, i use ... (open to any suggestions)
oneOf
Object and Array of Object.e.g
In this PR, all consolidated to
openapi-generator Tooling
Overall, openapi-generator can relative accurately generate 70% of probuf but manual validation and adjustment is required which is time-consuming based on this scale of API specs.
TODO: we need to further enhance the tooling to be able to support api-specs to protobuf translation.