Skip to content

fix: Fix typing in examples and tests - #166

Merged
spanglerco merged 2 commits into
masterfrom
users/pspangle/fix-examples
Oct 22, 2025
Merged

spanglerco merged 2 commits into
masterfrom
users/pspangle/fix-examples

Conversation

@spanglerco

Copy link
Copy Markdown
Collaborator

What does this Pull Request accomplish?

Make mypy checking more strict for Pydantic models and fix or suppress the resulting errors.

Why should this Pull Request be merged?

I noticed that the DFS create_write_data example gets Pydantic validation errors at run-time because it passes numeric values instead of converting them to strings. This led me to discover that Pydantic's mypy plugin causes typing to be more permissive by default. Configuring it to be more strict resulted in 58 type errors, mostly typos that get normalized to the correct camelCase or using strings when other types were expected.

What testing has been done?

Verified all of the DFS examples work. I ran the Test Monitor steps example and it gets farther than it did before my change, but gets a 400 Bad Request. I intend to open a separate issue for that and an issue in the Asset Management assets example.

I temporarily set init_forbid_extra = True in the mypy.ini, which revealed a few other issues. However, the Test Monitor client uses extra fields, so I didn't leave that setting on. I suppose we could leave it on and add # type: ignore to the places we use extra fields, but I didn't try that.

Comment thread examples/assetmanagement/assets.py
Comment thread examples/assetmanagement/assets.py
Comment thread examples/dataframe/export_data.py
Comment thread examples/spec/update_and_delete_specs.py
Comment thread examples/test_plan/test_plans.py
Comment thread examples/testmonitor/steps.py
Comment thread examples/testmonitor/steps.py
Comment thread nisystemlink/clients/assetmanagement/_asset_management_client.py
@spanglerco
spanglerco marked this pull request as ready for review October 22, 2025 19:14
@spanglerco spanglerco changed the title chore: Fix typing in examples and tests fix: Fix typing in examples and tests Oct 22, 2025
@spanglerco
spanglerco merged commit 9a846e6 into master Oct 22, 2025
12 checks passed
@spanglerco
spanglerco deleted the users/pspangle/fix-examples branch October 22, 2025 20:03
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