Skip to content

Commit b3236ce

Browse files
committed
fix: JSONSchema 결과물에서 pattern 제외
1 parent a5de5c8 commit b3236ce

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

app/core/viewset/json_schema_viewset.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,12 @@ def get_json_schema(self) -> dict:
4646
"translation_fields": set(),
4747
}
4848

49+
for schema_field in result["schema"]["properties"].values():
50+
if "pattern" in schema_field:
51+
# Remove the pattern as python regex is not well compatible with javaScript regex.
52+
# TODO: FIXME: Add a compatibility layer for regex patterns.
53+
schema_field.pop("pattern", None)
54+
4955
if hasattr(serializer_class.Meta, "model") and "properties" in result["schema"]:
5056
model_fields = serializer_class.Meta.model._meta.fields
5157
model_m2m_fields = serializer_class.Meta.model._meta.many_to_many

0 commit comments

Comments
 (0)