Skip to content

Commit

Permalink
feat: merge additionalProperties schemas
Browse files Browse the repository at this point in the history
  • Loading branch information
abemedia authored Oct 14, 2024
1 parent 04881d3 commit 887f69a
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions gen/schema_gen_sum.go
Original file line number Diff line number Diff line change
Expand Up @@ -836,9 +836,12 @@ func mergeSchemes(s1, s2 *jsonschema.Schema) (_ *jsonschema.Schema, err error) {
case s1.AdditionalProperties == nil && s2.AdditionalProperties != nil:
r.AdditionalProperties = s2.AdditionalProperties
r.Item = s2.Item
case reflect.DeepEqual(s1.AdditionalProperties, s2.AdditionalProperties) && reflect.DeepEqual(s1.Item, s2.Item):
case reflect.DeepEqual(s1.AdditionalProperties, s2.AdditionalProperties):
r.AdditionalProperties = s1.AdditionalProperties
r.Item = s1.Item
r.Item, err = mergeSchemes(s1.Item, s2.Item)
if err != nil {
return nil, errors.Wrap(err, "merge additionalProperties schema")
}
case s1.AdditionalProperties != nil && s2.AdditionalProperties != nil:
return nil, &ErrNotImplemented{Name: "allOf additionalProperties merging"}
}
Expand Down

0 comments on commit 887f69a

Please sign in to comment.