|
8 | 8 | import io.apicurio.datamodels.models.Node;
|
9 | 9 | import io.apicurio.datamodels.models.Referenceable;
|
10 | 10 | import io.apicurio.datamodels.models.asyncapi.AsyncApiMessage;
|
| 11 | +import io.apicurio.datamodels.models.asyncapi.v20.AsyncApi20Message; |
| 12 | +import io.apicurio.datamodels.models.asyncapi.v21.AsyncApi21Message; |
| 13 | +import io.apicurio.datamodels.models.asyncapi.v22.AsyncApi22Message; |
| 14 | +import io.apicurio.datamodels.models.asyncapi.v23.AsyncApi23Message; |
| 15 | +import io.apicurio.datamodels.models.asyncapi.v24.AsyncApi24Message; |
| 16 | +import io.apicurio.datamodels.models.asyncapi.v25.AsyncApi25Message; |
| 17 | +import io.apicurio.datamodels.models.asyncapi.v26.AsyncApi26Message; |
11 | 18 | import io.apicurio.datamodels.models.visitors.AllNodeVisitor;
|
12 | 19 | import io.apicurio.registry.content.TypedContent;
|
13 | 20 | import io.apicurio.registry.content.util.ContentTypeUtil;
|
@@ -72,14 +79,39 @@ protected void visitNode(Node node) {
|
72 | 79 | public void visitMessage(AsyncApiMessage node) {
|
73 | 80 | // Note: special handling of message payloads because data-models doesn't fully model the payload
|
74 | 81 | // yet.
|
75 |
| - JsonNode payload = node.getPayload(); |
| 82 | + JsonNode payload = getPayload(node); |
76 | 83 | if (payload != null && payload.has("$ref") && !payload.get("$ref").isNull()) {
|
77 | 84 | String ref = payload.get("$ref").asText();
|
78 | 85 | allReferences.add(ref);
|
79 | 86 | }
|
80 | 87 | super.visitMessage(node);
|
81 | 88 | }
|
82 | 89 |
|
| 90 | + private JsonNode getPayload(AsyncApiMessage node) { |
| 91 | + if (node instanceof AsyncApi20Message) { |
| 92 | + return ((AsyncApi20Message) node).getPayload(); |
| 93 | + } |
| 94 | + if (node instanceof AsyncApi21Message) { |
| 95 | + return ((AsyncApi21Message) node).getPayload(); |
| 96 | + } |
| 97 | + if (node instanceof AsyncApi22Message) { |
| 98 | + return ((AsyncApi22Message) node).getPayload(); |
| 99 | + } |
| 100 | + if (node instanceof AsyncApi23Message) { |
| 101 | + return ((AsyncApi23Message) node).getPayload(); |
| 102 | + } |
| 103 | + if (node instanceof AsyncApi24Message) { |
| 104 | + return ((AsyncApi24Message) node).getPayload(); |
| 105 | + } |
| 106 | + if (node instanceof AsyncApi25Message) { |
| 107 | + return ((AsyncApi25Message) node).getPayload(); |
| 108 | + } |
| 109 | + if (node instanceof AsyncApi26Message) { |
| 110 | + return ((AsyncApi26Message) node).getPayload(); |
| 111 | + } |
| 112 | + return null; |
| 113 | + } |
| 114 | + |
83 | 115 | }
|
84 | 116 |
|
85 | 117 | }
|
0 commit comments