From a2c3e4a2b0464de0db74a6b0e506ac3fa6066997 Mon Sep 17 00:00:00 2001 From: ghazi Date: Wed, 3 Dec 2025 08:51:40 +0100 Subject: [PATCH 1/2] update postprocessing hook to include the changes in drf-spectatcular 0.29 --- drf_standardized_errors/openapi_hooks.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/drf_standardized_errors/openapi_hooks.py b/drf_standardized_errors/openapi_hooks.py index 196580b..ae6ba31 100644 --- a/drf_standardized_errors/openapi_hooks.py +++ b/drf_standardized_errors/openapi_hooks.py @@ -2,6 +2,7 @@ # since it's a copy of drf-spectacular postprocessing hook import re from collections import defaultdict +from collections.abc import MutableMapping from drf_spectacular.hooks import postprocess_schema_enum_id_removal from drf_spectacular.plumbing import ( @@ -83,8 +84,8 @@ def extract_hash(schema): for component_name, props in iter_prop_containers(schemas): for prop_name, prop_schema in props.items(): if prop_schema.get("type") == "array": - prop_schema = prop_schema.get("items", {}) - if "enum" not in prop_schema: + prop_schema = prop_schema.get("items") + if not isinstance(prop_schema, MutableMapping) or "enum" not in prop_schema: continue prop_enum_cleaned_hash = extract_hash(prop_schema) @@ -138,9 +139,9 @@ def extract_hash(schema): for prop_name, prop_schema in props.items(): is_array = prop_schema.get("type") == "array" if is_array: - prop_schema = prop_schema.get("items", {}) + prop_schema = prop_schema.get("items") - if "enum" not in prop_schema: + if not isinstance(prop_schema, MutableMapping) or "enum" not in prop_schema: continue prop_enum_original_list = prop_schema["enum"] From 58060ebb7c1788a804751c82f32d641ef760d97e Mon Sep 17 00:00:00 2001 From: ghazi Date: Wed, 3 Dec 2025 08:54:54 +0100 Subject: [PATCH 2/2] set the min version of drf spectacular to 0.29 --- docs/changelog.md | 3 +++ pyproject.toml | 2 +- tox.ini | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/docs/changelog.md b/docs/changelog.md index 97792dc..acf9a02 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -8,6 +8,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ### Added - add support for python 3.14 +### Changed (backward-incompatible) +- set minimum version of drf-spectacular to 0.29.0 + ## [0.15.0] - 2025-06-09 ### Added - add support for python 3.13 diff --git a/pyproject.toml b/pyproject.toml index 0121aab..2b34e1a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -60,7 +60,7 @@ release = [ "tbump", ] openapi = [ - "drf-spectacular>=0.27.1", + "drf-spectacular>=0.29.0", "inflection", ] diff --git a/tox.ini b/tox.ini index c00d2ec..50e6fea 100644 --- a/tox.ini +++ b/tox.ini @@ -30,7 +30,7 @@ python = deps = pytest pytest-django - drf-spectacular>=0.27.1 + drf-spectacular>=0.29.0 django-filter dj32: Django>=3.2,<4.0 dj40: Django>=4.0,<4.1