Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extra attributes should be forbidden in nested Input models #809

Open
carl-baillargeon opened this issue Aug 30, 2024 · 1 comment
Open
Assignees
Milestone

Comments

@carl-baillargeon
Copy link
Contributor

Nested input models like class BgpAfi(BaseModel) don't inherit from AntaTest.Input meaning they don't forbid extra attributes. This could lead to unexpected behaviors for a user who wants to override a default value but accidently provides the wrong key.

BGP tests for example. If a user provides vrfs instead of vrf, ANTA will silently ignore vrfs and use the default value of vrf. An error should be raised to the user since vrfs is not supported.

@carl-baillargeon
Copy link
Contributor Author

carl-baillargeon commented Oct 31, 2024

Nested input models are being moved over to anta.input_models package (see #388) and model_config = ConfigDict(extra="forbid") should be added at the same time.

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

No branches or pull requests

3 participants