Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: 1.0.0-RC2 #199

Merged
merged 141 commits into from
May 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
141 commits
Select commit Hold shift + click to select a range
d31e556
feat(bindings): move bindings to root package
Pakisan Apr 20, 2024
66eb0ff
feat(websockets bindings): v3 use common bindings
Pakisan Apr 20, 2024
7ec4eaa
feat(bindings): use common ChannelBinding and ExtendableObject
Pakisan Apr 21, 2024
a031105
feat(bindings): use common MessageBinding
Pakisan Apr 21, 2024
5c8f7ac
feat(bindings): use common OperationBinding
Pakisan Apr 21, 2024
e277f02
feat(bindings): use common ServerBinding
Pakisan Apr 21, 2024
9c5f5ac
feat(websockets bindings): v2 use common bindings
Pakisan Apr 21, 2024
087ede7
docs(websockets bindings): JavaDoc
Pakisan Apr 21, 2024
3e33bec
feat(stomp bindings): use common STOMP bindings
Pakisan Apr 21, 2024
ed57b9c
feat(websockets bindings): v2 use common bindings
Pakisan Apr 21, 2024
4050dd8
feat(sqs bindings): use common SQS bindings
Pakisan Apr 21, 2024
a26e995
feat(solace bindings): use common Solace bindings
Pakisan Apr 21, 2024
95c2067
feat(sns bindings): use common SNS bindings
Pakisan Apr 21, 2024
429607a
feat(redis bindings): use common Redis bindings
Pakisan Apr 21, 2024
24e5ca4
feat(pulsar bindings): use common Pulsar bindings
Pakisan Apr 21, 2024
252b2e4
feat(nats bindings): use common NATS bindings
Pakisan Apr 21, 2024
031e940
feat(mqtt5 bindings): use common MQTT5 bindings
Pakisan Apr 21, 2024
65e9341
feat(mqtt bindings): use common MQTT bindings
Pakisan Apr 21, 2024
7a397f3
feat(mqtt bindings): use common MQTT bindings
Pakisan Apr 21, 2024
3d94ee2
feat(bindings): use common bindings
Pakisan Apr 22, 2024
3475966
feat(bindings): use common bindings deserializer
Pakisan Apr 22, 2024
83b2db9
test(bindings): AMQP common tests
Pakisan Apr 22, 2024
1275d1b
test(bindings): Anypoint MQ common tests
Pakisan Apr 22, 2024
72da5c5
test(bindings): Google Pub/Sub common tests
Pakisan Apr 24, 2024
d930c76
test(bindings): IBM MQ common tests
Pakisan Apr 24, 2024
e5d65d1
test(bindings): Kafka common tests
Pakisan Apr 24, 2024
4fa8c0c
test(bindings): Pulsar common tests
Pakisan Apr 24, 2024
fae349b
test(bindings): WebSockets common tests
Pakisan Apr 24, 2024
c47341f
test(bindings): HTTP common tests
Pakisan Apr 24, 2024
8064286
test(bindings): MQTT common tests
Pakisan Apr 24, 2024
b5b8480
test(bindings): NATS common tests
Pakisan Apr 24, 2024
8639cda
test(bindings): Solace common tests
Pakisan Apr 24, 2024
e0a09b1
test(bindings): Bindings common test resources
Pakisan Apr 24, 2024
4de37ef
test(bindings): MQTT5 common tests
Pakisan Apr 24, 2024
ce0f3aa
test(bindings): delete unused resources
Pakisan Apr 24, 2024
d29ad69
feat(bindings): WebSocket 0.1.0
Pakisan Apr 24, 2024
f72a2f0
feat(bindings): STOMP 0.1.0
Pakisan Apr 24, 2024
5d807b5
feat(bindings): Redis 0.1.0
Pakisan Apr 24, 2024
ee6d885
tests(bindings): STOMP 0.1.0
Pakisan Apr 24, 2024
64ebecb
tests(bindings): AMQP1 0.1.0
Pakisan Apr 25, 2024
718a49e
tests(bindings): AMQP 0.1.0, 0.2.0, 0.3.0
Pakisan Apr 26, 2024
0ed0b0a
tests(bindings): Anypoint MQ 0.0.1
Pakisan Apr 26, 2024
e2ddf5f
tests(bindings): Google Pub/Sub 0.1.0, 0.2.0
Pakisan Apr 27, 2024
e99fd01
tests(bindings): HTTP 0.1.0, 0.2.0, 0.3.0
Pakisan Apr 27, 2024
3d88804
tests(bindings): IBM MQ 0.1.0
Pakisan Apr 27, 2024
86a258e
tests(bindings): JMS 0.0.1
Pakisan Apr 27, 2024
e7e5745
tests(bindings): Mercure 0.1.0
Pakisan Apr 27, 2024
9857fa5
tests(bindings): NATS 0.1.0
Pakisan Apr 29, 2024
a38bb80
tests(bindings): Pulsar 0.1.0
Pakisan Apr 29, 2024
1383ad7
tests(bindings): SQS 0.1.0
Pakisan Apr 29, 2024
f9a0220
feat(bindings): all parent classes must be abstract
Pakisan Apr 29, 2024
989f5ee
feat(bindings): use parents in serde
Pakisan Apr 29, 2024
bcdce21
feat(bindings): Kafka 0.4.0
Pakisan Apr 29, 2024
9e6e2fd
feat(bindings): MQTT 0.1.0
Pakisan Apr 30, 2024
5d767df
feat(bindings): MQT5 0.2.0
Pakisan Apr 30, 2024
d203d00
feat(bindings): SNS 0.1.0
Pakisan Apr 30, 2024
52d627d
feat(bindings): Solace 0.3.0
Pakisan Apr 30, 2024
8e2c30e
feat(bindings): all parent classes must be abstract
Pakisan Apr 30, 2024
f5028f5
feat(bindings): use parents in serde
Pakisan Apr 30, 2024
5d6263a
feat(bindings): Bindings test suite
Pakisan Apr 30, 2024
d0733fa
test(bindings): AMQP1 test suite
Pakisan May 1, 2024
1554521
test(bindings): Redis test suite
Pakisan May 1, 2024
2c7a46e
test(bindings): STOMP test suite
Pakisan May 1, 2024
7a48b7e
test(bindings): WebSockets test suite
Pakisan May 1, 2024
9910e2d
test(bindings): remove bindingVersion from without version test resou…
Pakisan May 1, 2024
a90d26b
build: fix javadocs
Pakisan May 1, 2024
b5180ca
build: switch to Java 21 for testing and bump dependencies
Pakisan May 1, 2024
5a72a3d
feat(schemas): move Reference and ExtendableObject to schemas package
Pakisan May 1, 2024
3817514
feat(schemas): move Type to schemas package
Pakisan May 1, 2024
bcb6bc1
feat(schemas): move Json Schema to schemas package
Pakisan May 1, 2024
8914c1c
feat(schemas): move AsyncAPI Schema to schemas package
Pakisan May 1, 2024
a8f9d61
feat(schemas): move Avro Schema to schemas package
Pakisan May 1, 2024
d3b398a
feat(schemas): move Multi Format Schema to schemas package
Pakisan May 1, 2024
579c077
feat(schemas): move OpenAPI Schema to schemas package
Pakisan May 1, 2024
4992660
feat(schemas): move Jackson for Schemas to schemas package
Pakisan May 1, 2024
dffcae6
feat(schemas): use AsyncAPISchema instead of Schema
Pakisan May 1, 2024
2e42fad
feat(schemas): v2.6.0 use MultiFormatSchema - Message, MessageTrait a…
Pakisan May 2, 2024
6de09dc
test(schemas): move OpenAPI to schemas package
Pakisan May 2, 2024
3163a8b
test(schemas): move Avro to schemas package
Pakisan May 2, 2024
5e08f06
test(schemas): fix tests
Pakisan May 2, 2024
d279fa9
test(schemas): move Json Properties to schemas package
Pakisan May 2, 2024
1a33cc4
test(schemas): move Multi Format Schema to schemas package
Pakisan May 2, 2024
b87e57c
feat(schemas): Message's payload can hold Reference and OpenAPI, Asyn…
Pakisan May 3, 2024
b0f6995
feat(schemas): move OpenID security scheme
Pakisan May 5, 2024
ff4202a
feat(schemas): move API key security scheme
Pakisan May 5, 2024
fd3566a
feat(schemas): move HTTP security schemas
Pakisan May 5, 2024
195f588
feat(schemas): move OAuth2 security schemas
Pakisan May 5, 2024
2f58f62
feat(schemas): move security schemas
Pakisan May 5, 2024
39edf0b
feat(schemas): move v3 security schemas
Pakisan May 7, 2024
3a1948c
feat(schemas): move v2 security schemas
Pakisan May 7, 2024
6dde306
tests(schemas): move Json test resources
Pakisan May 7, 2024
d294fe1
tests(schemas): move Avro test resources
Pakisan May 7, 2024
bcd4908
tests(schemas): move OpenAPI test resources
Pakisan May 7, 2024
807fe80
tests(schemas): move Multi Format Schema test resources
Pakisan May 7, 2024
e7cb5b4
feat(schemas): move JsonSchema to json package
Pakisan May 8, 2024
5df71a9
feat(schemas): move AsyncAPI schemas to asyncapi
Pakisan May 9, 2024
f4c7ab8
docs: changelog
Pakisan May 9, 2024
90a0867
feat(bindings): SQS 0.2.0
Pakisan May 10, 2024
82f1122
feat(bindings): Solace 0.1.0, 0.2.0, 0.3.0, 0.4.0
Pakisan May 11, 2024
727ae27
feat(models): remove final from AsyncAPI.asyncapi field
Pakisan May 11, 2024
9b9d4f5
feat(bindings): SNS 0.1.0
Pakisan May 12, 2024
45923b4
feat(bindings): MQTT 5 0.1.0
Pakisan May 12, 2024
ea2fd39
feat(bindings): MQTT 0.2.0
Pakisan May 12, 2024
ec5ed6b
docs(bindings): MQTT 0.1.0
Pakisan May 12, 2024
4e912f4
feat(bindings): Kafka 0.1.0, 0.3.0, 0.5.0
Pakisan May 13, 2024
05ab92e
docs(bindings): package-info
Pakisan May 14, 2024
45b5ece
docs(bindings): docs
Pakisan May 14, 2024
0d27495
docs(bindings): AMQP docs
Pakisan May 14, 2024
8624390
docs(bindings): AMQP1 docs
Pakisan May 14, 2024
ba9d774
docs(bindings): Anypoint MQ docs
Pakisan May 14, 2024
793cc93
docs(bindings): Anypoint MQ docs
Pakisan May 14, 2024
485f4be
docs(bindings): Google Cloud Pub/Sub docs
Pakisan May 14, 2024
f7c0dfd
docs(bindings): HTTP docs
Pakisan May 14, 2024
95f826e
docs(bindings): IBM MQ docs
Pakisan May 14, 2024
ba7d396
docs(bindings): JMS docs
Pakisan May 14, 2024
f8f6ed3
docs(bindings): Mercure docs
Pakisan May 14, 2024
fcaf861
docs(bindings): NATS docs
Pakisan May 14, 2024
3596d19
docs(bindings): Pulsar and Redis docs
Pakisan May 14, 2024
3ed73ea
docs(bindings): Amazon SNS docs
Pakisan May 14, 2024
6a97c7e
docs(bindings): Solace docs
Pakisan May 14, 2024
02427b4
docs(bindings): Amazon SQS docs
Pakisan May 14, 2024
dcce9aa
docs(bindings): STOMP docs
Pakisan May 14, 2024
b7276dc
docs(bindings): WebSockets docs
Pakisan May 14, 2024
4aba884
docs(schemas): package-info for schemas and security schemas
Pakisan May 14, 2024
3aaab84
refactor(bindings): optimize imports
Pakisan May 14, 2024
69eb877
refactor(bindings): move SerDe classes to serde package
Pakisan May 14, 2024
622221e
refactor(bindings): move SerDe classes to serde package
Pakisan May 14, 2024
bc50264
refactor(bindings): remove unused classes
Pakisan May 14, 2024
f5b2975
refactor(bindings): use common SerDe for models + package-info
Pakisan May 14, 2024
ac626b0
refactor(schemas): optimize imports optimize imports - don't use wild…
Pakisan May 14, 2024
1ffc3bc
refactor(schemas): optimize imports - don't use wildcard
Pakisan May 14, 2024
f5a6a34
refactor(schemas): move SecuritySchemesDeserializer to schemas package
Pakisan May 14, 2024
9bbdcc8
refactor(models): remove unused classes
Pakisan May 14, 2024
cc2af7e
docs: update README
Pakisan May 14, 2024
4a5b633
build: test scope for org.jetbrains.kotlin:kotlin-test
Pakisan May 14, 2024
0fef1de
build: 1.0.0-RC2 CHANGELOG
Pakisan May 14, 2024
51167ab
docs: README
Pakisan May 15, 2024
c8b5e47
docs: README
Pakisan May 15, 2024
63dd63f
docs: README
Pakisan May 15, 2024
abefed3
release: 1.0.0-RC2
Pakisan May 16, 2024
ab800fd
docs: CHANGELOG
Pakisan May 16, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
The diff you're trying to view is too large. We only load the first 3000 changed files.
2 changes: 1 addition & 1 deletion .idea/kotlinc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions .sdkmanrc
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
java=8.0.362-amzn
maven=3.9.0
java=21.0.2-amzn
maven=3.9.6
33 changes: 33 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,39 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [1.0.0-RC2] - 2024-05-16

### Added

- AsyncAPI 2.6.0 message parses Avro, Json and OpenAPI schemas

### Changed

- Bindings were updated:
- AMQP: 0.1.0, 0.2.0, 0.3.0
- AMQP1: 0.1.0
- Anypoint MQ: 0.1.0
- Google Cloud Pub/Sub: 0.1.0, 0.2.0
- HTTP: 0.1.0, 0.2.0, 0.3.0, 0.4.0, 0.5.0
- IBM MQ: 0.1.0
- JMS: 0.0.1
- Apache Kafka: 0.1.0, 0.3.0, 0.4.0, 0.5.0
- Mercure: 0.1.0
- MQTT: 0.1.0, 0.2.0
- MQTT 5: 0.1.0, 0.2.0
- NATS: 0.1.0
- Apache Pulsar: 0.1.0
- Redis: 0.1.0
- Amazon SNS: 0.1.0
- Solace: 0.1.0, 0.2.0, 0.3.0, 0.4.0
- Amazon SQS: 0.1.0, 0.2.0
- STOMP: 0.1.0
- WebSockets: 0.1.0
- All schemas now are located in `schemas` package
- All bindings now are located in `bindings` package
- Bindings structure was changed. Each binding now holds `channel`, `server`, `message`, `operation` inside package
- Bindings now are common for v2 and v3 versions

## [1.0.0-RC] - 2024-04-20

### Added
Expand Down
72 changes: 67 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,7 @@
<h4 align="left">Building the future of event-driven architectures</h4>
<h6 align="left">We're on a mission to standardize message-based communication and increase interoperability of the different systems out there.</h6>

---
> ⚠️ This project doesn't support AsyncAPI 1.x
---

[![Version](https://img.shields.io/maven-central/v/com.asyncapi/asyncapi-core?logo=apache-maven)](https://central.sonatype.com/artifact/com.asyncapi/asyncapi-core/1.0.0-RC)
[![Version](https://img.shields.io/maven-central/v/com.asyncapi/asyncapi-core/1.0.0-RC2?logo=apache-maven)](https://central.sonatype.com/artifact/com.asyncapi/asyncapi-core/1.0.0-RC2)

## Overview
JVM-friendly bindings for AsyncAPI. It allows you to read or write specifications for your asynchronous API through code
Expand All @@ -16,9 +12,75 @@ Hints:
- If you are working with AsyncAPI specification in JetBrains IDE, check out our [AsyncAPI - IDEA plugin](https://github.com/asyncapi/jasyncapi-idea-plugin)
- If you are working with AsyncAPI specification in VSCode, check out our [AsyncAPI - VSCode plugin](https://github.com/asyncapi/vs-asyncapi-preview)

### Implemented AsyncAPI versions (3/8)

| Version | Implementation status |
|---------|-----------------------|
| 2.0.0 | ✅ |
| 2.1.0 | ❌ |
| 2.2.0 | ❌ |
| 2.3.0 | ❌ |
| 2.4.0 | ❌ |
| 2.5.0 | ❌ |
| 2.6.0 | ✅ |
| 3.0.0 | ✅ |

### Implemented AsyncAPI schemas (5/7)

| Protocol | Versions |
|------------------------------|-------------------------------------------------------------|
| AsyncAPI Multi Format Schema | 3.0.0 |
| AsyncAPI Schema | unified version |
| Avro Schema | 1.9.0, 1.9.1, 1.9.2, 1.10.0, 1.10.1, 1.10.2, 1.11.0, 1.11.1 |
| Json Schema | Draft-07 |
| OpenAPI Schema | 3.0.0, 3.0.1, 3.0.2, 3.0.3 |
| RAML 1.0 Schema | ❌ |
| Protocol Buffers | ❌ |

### Implemented AsyncAPI bindings (19/19)

| Protocol | Versions |
|----------------------|-----------------------------------|
| AMQP | 0.1.0, 0.2.0, 0.3.0 |
| AMQP1 | 0.1.0 |
| Anypoint MQ | 0.1.0 |
| Google Cloud Pub/Sub | 0.1.0, 0.2.0 |
| HTTP | 0.1.0, 0.2.0, 0.3.0, 0.4.0, 0.5.0 |
| IBM MQ | 0.1.0 |
| JMS | 0.0.1 |
| Apache Kafka | 0.1.0, 0.3.0, 0.4.0, 0.5.0 |
| Mercure | 0.1.0 |
| MQTT | 0.1.0, 0.2.0 |
| MQTT 5 | 0.1.0, 0.2.0 |
| NATS | 0.1.0 |
| Apache Pulsar | 0.1.0 |
| Redis | 0.1.0 |
| Amazon SNS | 0.1.0 |
| Solace | 0.1.0, 0.2.0, 0.3.0, 0.4.0 |
| Amazon SQS | 0.1.0, 0.2.0 |
| STOMP | 0.1.0 |
| WebSockets | 0.1.0 |

### Implemented AsyncAPI Security Schemas (12/12)
| Security Schema | Implementation status |
|-----------------------|-----------------------|
| API Key | ✅ |
| Asymmetric Encryption | ✅ |
| GSS-API | ✅ |
| HTTP | ✅ |
| HTTP API Key | ✅ |
| OAuth2 | ✅ |
| OpenID Connect | ✅ |
| Plain | ✅ |
| SCRAM-SHA-256 | ✅ |
| SCRAM-SHA-512 | ✅ |
| Symmetric Encryption | ✅ |
| User Password | ✅ |

## Known consumers:
- [Springwolf Core](https://github.com/springwolf/springwolf-core) - Automated documentation for async APIs built with Spring Boot
- [AsyncAPI Quarkus](https://github.com/quarkiverse/quarkus-asyncapi) - Generates AsyncAPIRegistry and configuration classes for Quarkus
- [Specmatic](https://specmatic.in) - Converts AsyncAPI specifications into executable contracts

## Known open specifications to check compatibility with:
- [x] [adeo-kafka-request-reply-asyncapi.yml](https://github.com/asyncapi/spec/blob/master/examples/adeo-kafka-request-reply-asyncapi.yml)
Expand Down
19 changes: 5 additions & 14 deletions asyncapi-core/README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
<h1 align="center">
<br>
<a href="https://asyncapi.org"><img src="../assets/logo.png" alt="AsyncAPI logo" height="80"></a>
</h1>
<h4 align="center">Building the future of event-driven architectures</h4>
<h6 align="center">We're on a mission to standardize message-based communication and increase interoperability of the different systems out there.</h6>
[![AsyncAPI Logo](../assets/logo.png)](https://www.asyncapi.com)

> ⚠️ This project doesn't support AsyncAPI 1.x
<h4 align="left">Building the future of event-driven architectures</h4>
<h6 align="left">We're on a mission to standardize message-based communication and increase interoperability of the different systems out there.</h6>

This submodule stores projection of AsyncAPI specification to java classes. Each class is being properly annotated with `jsr-305` annotations,
which allows to use it in null-safety languages like `kotlin` without extra headache.
Expand All @@ -14,7 +10,7 @@ which allows to use it in null-safety languages like `kotlin` without extra head
<dependency>
<groupId>com.asyncapi</groupId>
<artifactId>asyncapi-core</artifactId>
<version>1.0.0-EAP-2</version>
<version>1.0.0-RC2</version>
</dependency>
```

Expand All @@ -25,9 +21,4 @@ For manual working with AsyncAPI specification from java/kotlin code:

```kotlin
var asyncApi = objectMapper.readValue(model, AsyncAPI::class.java)
```

### Generating of AsyncAPI Specification while building:
For generating of AsyncAPI specification from hand-crafted AsyncAPI class at choosed build cycle step use one of implemented plugins:
* [Gradle plugin](../asyncapi-plugin/asyncapi-plugin-gradle)
* [Maven plugin](../asyncapi-plugin/asyncapi-plugin-maven)
```
8 changes: 2 additions & 6 deletions asyncapi-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<artifactId>asyncapi</artifactId>
<groupId>com.asyncapi</groupId>
<version>1.0.0-RC</version>
<version>1.0.0-RC2</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand All @@ -27,14 +27,10 @@
<scope>provided</scope>
</dependency>
<!-- Tests -->
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-stdlib-jdk8</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.module</groupId>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
package com.asyncapi.bindings;

import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.core.ObjectCodec;
import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.JsonDeserializer;
import com.fasterxml.jackson.databind.JsonNode;

import java.io.IOException;
import java.util.HashMap;
import java.util.Map;

/**
* Deserializes AsyncAPI bindings map.
*
* @author Pavel Bodiachevskii
* @since 1.0.0-RC2
*/
public abstract class BindingsMapDeserializer extends JsonDeserializer<Map<String, Object>> {

public abstract Object chooseKnownPojo(String bindingKey, JsonNode binding, ObjectCodec objectCodec) throws IOException;

@Override
public Map<String, Object> deserialize(
JsonParser p,
DeserializationContext ctxt
) throws IOException, JsonProcessingException {
ObjectCodec objectCodec = p.getCodec();
JsonNode node = objectCodec.readTree(p);

Map<String, Object> bindings = new HashMap<>();

node.fieldNames().forEachRemaining(
fieldName -> {
try {
bindings.put(fieldName, chooseKnownPojo(fieldName, node.get(fieldName), objectCodec));
} catch (IOException e) {
e.printStackTrace();
}
}
);

return bindings;
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package com.asyncapi.bindings;

import com.asyncapi.schemas.asyncapi.ExtendableObject;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.jetbrains.annotations.Nullable;

/**
* Describes protocol-specific definition for a channel.
* <p>
* This object MAY be extended with {@link ExtendableObject}.
*
* @see <a href="https://www.asyncapi.com/docs/reference/specification/v3.0.0#specificationExtensions">Specification Extensions</a>
* @see <a href="https://www.asyncapi.com/docs/reference/specification/v3.0.0#channelBindingsObject">Channel Binding</a>
* @author Pavel Bodiachevskii
* @since 1.0.0-RC2
*/
@Data
@EqualsAndHashCode(callSuper = true)
public class ChannelBinding extends ExtendableObject {

/**
* The version of this binding.
* <p>
* If omitted, 'latest' <b>MUST</b> be assumed.
*/
@Nullable
@JsonProperty("bindingVersion")
private String bindingVersion;

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
package com.asyncapi.bindings;

import com.asyncapi.bindings.amqp.AMQPChannelBinding;
import com.asyncapi.bindings.amqp1.AMQP1ChannelBinding;
import com.asyncapi.bindings.anypointmq.AnypointMQChannelBinding;
import com.asyncapi.bindings.googlepubsub.GooglePubSubChannelBinding;
import com.asyncapi.bindings.http.HTTPChannelBinding;
import com.asyncapi.bindings.ibmmq.IBMMQChannelBinding;
import com.asyncapi.bindings.jms.JMSChannelBinding;
import com.asyncapi.bindings.kafka.KafkaChannelBinding;
import com.asyncapi.bindings.mercure.MercureChannelBinding;
import com.asyncapi.bindings.mqtt.MQTTChannelBinding;
import com.asyncapi.bindings.mqtt5.MQTT5ChannelBinding;
import com.asyncapi.bindings.nats.NATSChannelBinding;
import com.asyncapi.bindings.pulsar.PulsarChannelBinding;
import com.asyncapi.bindings.redis.RedisChannelBinding;
import com.asyncapi.bindings.sns.SNSChannelBinding;
import com.asyncapi.bindings.solace.SolaceChannelBinding;
import com.asyncapi.bindings.sqs.SQSChannelBinding;
import com.asyncapi.bindings.stomp.STOMPChannelBinding;
import com.asyncapi.bindings.websockets.WebSocketsChannelBinding;
import com.asyncapi.schemas.asyncapi.Reference;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.core.ObjectCodec;
import com.fasterxml.jackson.databind.JsonNode;

import java.io.IOException;

/**
* Serializes channel bindings map.
*
* @author Pavel Bodiachevskii
* @since 1.0.0-RC2
*/
public class ChannelBindingsDeserializer extends BindingsMapDeserializer {

public Object chooseKnownPojo(String bindingKey, JsonNode binding, ObjectCodec objectCodec) throws IOException {
try (JsonParser jsonParser = binding.traverse(objectCodec)) {
if (binding.get("$ref" ) != null) {
return jsonParser.readValueAs(Reference.class);
}

switch (bindingKey) {
case "amqp": return jsonParser.readValueAs(AMQPChannelBinding.class);
case "amqp1": return jsonParser.readValueAs(AMQP1ChannelBinding.class);
case "anypointmq": return jsonParser.readValueAs(AnypointMQChannelBinding.class);
case "googlepubsub": return jsonParser.readValueAs(GooglePubSubChannelBinding.class);
case "http": return jsonParser.readValueAs(HTTPChannelBinding.class);
case "ibmmq": return jsonParser.readValueAs(IBMMQChannelBinding.class);
case "jms": return jsonParser.readValueAs(JMSChannelBinding.class);
case "kafka": return jsonParser.readValueAs(KafkaChannelBinding.class);
case "mercure": return jsonParser.readValueAs(MercureChannelBinding.class);
case "mqtt": return jsonParser.readValueAs(MQTTChannelBinding.class);
case "mqtt5": return jsonParser.readValueAs(MQTT5ChannelBinding.class);
case "nats": return jsonParser.readValueAs(NATSChannelBinding.class);
case "pulsar": return jsonParser.readValueAs(PulsarChannelBinding.class);
case "redis": return jsonParser.readValueAs(RedisChannelBinding.class);
case "sns": return jsonParser.readValueAs(SNSChannelBinding.class);
case "solace": return jsonParser.readValueAs(SolaceChannelBinding.class);
case "sqs": return jsonParser.readValueAs(SQSChannelBinding.class);
case "stomp": return jsonParser.readValueAs(STOMPChannelBinding.class);
case "ws": return jsonParser.readValueAs(WebSocketsChannelBinding.class);
default: return null;
}
}
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package com.asyncapi.bindings;

import com.asyncapi.schemas.asyncapi.ExtendableObject;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.jetbrains.annotations.Nullable;

/**
* Describes AsyncAPI message binding.
* <p>
* This object MAY be extended with {@link ExtendableObject}.
*
* @see <a href="https://www.asyncapi.com/docs/reference/specification/v3.0.0#specificationExtensions">Specification Extensions</a>
* @see <a href="https://www.asyncapi.com/docs/reference/specification/v3.0.0#messageBindingsObject">Message Binding</a>
* @author Pavel Bodiachevskii
* @since 1.0.0-RC2
*/
@Data
@EqualsAndHashCode(callSuper = true)
public class MessageBinding extends ExtendableObject {

/**
* The version of this binding.
* <p>
* If omitted, 'latest' <b>MUST</b> be assumed.
*/
@Nullable
@JsonProperty("bindingVersion")
private String bindingVersion;

}
Loading
Loading