Skip to content

INTER-2250: Accept unknown enum values#200

Open
erayaydin wants to merge 6 commits into
mainfrom
fix/unknown-enum-values-inter-2250
Open

INTER-2250: Accept unknown enum values#200
erayaydin wants to merge 6 commits into
mainfrom
fix/unknown-enum-values-inter-2250

Conversation

@erayaydin

Copy link
Copy Markdown
Member

Summary

When the API introduces new enum values (e.g., a new proxy type), the SDK threw ValidationError during deserialization instead of accepting the value gracefully

When the API introduces new enum values, the SDK threw
`ApiException` or `ValidationError` during
deserialization instead of accepting the value gracefully.

Related-Task: INTER-2250
@erayaydin erayaydin requested a review from Copilot June 26, 2026 10:29
@erayaydin erayaydin self-assigned this Jun 26, 2026
@erayaydin erayaydin added the bug Something isn't working label Jun 26, 2026
@github-actions

github-actions Bot commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

☂️ Python Coverage

current status: ✅

Overall Coverage

Lines Covered Coverage Threshold Status
3201 2286 71% 0% 🟢

New Files

No new covered files...

Modified Files

File Coverage Status
fingerprint_server_sdk/models/bot_info.py 77% 🟢
fingerprint_server_sdk/models/bot_info_category.py 76% 🟢
fingerprint_server_sdk/models/bot_info_confidence.py 62% 🟢
fingerprint_server_sdk/models/bot_info_identity.py 64% 🟢
fingerprint_server_sdk/models/bot_result.py 90% 🟢
fingerprint_server_sdk/models/error_code.py 78% 🟢
fingerprint_server_sdk/models/incremental_identification_status.py 60% 🟢
fingerprint_server_sdk/models/proximity.py 75% 🟢
fingerprint_server_sdk/models/proxy_confidence.py 90% 🟢
fingerprint_server_sdk/models/proxy_details.py 75% 🟢
fingerprint_server_sdk/models/rare_device_percentile_bucket.py 92% 🟢
fingerprint_server_sdk/models/rule_action_type.py 60% 🟢
fingerprint_server_sdk/models/sdk.py 64% 🟢
fingerprint_server_sdk/models/search_events_bot.py 64% 🟢
fingerprint_server_sdk/models/search_events_bot_info.py 60% 🟢
fingerprint_server_sdk/models/search_events_incremental_identification_status.py 60% 🟢
fingerprint_server_sdk/models/search_events_rare_device_percentile_bucket.py 67% 🟢
fingerprint_server_sdk/models/search_events_sdk_platform.py 62% 🟢
fingerprint_server_sdk/models/search_events_vpn_confidence.py 62% 🟢
fingerprint_server_sdk/models/tampering_confidence.py 90% 🟢
fingerprint_server_sdk/models/vpn_confidence.py 90% 🟢
TOTAL 72% 🟢

updated for commit: fa66beb by action🐍

Use Union[Enum, str] return type and str(data) to satisfy mypy

Related-Task: INTER-2250

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR updates the SDK’s deserialization behavior so newly introduced API enum values don’t raise ValidationError and can be preserved instead.

Changes:

  • Add tests that assert unknown/new enum values are accepted and round-trip through model deserialization.
  • Loosen enum validation in generated models and deserialization, and introduce enum _missing_ handling for graceful unknown values.
  • Update OpenAPI generator templates so future generated code also accepts unknown enum values.

Reviewed changes

Copilot reviewed 27 out of 27 changed files in this pull request and generated 21 comments.

Show a summary per file
File Description
test/test_unknown_enum_values.py Adds regression tests for unknown enum values across several models/fields.
template/model_generic.mustache Removes strict enum validation logic from generated model validators.
template/model_enum.mustache Introduces enum template with _missing_ hook for unknown values.
template/api_client.mustache Changes enum deserialization behavior in the generated API client.
fingerprint_server_sdk/api_client.py Changes runtime enum deserialization behavior in ApiClient.
.changeset/accept-unknown-enum-values.md Adds a release-note style entry for the change.
fingerprint_server_sdk/models/vpn_confidence.py Adds _missing_ to accept unknown enum values.
fingerprint_server_sdk/models/tampering_confidence.py Adds _missing_ to accept unknown enum values.
fingerprint_server_sdk/models/search_events_vpn_confidence.py Adds _missing_ to accept unknown enum values.
fingerprint_server_sdk/models/search_events_sdk_platform.py Adds _missing_ to accept unknown enum values.
fingerprint_server_sdk/models/search_events_rare_device_percentile_bucket.py Adds _missing_ to accept unknown enum values.
fingerprint_server_sdk/models/search_events_incremental_identification_status.py Adds _missing_ to accept unknown enum values.
fingerprint_server_sdk/models/search_events_bot.py Adds _missing_ to accept unknown enum values.
fingerprint_server_sdk/models/search_events_bot_info.py Adds _missing_ to accept unknown enum values.
fingerprint_server_sdk/models/sdk.py Removes strict enum validation for platform.
fingerprint_server_sdk/models/rule_action_type.py Adds _missing_ to accept unknown enum values.
fingerprint_server_sdk/models/rare_device_percentile_bucket.py Adds _missing_ to accept unknown enum values.
fingerprint_server_sdk/models/proxy_details.py Removes strict enum validation for proxy_type.
fingerprint_server_sdk/models/proxy_confidence.py Adds _missing_ to accept unknown enum values.
fingerprint_server_sdk/models/proximity.py Removes strict enum validation for precision_radius.
fingerprint_server_sdk/models/incremental_identification_status.py Adds _missing_ to accept unknown enum values.
fingerprint_server_sdk/models/error_code.py Adds _missing_ to accept unknown enum values.
fingerprint_server_sdk/models/bot_result.py Adds _missing_ to accept unknown enum values.
fingerprint_server_sdk/models/bot_info.py Removes strict enum validation for identity and confidence.
fingerprint_server_sdk/models/bot_info_identity.py Adds _missing_ to accept unknown enum values.
fingerprint_server_sdk/models/bot_info_confidence.py Adds _missing_ to accept unknown enum values.
fingerprint_server_sdk/models/bot_info_category.py Adds _missing_ to accept unknown enum values.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread template/model_enum.mustache
Comment thread .changeset/accept-unknown-enum-values.md
Comment thread fingerprint_server_sdk/api_client.py Outdated
Comment thread template/api_client.mustache Outdated
Comment thread fingerprint_server_sdk/models/vpn_confidence.py
Comment thread fingerprint_server_sdk/models/search_events_sdk_platform.py
Comment thread fingerprint_server_sdk/models/search_events_bot_info.py
Comment thread fingerprint_server_sdk/models/search_events_bot.py

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 27 out of 27 changed files in this pull request and generated 1 comment.

Comment thread template/model_generic.mustache Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 27 out of 27 changed files in this pull request and generated 20 comments.

Comment thread fingerprint_server_sdk/api_client.py Outdated
Comment thread template/api_client.mustache Outdated
Comment thread template/model_enum.mustache
Comment thread fingerprint_server_sdk/models/vpn_confidence.py
Comment thread fingerprint_server_sdk/models/tampering_confidence.py
Comment thread fingerprint_server_sdk/models/search_events_bot.py
Comment thread fingerprint_server_sdk/models/search_events_bot_info.py
Comment thread fingerprint_server_sdk/models/bot_info_identity.py
Comment thread fingerprint_server_sdk/models/bot_info_confidence.py
Comment thread fingerprint_server_sdk/models/bot_info_category.py

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 27 out of 27 changed files in this pull request and generated 3 comments.

Comment thread template/model_enum.mustache Outdated
Comment thread fingerprint_server_sdk/api_client.py Outdated
Comment thread template/api_client.mustache Outdated
Use str(value) for \_name\_ in \_missing\_ so enum member names are
always strings.

Restore ValueError -> ApiException wrapping.

Related-Task: INTER-2250
@github-actions

Copy link
Copy Markdown
Contributor

🚀 Following releases will be created using changesets from this PR:

@fingerprint/python-sdk@9.3.1

Patch Changes

  • Accept unknown enum values gracefully instead of throwing errors during deserialization (5ef6b57)

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 25 out of 25 changed files in this pull request and generated no new comments.

@erayaydin erayaydin marked this pull request as ready for review June 26, 2026 14:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants