Skip to content

Commit

Permalink
Merge pull request #199 from asyncapi/release/1.0.0-RC2
Browse files Browse the repository at this point in the history
build: 1.0.0-RC2
  • Loading branch information
Pakisan authored May 16, 2024
2 parents 94a3d16 + ab800fd commit 6ce6256
Show file tree
Hide file tree
Showing 3,365 changed files with 58,162 additions and 56,853 deletions.
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

0 comments on commit 6ce6256

Please sign in to comment.