Generate top-level array schemas typed lists - #213
Merged
Conversation
Contributor
☂️ Python Coverage
Overall Coverage
New FilesNo new covered files... Modified Files
|
erayaydin
force-pushed
the
fix/array-schema-empty-models
branch
from
August 5, 2026 07:49
e4c2670 to
8dd9ef4
Compare
Contributor
🚀 Following releases will be created using changesets from this PR:fingerprint-pro-server-api-python-sdk@8.13.1Patch Changes
|
Contributor
There was a problem hiding this comment.
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
listsubclasses 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.
erayaydin
marked this pull request as ready for review
August 5, 2026 07:52
TheUnderScorer
approved these changes
Aug 5, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Top-level
type: arrayschemas in the OpenAPI spec are generated as empty model classes with noswagger_typesand no parent information. So their items are never deserialized into the proper item model:GeolocationSubdivisionsis generated as an emptyBaseModelsubclass.Fix
Fix the root cause in the templates so it covers every array schema, current and future (like for
Labelsin #210):{{#isArrayModel}}variable and generate array schemas as alistsubclass with parent (__parent_class__) and list item type (__list_item_type__) information.'list'parent by deserializing each element into the item type and returning the list-subclass instance.