Skip to content

Commit

Permalink
JSON Schema: discard annotations during normalization
Browse files Browse the repository at this point in the history
  • Loading branch information
otto-ifak committed Aug 29, 2024
1 parent d523a0a commit 891564b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
13 changes: 12 additions & 1 deletion fences/json_schema/normalize.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,18 @@
@dataclass
class NormalizationConfig:
full_merge: bool = True
discard_fields: Set[str] = field(default_factory=set)
discard_fields: Set[str] = field(default_factory=lambda: {
'description',
'title',
'$comment',
'deprecated',
'example',
'examples',
'discriminator',
'default',
'readOnly',
'writeOnly',
})
additional_mergers: Dict[str, Merger] = field(default_factory=dict)
detect_duplicate_subschemas: bool = False

Expand Down
1 change: 0 additions & 1 deletion fences/open_api/generate.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,6 @@ def add(self, schema: any, is_body: bool) -> Samples:

norm_conf = NormalizationConfig(
full_merge=False,
discard_fields={"deprecated", "example", "discriminator"},
)
schema_norm = normalize_schema(schema, norm_conf)
config = json_schema.default_config()
Expand Down

0 comments on commit 891564b

Please sign in to comment.