Skip to content

Commit 4b57479

Browse files
authored
Merge pull request #20 from json-structure/issue-18-extends-array
Allow $extends to accept an array of JSON Pointers for multiple inheritance
2 parents b2db20e + 10fdabf commit 4b57479

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

draft-vasters-json-structure-core.md

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1672,21 +1672,25 @@ is always `true`).
16721672

16731673
### The `$extends` Keyword {#extends-keyword}
16741674

1675-
The `$extends` keyword merges all properties from an abstract base type into the
1676-
extending type.
1675+
The `$extends` keyword merges all properties from one or more abstract base
1676+
types into the extending type.
16771677

16781678
If the type using `$extends` is marked as `abstract` and referenced via
16791679
`$addins`, the composite type _replaces_ the base type in the type model of the
16801680
document.
16811681

1682-
- **Value**: A JSON Pointer to an abstract type.
1682+
- **Value**: A JSON Pointer to an abstract type, or an array of JSON Pointers to
1683+
abstract types.
16831684
- **Rules**:
16841685
- The `$extends` keyword MUST only be used in schemas of type `object` and
16851686
`tuple`.
1686-
- The value of `$extends` MUST be a valid JSON Pointer that points to an
1687-
abstract type within the same document.
1688-
- The extending type MUST merge the abstract types properties and constraints
1687+
- The value of `$extends` MUST be a valid JSON Pointer or an array of valid
1688+
JSON Pointers that point to abstract types within the same document.
1689+
- The extending type MUST merge the abstract type's properties and constraints
16891690
and MUST NOT redefine any inherited property.
1691+
- When multiple base types are specified, properties are merged in array
1692+
order. If multiple base types define a property with the same name, the
1693+
property from the first base type in the array takes precedence.
16901694

16911695
### The `$offers` Keyword {#offers-keyword}
16921696

0 commit comments

Comments
 (0)