Skip to content

Commit

Permalink
Explicitly define behavior for undefined and null values
Browse files Browse the repository at this point in the history
  • Loading branch information
Fannon committed Apr 30, 2021
1 parent 07ba172 commit 89322f8
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions spec/asyncapi.md
Original file line number Diff line number Diff line change
Expand Up @@ -143,13 +143,15 @@ By convention, the AsyncAPI Specification (A2S) file is named `asyncapi.json` or

When traits ([Operation Trait Object](#operationTraitObject) and [Message Trait Object](#messageTraitObject)) are defined, they MUST be merged into the target object according to the following rules:

* Traits are merged with a recursive merge algorithm:
* Traits are merged with a recursive merge algorithm, similar to [JSON Merge Patch](https://tools.ietf.org/html/rfc7386):
* Objects are merged recursively
* All other types (including arrays) are overwritten
* All other types (including arrays) are overwritten, with the following exceptions
* If the value of the source object is `undefined` it is not merged
* If the value of the source object is `null`, the target object property gets removed or set to `null`
* The target object that the trait is applied is the most specific and therefore is never overwritten, only extended.
* The order of the trait objects defines its specificity. Subsequent trait objects in the trait array are more specific.
* The resulting merge order is the following, with the most specific object to the right:
* `merge(trait1, trait2, trait3, ..., targetObject)`
* `trait1`, `trait2`, `trait3`, ..., `target object`

### <a name="schema"></a>Schema

Expand Down

0 comments on commit 89322f8

Please sign in to comment.