Skip to content

Keep custom field mappings local to each plugin - #1089

Open
galafis wants to merge 1 commit into
marshmallow-code:devfrom
galafis:fix-plugin-field-mapping-isolation
Open

galafis wants to merge 1 commit into
marshmallow-code:devfrom
galafis:fix-plugin-field-mapping-isolation

Conversation

@galafis

@galafis galafis commented Oct 24, 2026

Copy link
Copy Markdown

map_to_openapi_type() updates the class-level DEFAULT_FIELD_MAPPING dictionary, so overriding a field in one MarshmallowPlugin silently changes schemas produced by other plugin instances and by instances created later. Give each OpenAPIConverter its own copy of the configured mapping.

Add a regression that customizes a String subclass in one plugin and verifies that both an existing second plugin and a newly-created third plugin retain the default String mapping.

Validation on Python 3.12.14 / marshmallow 4.3.1: the regression fails before the fix because the second plugin unexpectedly reports integer/int32. The full suite after the fix has 637 passed and 6 skipped. Ruff lint/format and git diff --check pass.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant