chitralverma opened a new pull request, #9318:
URL: https://github.com/apache/opendal/pull/9318

   # Which issue does this PR close?
   
   Closes #9311.
   
   Refs #9261, #9262.
   
   # Rationale for this change
   
   The generated `TypedDict`s declare map-valued options, such as 
`S3Config.assume_role_session_tags` and `HdfsNativeConfig.options`, as 
`dict[str, str]`, but `from_config` rejected every dict with `Unsupported`. 
Since #9262, core reads these options from a JSON object string.
   
   # What changes are included in this PR?
   
   - `from_config` converts a `dict` with `str` keys and values to a JSON 
object string with `serde_json`, with keys sorted. This applies to service, 
context, and layer values. `{}` becomes `"{}"`. If two `str` subclass keys 
extract to the same string, `from_config` raises `ConfigInvalid` instead of 
keeping one.
   - Non-`str` keys or values, dicts inside lists or tuples, and other mappings 
such as `MappingProxyType` still raise `Unsupported`.
   - The `from_config` docstrings and the regenerated `operator.pyi` describe 
the conversion.
   - `serde_json` becomes a direct dependency of the binding crate. It was 
already in the dependency graph through `opendal-core`.
   - Tests cover the exact encoding, escaping (decoded with `json`), `{}`, 
colliding keys, S3 session tags, and, in builds with `services-hdfs-native`, 
that the `fs.defaultFS` key reaches the client with its case. The `{"a": "1"}` 
case moves from `test_from_config_rejects_unsupported_values` to these 
acceptance tests, as #9311 proposes. Each new test fails under a scratch 
mutation of the conversion: hand-built JSON without escaping, lowercased keys, 
`{}` lowered to `""`, insertion order instead of sorted keys, `str()` coercion 
of non-`str` members, accepting dicts inside lists and tuples, restoring the 
`Unsupported` dict branch, and dropping the repeated-key check.
   
   # Are there any user-facing changes?
   
   Yes. `from_config` accepts `dict[str, str]` for map options, so calls that 
raised `Unsupported` now build the operator. A dict given to a context or layer 
option that is not a map now reaches that component, which ignores an 
unrecognized field or fails with `ConfigInvalid`, instead of failing with 
`Unsupported` in the binding. `Operator(**kwargs)` and `from_uri(**kwargs)` are 
unchanged and take the JSON string.
   
   # Breaking changes
   
   # AI Usage Statement
   
   - Harness: Claude Code (in T3 Code)
   - Model: Claude Opus 5.5 (`claude-opus-5-5`)
   - Effort: max (planning), high (implementation), xhigh (orchestration and 
review)
   - Role: Planned the change, implemented it and its tests, ran the checks 
above, and drafted this description. The author reviewed them. The hdfs-native 
test runs only in builds with `services-hdfs-native`, which PR CI does not 
build. The optional check against a real HDFS cluster did not run; the 
hdfs-native test builds the real client offline.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to