Skip to content

fix(abstractions): pass mypy --strict in request_information and the small modules - #805

Merged
Vincent Biret (baywet) merged 1 commit into
microsoft:mainfrom
HardMax71:fix/strict-typing-request-information
Oct 15, 2026
Merged

Vincent Biret (baywet) merged 1 commit into
microsoft:mainfrom
HardMax71:fix/strict-typing-request-information

Conversation

@HardMax71

Copy link
Copy Markdown
Contributor

Overview

Fifth item in #722. request_information, utils, headers_collection, multipart_body and base_request_configuration now pass mypy --strict, and errors in kiota_abstractions go from 20 to 7. The 7 left are in the serialization proxy factories, the next item.

BaseRequestConfiguration now extends RequestConfiguration[Any], which is what the bare base class meant before, so old generated code that subclasses it sees no change.

Adding types showed one bug: set_content_from_scalar with a list stored the None returned by write_collection_of_primitive_values in a writer attribute on the writer. It now only calls the method.

Related Issue

Part of #722.

Notes

Two small runtime changes:

  • url uses the raw URL from the path parameters only when it is a str, like the C# getter. BaseRequestBuilder only puts a str there.
  • lazy_import raises ValueError when the module spec has no loader, like its other checks, instead of the TypeError from LazyLoader.

Testing Instructions

  • mypy --strict kiota_abstractions in packages/abstractions shows only the 7 proxy factory errors, also with --python-version 3.10.
  • mypy kiota_abstractions, mypy validation in tests/validation, yapf -dr kiota_abstractions, pylint and pytest pass. mypy --strict kiota_http shows the same errors as on main.
  • The new test fails without the source change.

…small modules

Annotate request_information, utils, headers_collection, multipart_body and
base_request_configuration. BaseRequestConfiguration now extends
RequestConfiguration[Any], which is what the bare base class meant before.

The return type on _get_serialization_writer showed that
set_content_from_scalar stored the None returned by
write_collection_of_primitive_values in a `writer` attribute on the writer.
It now only calls the method.

url returns the raw URL from the path parameters only when it is a str, like
the C# getter. lazy_import raises ValueError when the module spec has no
loader, instead of the TypeError from LazyLoader. Part of microsoft#722.
Copilot AI balanced review requested due to automatic review settings October 15, 2026 13:55
@HardMax71
Max Azatian (HardMax71) requested a review from a team as a code owner October 15, 2026 13:55

This comment was marked as off-topic.

@sonarqubecloud

Copy link
Copy Markdown

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟢 Approval recommended

The focused changes match the stated scope, preserve existing contracts, and include regression coverage for the serialization fix.

0 open findings

🧠 Review effort: Balanced

@baywet Vincent Biret (baywet) left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks for the contribution!

@github-project-automation github-project-automation Bot moved this to In Progress 🚧 in Kiota Oct 15, 2026
@baywet
Vincent Biret (baywet) merged commit 7a50266 into microsoft:main Oct 15, 2026
63 checks passed
@github-project-automation github-project-automation Bot moved this from In Progress 🚧 to Done ✔️ in Kiota Oct 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done ✔️

Development

Successfully merging this pull request may close these issues.

3 participants