Skip to content

Add support for struct (dict) discipline options#60

Merged
chrislupp merged 3 commits intodevelopfrom
feature/struct_opts
Apr 9, 2026
Merged

Add support for struct (dict) discipline options#60
chrislupp merged 3 commits intodevelopfrom
feature/struct_opts

Conversation

@chrislupp
Copy link
Copy Markdown
Collaborator

@chrislupp chrislupp commented Apr 9, 2026

Summary

  • Adds kStruct DataType support so disciplines can declare options that accept complex nested dictionaries, not just scalar types
  • Wires the new type through server (GetAvailableOptions), client (get_available_options), and OpenMDAO (declare_options) type mappings
  • Regenerates gRPC stubs from updated proto submodule
  • Closes Structs as options #49

Test plan

  • python utils/compile_proto.py — stubs regenerate without errors
  • pytest tests/ — all 169 tests pass, 100% coverage
  • Integration test: discipline with add_option("config", "dict") round-trips nested dict through gRPC client/server, verified via compute and partials

Add kStruct DataType to the protocol and wire it through the Python
stack so disciplines can declare and receive complex nested data as
options.

Changes:
- Update proto submodule (kStruct = 4 in DataType enum)
- Regenerate gRPC stubs
- Map "dict" ↔ kStruct in server and client type mappings
- Support dict type in OpenMDAO declare_options utility
- Add tests for struct option round-trip
- Update CHANGELOG
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 9, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@chrislupp chrislupp self-assigned this Apr 9, 2026
@chrislupp chrislupp added the enhancement New feature or request label Apr 9, 2026
@chrislupp chrislupp added this to the Version 0.8.0 milestone Apr 9, 2026
Adds a full end-to-end test that spins up a discipline with a dict
option, discovers it via GetAvailableOptions, sends a nested dict,
and verifies compute/partials use the struct values correctly.
@chrislupp chrislupp merged commit a8cf437 into develop Apr 9, 2026
8 checks passed
@chrislupp chrislupp deleted the feature/struct_opts branch April 9, 2026 01:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant