Skip to content

Commit

Permalink
resolve nested $ref in schema (#1337)
Browse files Browse the repository at this point in the history
  • Loading branch information
ankitk-me authored Nov 27, 2024
1 parent bc34b23 commit 34c39ae
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
*/
package io.aklivity.zilla.runtime.binding.asyncapi.internal.model.resolver;

import static java.util.stream.Collectors.toMap;

import java.util.Map;
import java.util.Optional;
import java.util.regex.Pattern;
Expand Down Expand Up @@ -54,6 +56,12 @@ public AsyncapiSchema resolve(
resolved.items = resolve(resolved.items);
}

if (resolved.properties != null)
{
resolved.properties = resolved.properties.entrySet().stream()
.collect(toMap(Map.Entry::getKey, entry -> resolve(entry.getValue())));
}

return resolved;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,9 @@ catalogs:
petsCorrelationId:
location: '$message.header#/CorrelId'
schemas:
name:
type: string
description: Pet name.
petPayload:
type: object
properties:
Expand All @@ -91,8 +94,7 @@ catalogs:
minimum: 0
description: Pet id.
name:
type: string
description: Pet name.
$ref: '#/components/schemas/name'
tag:
type: string
description: Tag.
Expand Down

0 comments on commit 34c39ae

Please sign in to comment.