Skip to content

Allow unknown fields in Edge config models#418

Merged
timmarkhuff merged 5 commits intomainfrom
tim/edge-config-to-accept-unknown-fields
Mar 20, 2026
Merged

Allow unknown fields in Edge config models#418
timmarkhuff merged 5 commits intomainfrom
tim/edge-config-to-accept-unknown-fields

Conversation

@timmarkhuff
Copy link
Contributor

@timmarkhuff timmarkhuff commented Mar 20, 2026

To minimize potential breaking changes when a client uses a different version of the edge config than the edge-endpoint, we should allow unknown fields.

This changes means that the edge-endpoint will accept any fields it doesn't know about without raising exceptions, and then just ignore them, which is likely the best way of handling a version mismatch.

Copy link
Contributor

@CoreyEWood CoreyEWood left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, just a small suggestion for the test.

Comment on lines +238 to +241
def test_edge_endpoint_config_ignores_extra_top_level_fields():
"""Unknown fields are silently ignored for forward compatibility (Postel's Law)."""
config = EdgeEndpointConfig.model_validate({"global_config": {}, "unknown_field": True})
assert config.global_config == GlobalConfig()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To make this even more thorough, this could verify that extra fields within nested objects (e.g., inside global_config) are also ignored.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch. I have extended the test to check nested objects.

@timmarkhuff timmarkhuff merged commit 588406e into main Mar 20, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants