Skip to content

Commit

Permalink
Merge pull request #21 from Ultimaker/CS-1097/ignore-spec-generation-…
Browse files Browse the repository at this point in the history
…if-enum-item-not-string

CS-1097 Ignore spec generation if Enum items are not strings
  • Loading branch information
Xiaozhou Li authored Aug 25, 2020
2 parents 6c2aef1 + 1a106a5 commit 0460bbc
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion jsonmodels/builders.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ def is_root(self):
return not bool(self.parent)


def _apply_validators_modifications(field_schema, field):
def _apply_validators_modifications(field_schema, field): # noqa: ignore=C901
for validator in field.validators:
try:
validator.modify_schema(field_schema)
Expand All @@ -142,6 +142,10 @@ def _apply_validators_modifications(field_schema, field):
validator.modify_schema(field_schema["items"])
except AttributeError:
pass
except TypeError:
# CS-1097 ignore the cases in which the items are not strings,
# until OpenAPI spec supports generating non-string Enum items
pass


class PrimitiveBuilder(Builder):
Expand Down

0 comments on commit 0460bbc

Please sign in to comment.