fix: Schema declaration in message & record unresolved $ref#1488
fix: Schema declaration in message & record unresolved $ref#1488jfallows merged 8 commits intoaklivity:developfrom
$ref#1488Conversation
| public Set<String> unresolved() | ||
| { | ||
| Stream.of( | ||
| channels.unresolved(), | ||
| operations.unresolved(), | ||
| messages.unresolved(), | ||
| securitySchemes.unresolved(), | ||
| schemas.unresolved(), | ||
| messageTraits.unresolved(), | ||
| serverVariables.unresolved(), | ||
| correlationIds.unresolved()) | ||
| .forEach(unresolved::addAll); | ||
|
|
||
| return unresolved; |
There was a problem hiding this comment.
If this method is called more than once then unresolved refs will be added multiple times.
Suggest moving the instantiation of unresolved into the unresolved() method.
Perhaps rename method to unresolvedRefs().
There was a problem hiding this comment.
Alternatively, instead of instantiating and copying each list of individual unresolved refs into one larger collection, perhaps create unresolved collection up front (as you have done) and pass it into each sub resolver to use to collect unresolved refs, then this unresolved() method can just return unresolved without needing to copy.
| public Set<String> unresolved() | ||
| { | ||
| return resolver.unresolved(); | ||
| } | ||
|
|
There was a problem hiding this comment.
| public Set<String> unresolved() | |
| { | |
| return resolver.unresolved(); | |
| } | |
| public Set<String> unresolvedRefs() | |
| { | |
| return resolver.unresolvedRefs(); | |
| } | |
| "${composite}/http/create.pet/client", | ||
| "${asyncapi}/http/create.pet/server" | ||
| }) | ||
| public void shouldPublishEventUnresolvedRef() throws Exception |
There was a problem hiding this comment.
| public void shouldPublishEventUnresolvedRef() throws Exception | |
| public void shouldLogEventUnresolvedRef() throws Exception |
| public Set<String> unresolved() | ||
| { | ||
| return Stream.concat( | ||
| channels.unresolved().stream(), | ||
| messages.unresolved().stream()) | ||
| .collect(Collectors.toSet()); | ||
| } |
There was a problem hiding this comment.
See feedback in AsyncapiVIew about avoiding the copy for unresolved refs.
| public Set<String> unresolved() | ||
| { | ||
| return unresolved | ||
| .stream() | ||
| .map(r -> r.ref) | ||
| .collect(Collectors.toSet()); | ||
| } |
There was a problem hiding this comment.
See feedback in AsyncapiVIew about avoiding the copy for unresolved refs.
| if (value.containsKey("$ref")) | ||
| { | ||
| parser.next(); | ||
| AsyncapiSchemaItem asyncapiSchemaItem = new AsyncapiSchemaItem(); |
There was a problem hiding this comment.
| AsyncapiSchemaItem asyncapiSchemaItem = new AsyncapiSchemaItem(); | |
| AsyncapiSchemaItem schemaItem = new AsyncapiSchemaItem(); |
Fixes #1466