Skip to content

Commit

Permalink
Replaced Springwolf-Core Message related classes by their Springwolf-…
Browse files Browse the repository at this point in the history
…AsyncAPI equivalent. (#527)

Fixes some FIXMEs and removes duplicated classes
  • Loading branch information
ctasada authored and timonback committed Jan 7, 2024
1 parent 5c93a35 commit b7ede27
Show file tree
Hide file tree
Showing 11 changed files with 45 additions and 157 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,7 @@ protected synchronized void initAsyncAPI() {
Map<String, ChannelObject> channels = channelsService.findChannels();

Components components = Components.builder()
// FIXME
// .schemas(schemasService.getDefinitions().entrySet().stream()
// .collect(Collectors.toMap(
// Map.Entry::getKey,
// entry -> ComponentSchema.of(entry.getValue())
// )))
.schemas(schemasService.getDefinitions())
.build();

AsyncAPI asyncAPI = AsyncAPI.builder()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

// import static io.github.stavshamir.springwolf.asyncapi.types.channel.operation.message.Message.DEFAULT_SCHEMA_FORMAT;

/**
* Annotation is mapped to {@link MessageObject}
*/
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,12 @@
import io.github.stavshamir.springwolf.asyncapi.scanners.channels.payload.PayloadClassExtractor;
import io.github.stavshamir.springwolf.asyncapi.scanners.classes.ClassScanner;
import io.github.stavshamir.springwolf.asyncapi.types.OperationData;
import io.github.stavshamir.springwolf.asyncapi.types.channel.operation.message.header.AsyncHeaders;
import io.github.stavshamir.springwolf.asyncapi.v3.model.channel.ChannelObject;
import io.github.stavshamir.springwolf.asyncapi.v3.model.channel.ServerReference;
import io.github.stavshamir.springwolf.asyncapi.v3.model.channel.message.MessageHeaders;
import io.github.stavshamir.springwolf.asyncapi.v3.model.channel.message.MessageObject;
import io.github.stavshamir.springwolf.asyncapi.v3.model.channel.message.MessageReference;
import io.github.stavshamir.springwolf.asyncapi.v3.model.info.Info;
import io.github.stavshamir.springwolf.asyncapi.v3.model.operation.Operation;
import io.github.stavshamir.springwolf.asyncapi.v3.model.server.Server;
Expand Down Expand Up @@ -140,7 +143,7 @@ void scan_componentHasListenerMethod() {
.description("SimpleFoo Message Description")
// .payload(PayloadReference.fromModelName(SimpleFoo.class.getSimpleName())) FIXME
// .schemaFormat(Message.DEFAULT_SCHEMA_FORMAT)
// .headers(HeaderReference.fromModelName(AsyncHeaders.NOT_DOCUMENTED.getSchemaName()))
.headers(MessageHeaders.of(MessageReference.fromSchema(AsyncHeaders.NOT_DOCUMENTED.getSchemaName())))
// FIXME
.bindings(EMPTY_MAP)
.build();
Expand Down Expand Up @@ -185,7 +188,7 @@ void scan_componentHasListenerMethodWithAllAttributes() {
.description(null)
// .schemaFormat(Message.DEFAULT_SCHEMA_FORMAT)
// .payload(PayloadReference.fromModelName(String.class.getSimpleName())) FIXME
// .headers(HeaderReference.fromModelName("TestSchema")) FIXME
.headers(MessageHeaders.of(MessageReference.fromSchema("TestSchema")))
.bindings(EMPTY_MAP)
.build();

Expand Down Expand Up @@ -221,7 +224,7 @@ void scan_componentHasMultipleListenerAnnotations() {
.title(SimpleFoo.class.getSimpleName())
// .payload(PayloadReference.fromModelName(SimpleFoo.class.getSimpleName())) FIXME
// .schemaFormat(Message.DEFAULT_SCHEMA_FORMAT)
// .headers(HeaderReference.fromModelName(AsyncHeaders.NOT_DOCUMENTED.getSchemaName()))
.headers(MessageHeaders.of(MessageReference.fromSchema(AsyncHeaders.NOT_DOCUMENTED.getSchemaName())))
// FIXME
.bindings(EMPTY_MAP);

Expand Down Expand Up @@ -267,7 +270,7 @@ void scan_componentHasAsyncMethodAnnotation() {
.description("Message description")
// .payload(PayloadReference.fromModelName(SimpleFoo.class.getSimpleName())) FIXME
// .schemaFormat("application/schema+json;version=draft-07")
// .headers(HeaderReference.fromModelName(AsyncHeaders.NOT_DOCUMENTED.getSchemaName()))
.headers(MessageHeaders.of(MessageReference.fromSchema(AsyncHeaders.NOT_DOCUMENTED.getSchemaName())))
// FIXME
.bindings(EMPTY_MAP)
.build();
Expand Down Expand Up @@ -378,7 +381,8 @@ void scan_componentHasOnlyDeclaredMethods(Class<?> clazz) {
// .payload(PayloadReference.fromModelName(String.class.getSimpleName())) FIXME
// .schemaFormat("application/vnd.oai.openapi+json;version=3.0.0")
//
// .headers(HeaderReference.fromModelName(AsyncHeaders.NOT_DOCUMENTED.getSchemaName())) FIXME
.headers(
MessageHeaders.of(MessageReference.fromSchema(AsyncHeaders.NOT_DOCUMENTED.getSchemaName())))
.bindings(EMPTY_MAP)
.build();

Expand Down Expand Up @@ -445,7 +449,8 @@ void scan_componentHasListenerMethodWithMetaAnnotation() {
// .payload(PayloadReference.fromModelName(String.class.getSimpleName())) FIXME
// .schemaFormat("application/vnd.oai.openapi+json;version=3.0.0")
//
// .headers(HeaderReference.fromModelName(AsyncHeaders.NOT_DOCUMENTED.getSchemaName())) FIXME
.headers(
MessageHeaders.of(MessageReference.fromSchema(AsyncHeaders.NOT_DOCUMENTED.getSchemaName())))
.bindings(EMPTY_MAP)
.build();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,15 @@

import io.github.stavshamir.springwolf.asyncapi.scanners.bindings.BindingFactory;
import io.github.stavshamir.springwolf.asyncapi.scanners.channels.payload.PayloadClassExtractor;
import io.github.stavshamir.springwolf.asyncapi.types.channel.operation.message.header.AsyncHeaders;
import io.github.stavshamir.springwolf.asyncapi.types.channel.operation.message.header.AsyncHeadersNotDocumented;
import io.github.stavshamir.springwolf.asyncapi.v3.bindings.ChannelBinding;
import io.github.stavshamir.springwolf.asyncapi.v3.bindings.MessageBinding;
import io.github.stavshamir.springwolf.asyncapi.v3.bindings.OperationBinding;
import io.github.stavshamir.springwolf.asyncapi.v3.model.channel.ChannelObject;
import io.github.stavshamir.springwolf.asyncapi.v3.model.channel.message.MessageHeaders;
import io.github.stavshamir.springwolf.asyncapi.v3.model.channel.message.MessageObject;
import io.github.stavshamir.springwolf.asyncapi.v3.model.channel.message.MessageReference;
import io.github.stavshamir.springwolf.asyncapi.v3.model.operation.Operation;
import io.github.stavshamir.springwolf.configuration.properties.SpringwolfConfigProperties;
import io.github.stavshamir.springwolf.schemas.DefaultSchemasService;
Expand Down Expand Up @@ -121,7 +124,8 @@ void scan_componentWithOneMethodLevelAnnotation() {
// .payload(PayloadReference.fromModelName(SimpleFoo.class.getSimpleName()))
// FIXME
//
// .headers(HeaderReference.fromModelName(AsyncHeadersNotDocumented.NOT_DOCUMENTED.getSchemaName()))
.headers(
MessageHeaders.of(MessageReference.fromSchema(AsyncHeaders.NOT_DOCUMENTED.getSchemaName())))
// FIXME
.bindings(TestBindingFactory.defaultMessageBinding)
.build();
Expand Down Expand Up @@ -167,7 +171,8 @@ void scan_componentWithMultipleRabbitHandlerMethods() {
// .payload(PayloadReference.fromModelName(SimpleFoo.class.getSimpleName()))
// FIXME
//
// .headers(HeaderReference.fromModelName(AsyncHeadersNotDocumented.NOT_DOCUMENTED.getSchemaName()))
.headers(
MessageHeaders.of(MessageReference.fromSchema(AsyncHeaders.NOT_DOCUMENTED.getSchemaName())))
// FIXME
.bindings(TestBindingFactory.defaultMessageBinding)
.build();
Expand All @@ -177,8 +182,8 @@ void scan_componentWithMultipleRabbitHandlerMethods() {
.title(String.class.getSimpleName())
// .payload(PayloadReference.fromModelName(String.class.getSimpleName())) FIXME
//
// .headers(HeaderReference.fromModelName(AsyncHeadersNotDocumented.NOT_DOCUMENTED.getSchemaName()))
// FIXME
.headers(
MessageHeaders.of(MessageReference.fromSchema(AsyncHeaders.NOT_DOCUMENTED.getSchemaName())))
.bindings(TestBindingFactory.defaultMessageBinding)
.build();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@
import io.github.stavshamir.springwolf.asyncapi.v3.bindings.amqp.AMQPMessageBinding;
import io.github.stavshamir.springwolf.asyncapi.v3.bindings.amqp.AMQPOperationBinding;
import io.github.stavshamir.springwolf.asyncapi.v3.model.channel.ChannelObject;
import io.github.stavshamir.springwolf.asyncapi.v3.model.channel.message.MessageHeaders;
import io.github.stavshamir.springwolf.asyncapi.v3.model.channel.message.MessageObject;
import io.github.stavshamir.springwolf.asyncapi.v3.model.channel.message.MessageReference;
import io.github.stavshamir.springwolf.asyncapi.v3.model.operation.Operation;
import io.github.stavshamir.springwolf.schemas.SchemasService;
import lombok.Data;
Expand Down Expand Up @@ -84,8 +86,7 @@ void scan_componentHasTestListenerMethods() {
.name(String.class.getName())
.title(String.class.getSimpleName())
// .payload(PayloadReference.fromModelName(String.class.getSimpleName())) FIXME
// .headers(HeaderReference.fromModelName(AsyncHeaders.NOT_DOCUMENTED.getSchemaName()))
// FIXME
.headers(MessageHeaders.of(MessageReference.fromSchema(AsyncHeaders.NOT_DOCUMENTED.getSchemaName())))
.bindings(defaultMessageBinding)
.build();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,14 @@

import io.github.stavshamir.springwolf.asyncapi.scanners.bindings.BindingFactory;
import io.github.stavshamir.springwolf.asyncapi.scanners.channels.payload.PayloadClassExtractor;
import io.github.stavshamir.springwolf.asyncapi.types.channel.operation.message.header.AsyncHeaders;
import io.github.stavshamir.springwolf.asyncapi.v3.bindings.ChannelBinding;
import io.github.stavshamir.springwolf.asyncapi.v3.bindings.MessageBinding;
import io.github.stavshamir.springwolf.asyncapi.v3.bindings.OperationBinding;
import io.github.stavshamir.springwolf.asyncapi.v3.model.channel.ChannelObject;
import io.github.stavshamir.springwolf.asyncapi.v3.model.channel.message.MessageHeaders;
import io.github.stavshamir.springwolf.asyncapi.v3.model.channel.message.MessageObject;
import io.github.stavshamir.springwolf.asyncapi.v3.model.channel.message.MessageReference;
import io.github.stavshamir.springwolf.asyncapi.v3.model.operation.Operation;
import io.github.stavshamir.springwolf.configuration.properties.SpringwolfConfigProperties;
import io.github.stavshamir.springwolf.schemas.DefaultSchemasService;
Expand Down Expand Up @@ -96,7 +99,8 @@ void scan_componentHasListenerMethod() {
// .payload(PayloadReference.fromModelName(SimpleFoo.class.getSimpleName()))
// FIXME
//
// .headers(HeaderReference.fromModelName(AsyncHeaders.NOT_DOCUMENTED.getSchemaName())) FIXME
.headers(
MessageHeaders.of(MessageReference.fromSchema(AsyncHeaders.NOT_DOCUMENTED.getSchemaName())))
.bindings(TestBindingFactory.defaultMessageBinding)
.build();

Expand Down Expand Up @@ -140,15 +144,17 @@ void scan_componentHasTestListenerMethods_multiplePayloads() {
// .payload(PayloadReference.fromModelName(SimpleFoo.class.getSimpleName()))
// FIXME
//
// .headers(HeaderReference.fromModelName(AsyncHeaders.NOT_DOCUMENTED.getSchemaName())) FIXME
.headers(
MessageHeaders.of(MessageReference.fromSchema(AsyncHeaders.NOT_DOCUMENTED.getSchemaName())))
.bindings(TestBindingFactory.defaultMessageBinding)
.build();
MessageObject messageString = MessageObject.builder()
.name(String.class.getName())
.title(String.class.getSimpleName())
// .payload(PayloadReference.fromModelName(String.class.getSimpleName())) FIXME
//
// .headers(HeaderReference.fromModelName(AsyncHeaders.NOT_DOCUMENTED.getSchemaName())) FIXME
.headers(
MessageHeaders.of(MessageReference.fromSchema(AsyncHeaders.NOT_DOCUMENTED.getSchemaName())))
.bindings(TestBindingFactory.defaultMessageBinding)
.build();

Expand Down Expand Up @@ -205,7 +211,8 @@ void scan_componentHasListenerMetaMethod() {
// .payload(PayloadReference.fromModelName(SimpleFoo.class.getSimpleName()))
// FIXME
//
// .headers(HeaderReference.fromModelName(AsyncHeaders.NOT_DOCUMENTED.getSchemaName())) FIXME
.headers(
MessageHeaders.of(MessageReference.fromSchema(AsyncHeaders.NOT_DOCUMENTED.getSchemaName())))
.bindings(defaultMessageBinding)
.build();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@
import io.github.stavshamir.springwolf.asyncapi.v3.bindings.amqp.AMQPMessageBinding;
import io.github.stavshamir.springwolf.asyncapi.v3.bindings.amqp.AMQPOperationBinding;
import io.github.stavshamir.springwolf.asyncapi.v3.model.channel.ChannelObject;
import io.github.stavshamir.springwolf.asyncapi.v3.model.channel.message.MessageHeaders;
import io.github.stavshamir.springwolf.asyncapi.v3.model.channel.message.MessageObject;
import io.github.stavshamir.springwolf.asyncapi.v3.model.channel.message.MessageReference;
import io.github.stavshamir.springwolf.asyncapi.v3.model.operation.Operation;
import io.github.stavshamir.springwolf.schemas.SchemasService;
import lombok.Data;
Expand Down Expand Up @@ -77,8 +79,7 @@ void scan_componentHasTestListenerMethods() {
.name(String.class.getName())
.title(String.class.getSimpleName())
// .payload(PayloadReference.fromModelName(String.class.getSimpleName())) FIXME
// .headers(HeaderReference.fromModelName(AsyncHeaders.NOT_DOCUMENTED.getSchemaName()))
// FIXME
.headers(MessageHeaders.of(MessageReference.fromSchema(AsyncHeaders.NOT_DOCUMENTED.getSchemaName())))
.bindings(defaultMessageBinding)
.build();

Expand Down
Loading

0 comments on commit b7ede27

Please sign in to comment.