From 89322f8d7cc3a85c1946632c56afb82ffacff7fc Mon Sep 17 00:00:00 2001 From: I522722 Date: Fri, 30 Apr 2021 08:23:49 +0200 Subject: [PATCH] Explicitly define behavior for undefined and null values --- spec/asyncapi.md | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/spec/asyncapi.md b/spec/asyncapi.md index 71e48fe6d..147a037d9 100644 --- a/spec/asyncapi.md +++ b/spec/asyncapi.md @@ -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` ### Schema