Skip to content
This repository has been archived by the owner on Oct 14, 2024. It is now read-only.

Fix Enum serialization Python #265

Merged
merged 3 commits into from
Apr 11, 2024
Merged

Conversation

shemogumbe
Copy link
Contributor

@shemogumbe shemogumbe commented Apr 8, 2024

Fixes microsoftgraph/msgraph-sdk-python#480
Fixes microsoftgraph/msgraph-sdk-python#222

Overview

Currently - serializing an enum throws a KeyError if the key is not found in the Enum mapping

Related Issue

Fixes this and relates to this

Demo

Before
Value not available

After
after

@shemogumbe shemogumbe requested a review from a team as a code owner April 8, 2024 15:02
@sebastienlevert
Copy link

I just have a question here... Why is the enum not there in the first place? I'm confused?!

@andrueastman
Copy link
Member

I just have a question here... Why is the enum not there in the first place? I'm confused?!

@sebastienlevert I believe the fix here is made to align with other languages.

Essentially, the scenario here is when the API is updated, and your production code is running a certain version of a generated SDK. If the API starts returning a new value in the enumeration, your code should not start breaking due to exceptions/errors being thrown and break the application. Instead, the Enum property should be set to the default (null) till the time you update your code to handle the new value.

Copy link
Member

@andrueastman andrueastman left a comment

Choose a reason for hiding this comment

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

andrueastman
andrueastman previously approved these changes Apr 9, 2024
Copy link

sonarqubecloud bot commented Apr 9, 2024

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

@shemogumbe shemogumbe self-assigned this Apr 9, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
5 participants