chitralverma commented on PR #7883:
URL: https://github.com/apache/opendal/pull/7883#issuecomment-4942420195
On dict/TypedDict vs. a concrete config class — the tradeoff:
**Concrete class (current):**
- Scheme is bound to the *type*, not a key, so `from_config` can't be given
a mismatched service (`S3Config` is always s3). A `TypedDict` scheme would be a
settable key.
- Eager `TypeError` on unknown/misspelled fields at construction; a dict
accepts typos silently.
- Has a conversion boundary (`to_map`) for non-`str` inputs — `os.PathLike`,
and the special Duration/enum handling.
**TypedDict:**
- Simpler, no generated pyclass / `ConfigBuilder` / `__new__` rewrite;
matches obstore.
- But it's typing-only over a plain dict, so it loses the three points
above. And to type it on the constructor you need `Operator("s3",
**Unpack[S3Config])` per-scheme `@overload`s — which is the duplication #7824
removed.
The concrete class was chosen to keep scheme binding, construction-time
validation, and a place to convert rich inputs; the cost is the generated code
and the `__new__` stub rewrite.
--
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]