msgraph-sdk-python icon indicating copy to clipboard operation
msgraph-sdk-python copied to clipboard

DetailsRequestBuilder returns the same instance for request configuration

Open Spaider opened this issue 2 years ago • 0 comments

I'm not sure if this supposed to work like this. Consider the following code snippet:

from msgraph.generated.planner.plans.item.details.details_request_builder import DetailsRequestBuilder as PlanDetailsRequestBuilder
from msgraph.generated.planner.tasks.item.details.details_request_builder import DetailsRequestBuilder as TaskDetailsRequestBuilder

plan_config1 = PlanDetailsRequestBuilder.DetailsRequestBuilderPatchRequestConfiguration()
plan_config1.headers.add('If-Match', 'some-value1')

plan_config2 = PlanDetailsRequestBuilder.DetailsRequestBuilderPatchRequestConfiguration()
plan_config2.headers.add('If-Match', 'some-value2')

task_config = TaskDetailsRequestBuilder.DetailsRequestBuilderPatchRequestConfiguration()

print(task_config.headers.get('If-Match'))
print(plan_config1 == plan_config2)

the printed output is like this:

{'some-value1', 'some-value2'}
True

Which means request configuration always returns the same instance. This makes it error-prone if some one wants to use it several times or from different places.

Spaider avatar Dec 19 '23 11:12 Spaider