Repository navigation
Generate typed response types for all API groups - #505
Merged
reta merged 2 commits intoNov 5, 2026
Merged
Conversation
Generate response types and typed builders for every operation group of the specification that declares a JSON success response, instead of only search, index, bulk and get: 456 groups are typed, and the 25 others (HEAD-only, or without a JSON body) are reported with the reason. The `TYPED_OPERATION_GROUPS` selection is replaced by `read_all_response_models`, used both to generate the types and to record each endpoint's typed response. The raw-field declarations grow from 23 to 167; the 144 new ones reuse the reasons reviewed on the earlier full-API branch, with the same causes. Typed namespace clients (e.g. `client.typed().cluster()`) now carry the unknown-fields setting of the typed client, so strict mode applies to namespace APIs too. Typed builders of deprecated APIs allow the use of their deprecated generic builder, as the generic code does. The yaml typed check now skips the requests the typed client cannot send, using the generator's list of omitted options: `filter_path`, and cat/list requests without `format=json`. Signed-off-by: Takuo Kuroki <kurotaku9679.sub@gmail.com>
krocky-cooky
requested review from
VachaShah,
Xtansia and
reta
as code owners
October 30, 2026 09:58
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #505 +/- ##
===========================================
- Coverage 56.12% 44.15% -11.97%
===========================================
Files 523 567 +44
Lines 119123 168923 +49800
===========================================
+ Hits 66859 74595 +7736
- Misses 52264 94328 +42064
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
reta
reviewed
Nov 1, 2026
Collaborator
|
Thanks @krocky-cooky , went through all (nonetheless it is primarily generated), LGTM except this comment #505 (comment), thank you |
The typed client conforms to the specification: it parses the fields the response types define and ignores the others, as the other OpenSearch clients do. The opt-in strict mode, which turned those keys into an error, was a maintainer's tool: it decoded every body twice, made every typed builder and namespace client carry a setting, and added an error kind to the public API, while a caller could not read the reported fields through the typed client anyway. Remove `TypedOpenSearch::ignore_unknown_fields`, `Error::unknown_fields` and the detection behind them, and the `Serialize` bound of `Response::typed`. Gaps in the specification are still reported by the yaml typed check of the test runner, and an opt-in check can be added back later without breaking anyone. Signed-off-by: Takuo Kuroki <kurotaku9679.sub@gmail.com>
reta
approved these changes
Nov 5, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Follow-up to #494, which generated typed response types for search, index, bulk and get only. This PR applies the same generator to every API group of the specification. Nothing about how the types are generated changes; the diff is the selection, the declarations it requires, and two issues that only show up once namespace APIs are typed.
Coverage
client.typed().cluster().health(..),client.typed().indices().create(..),client.typed().cat().indices(..), and so on.Changes from #494
TYPED_OPERATION_GROUPSis removed. The newread_all_response_modelsis used both to generate the types and to record each endpoint's typed response, so the two can't disagree.raw_fields/declared.rs) grow from 23 to 167. The 144 new ones reuse the reasons reviewed on the earlier full-API branch; each had the same cause.ml.load_model) allow the deprecated generic builder they wrap, as the generic code already does. Users still get the deprecation warning; the library build no longer does (clippy stays at 42, as onmain).filter_path, and cat/list requests withoutformat=json(e.g.cat.countanswering2in plain text).Verification against a real cluster (OpenSearch 3.9.0)
main(1,333 passed / 40 failed, the same 40).fetch, float rounding), they are spec gaps, not generator issuesIssues Resolved
Part of #481, part of #488
Check List
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.