Skip to content

Commit

Permalink
Add support for asyncapi 2.6.0 (#637)
Browse files Browse the repository at this point in the history
  • Loading branch information
EricWittmann authored May 29, 2023
1 parent aac6672 commit db63894
Show file tree
Hide file tree
Showing 8 changed files with 3,422 additions and 30 deletions.
2 changes: 2 additions & 0 deletions src/main/java/io/apicurio/datamodels/ModelTypeDetector.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ public static ModelType discoverModelType(ObjectNode json) {
return ModelType.ASYNCAPI24;
} else if (asyncapi.startsWith("2.5")) {
return ModelType.ASYNCAPI25;
} else if (asyncapi.startsWith("2.6")) {
return ModelType.ASYNCAPI26;
} else {
throw new RuntimeException("Unknown/unsupported AsyncAPI version: " + asyncapi);
}
Expand Down
4 changes: 4 additions & 0 deletions src/main/java/io/apicurio/datamodels/VisitorUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import io.apicurio.datamodels.models.asyncapi.v23.visitors.AsyncApi23Traverser;
import io.apicurio.datamodels.models.asyncapi.v24.visitors.AsyncApi24Traverser;
import io.apicurio.datamodels.models.asyncapi.v25.visitors.AsyncApi25Traverser;
import io.apicurio.datamodels.models.asyncapi.v26.visitors.AsyncApi26Traverser;
import io.apicurio.datamodels.models.openapi.v20.visitors.OpenApi20Traverser;
import io.apicurio.datamodels.models.openapi.v30.visitors.OpenApi30Traverser;
import io.apicurio.datamodels.models.openapi.v31.visitors.OpenApi31Traverser;
Expand Down Expand Up @@ -61,6 +62,9 @@ public static void visitTree(Node node, Visitor visitor, TraverserDirection dire
case ASYNCAPI25:
traverser = new AsyncApi25Traverser(visitor);
break;
case ASYNCAPI26:
traverser = new AsyncApi26Traverser(visitor);
break;
case OPENAPI20:
traverser = new OpenApi20Traverser(visitor);
break;
Expand Down
3 changes: 3 additions & 0 deletions src/main/java/io/apicurio/datamodels/util/ModelTypeUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ public static String getVersion(ModelType type) {
return "2.4.0";
case ASYNCAPI25:
return "2.5.0";
case ASYNCAPI26:
return "2.6.0";
case OPENAPI20:
return "2.0";
case OPENAPI30:
Expand Down Expand Up @@ -53,6 +55,7 @@ public static boolean isAsyncApiModel(Node node) {
case ASYNCAPI23:
case ASYNCAPI24:
case ASYNCAPI25:
case ASYNCAPI26:
return true;
default:
return false;
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ private boolean isValidSecurityRequirementName(String securityReqName, Document
return hasValue(doc31.getComponents()) &&
isDefined(doc31.getComponents()) &&
isDefined(doc31.getComponents().getSecuritySchemes().get(securityReqName));
} else if (dt == ModelType.ASYNCAPI20 || dt == ModelType.ASYNCAPI21 || dt == ModelType.ASYNCAPI22 || dt == ModelType.ASYNCAPI23 || dt == ModelType.ASYNCAPI24 || dt == ModelType.ASYNCAPI25) {
} else if (dt == ModelType.ASYNCAPI20 || dt == ModelType.ASYNCAPI21 || dt == ModelType.ASYNCAPI22 || dt == ModelType.ASYNCAPI23 || dt == ModelType.ASYNCAPI24 || dt == ModelType.ASYNCAPI25 || dt == ModelType.ASYNCAPI26) {
// TODO implement this
}
return false;
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/specs/asyncapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@ versions:
- $ref: ./asyncapi/asyncapi-2.3.yaml
- $ref: ./asyncapi/asyncapi-2.4.yaml
- $ref: ./asyncapi/asyncapi-2.5.yaml
- $ref: ./asyncapi/asyncapi-2.6.yaml

2,600 changes: 2,600 additions & 0 deletions src/main/resources/specs/asyncapi/asyncapi-2.6.0.md

Large diffs are not rendered by default.

Loading

0 comments on commit db63894

Please sign in to comment.