chitralverma opened a new issue, #9311:
URL: https://github.com/apache/opendal/issues/9311
### Feature Description
Let `Operator.from_config` and `AsyncOperator.from_config` take a `dict[str,
str]` for map-valued options such as `HdfsNativeConfig.options` and
`S3Config.assume_role_session_tags`. The generated `TypedDict`s already declare
these fields as `dict[str, str]`.
### Problem and Solution
Since #9262, core reads a map-valued option from a JSON object string. The
Python string entry points already work, because they pass strings through:
```python
opendal.Operator("s3", bucket="b", region="us-east-1",
assume_role_session_tags='{"Team":"x"}') # builds
```
`from_config` still rejects the type its own `TypedDict` declares:
```python
from opendal.config import S3Config
opendal.Operator.from_config(
S3Config(scheme="s3", bucket="b", region="us-east-1",
assume_role_session_tags={"Team": "x"})
)
# opendal.exceptions.Unsupported: a map-valued config field cannot be built
via from_config; leave it unset
```
Proposal: `from_config` converts a `dict` with `str` keys and values to the
JSON object string that core parses, using `serde_json` on the Rust side. Keys
keep their case. `{}` becomes `"{}"`, an explicit empty map, and a missing key
leaves the option unset. Non-`str` keys or values, other mapping types, and
dicts nested in lists still raise `Unsupported`. `Operator(**kwargs)` and
`from_uri(**kwargs)` keep taking strings.
### Additional Context
- Follow-up to #9261 (closed) and #9262. #9261 listed this as one of four
follow-ups.
- Checked against main (4ae8e6122) with `maturin develop -F
services-hdfs-native`. The `from_config` call above raises `Unsupported`, while
the JSON string builds the operator through `Operator(...)`, `from_uri`, and
`from_config`.
- `hdfs-native` with `name_node="default"` builds offline and shows whether
the map reaches the client with its key case. With `options` set to
`{"fs.defaultFS":"hdfs://127.0.0.1:9000"}`, the operator builds. With the key
lowercased, or with `{}`, building fails with `No fs.defaultFS setting found`.
### Are you willing to contribute to the development of this feature?
- [x] Yes, I am willing to contribute to the development of this feature.
*Drafted with AI assistance (Claude Code, Claude Opus 5.5) and reviewed by
the author.*
--
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]