Skip to content

Generate top-level array schemas typed lists - #213

Merged
erayaydin merged 1 commit into
api-v3from
fix/array-schema-empty-models
Aug 5, 2026
Merged

Generate top-level array schemas typed lists#213
erayaydin merged 1 commit into
api-v3from
fix/array-schema-empty-models

Conversation

@erayaydin

@erayaydin erayaydin commented Aug 5, 2026

Copy link
Copy Markdown
Member

Problem

Top-level type: array schemas in the OpenAPI spec are generated as empty model classes with no swagger_types and no parent information. So their items are never deserialized into the proper item model:

  • GeolocationSubdivisions is generated as an empty BaseModel subclass.

Fix

Fix the root cause in the templates so it covers every array schema, current and future (like for Labels in #210):

  • Check {{#isArrayModel}} variable and generate array schemas as a list subclass with parent (__parent_class__) and list item type (__list_item_type__) information.
  • Deserializer now handles the 'list' parent by deserializing each element into the item type and returning the list-subclass instance.

@erayaydin
erayaydin requested a review from Copilot August 5, 2026 07:47
@erayaydin erayaydin self-assigned this Aug 5, 2026
@erayaydin erayaydin added the bug Something isn't working label Aug 5, 2026
@github-actions

github-actions Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

☂️ Python Coverage

current status: ✅

Overall Coverage

Lines Covered Coverage Threshold Status
6016 5076 84% 0% 🟢

New Files

No new covered files...

Modified Files

File Coverage Status
fingerprint_pro_server_api_sdk/api_client.py 66% 🟢
fingerprint_pro_server_api_sdk/models/geolocation_subdivisions.py 100% 🟢
TOTAL 83% 🟢

updated for commit: 8dd9ef4 by action🐍

@github-actions

github-actions Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

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

fingerprint-pro-server-api-python-sdk@8.13.1

Patch Changes

  • events: Fix parsing of GeolocationSubdivisions so subdivisions returns a typed list of GeolocationSubdivision (8dd9ef4)

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 generation/deserialization pipeline so OpenAPI top-level type: array schemas are represented as typed list subclasses (rather than empty BaseModel subclasses), enabling correct per-item deserialization (e.g., GeolocationSubdivisions → list of GeolocationSubdivision).

Changes:

  • Generate array-schema models as list subclasses with __parent_class__ = 'list' and __list_item_type__.
  • Extend the deserializer to recognize list-backed models and deserialize each element into the declared item type.
  • Add/extend tests to assert correct typed-list behavior and serialization of list-of-models.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
test/test_fingerprint_api.py Adds an integration-style assertion that subdivisions is deserialized into a typed GeolocationSubdivisions list containing GeolocationSubdivision items.
test/test_base_model.py Adds coverage ensuring BaseModel.to_dict() correctly serializes list attributes containing models (and mixed primitives).
template/model.mustache Updates model generation so array schemas become list subclasses and embed list-item typing metadata.
template/api_client.mustache Updates template deserializer to support list-backed models by deserializing each element into the configured item type.
fingerprint_pro_server_api_sdk/models/geolocation_subdivisions.py Regenerates GeolocationSubdivisions as a list subclass with item-type metadata.
fingerprint_pro_server_api_sdk/api_client.py Applies the runtime deserializer update for list-backed models in the shipped SDK.
.changeset/fix-array-schema-deserialization.md Adds a patch changeset entry describing the behavior fix for GeolocationSubdivisions.

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

Comment thread template/api_client.mustache
Comment thread fingerprint_pro_server_api_sdk/api_client.py
@erayaydin
erayaydin marked this pull request as ready for review August 5, 2026 07:52
@erayaydin
erayaydin merged commit fee5c83 into api-v3 Aug 5, 2026
22 checks passed
@erayaydin
erayaydin deleted the fix/array-schema-empty-models branch August 5, 2026 07:57
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.

3 participants