-
Notifications
You must be signed in to change notification settings - Fork 77
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
27 changed files
with
473 additions
and
78 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
springwolf-core/src/main/java/io/github/springwolf/core/controller/UiConfigController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// SPDX-License-Identifier: Apache-2.0 | ||
package io.github.springwolf.core.controller; | ||
|
||
import io.github.springwolf.core.asyncapi.grouping.AsyncApiGroupService; | ||
import lombok.RequiredArgsConstructor; | ||
import lombok.extern.slf4j.Slf4j; | ||
import org.springframework.http.MediaType; | ||
import org.springframework.web.bind.annotation.GetMapping; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
import java.util.List; | ||
|
||
@Slf4j | ||
@RestController | ||
@RequiredArgsConstructor | ||
public class UiConfigController { | ||
|
||
private final AsyncApiGroupService asyncApiGroupService; | ||
|
||
@GetMapping( | ||
path = {"${springwolf.path.base:/springwolf}/ui-config"}, | ||
produces = MediaType.APPLICATION_JSON_VALUE) | ||
public UiConfig getUiConfig() { | ||
return new UiConfig(asyncApiGroupService | ||
.getAsyncApiGroups() | ||
.map(el -> new UiConfig.UiConfigGroup(el.getGroupName())) | ||
.toList()); | ||
} | ||
|
||
private record UiConfig(List<UiConfigGroup> groups) { | ||
private record UiConfigGroup(String name) {} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
157 changes: 157 additions & 0 deletions
157
springwolf-examples/springwolf-kafka-example/src/test/resources/groups/vehicles.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,157 @@ | ||
{ | ||
"asyncapi": "3.0.0", | ||
"info": { | ||
"title": "Springwolf example project - Kafka", | ||
"version": "1.0.0", | ||
"description": "Springwolf example project to demonstrate springwolfs abilities, including **markdown** support for descriptions.", | ||
"contact": { | ||
"name": "springwolf", | ||
"url": "https://github.com/springwolf/springwolf-core", | ||
"email": "example@example.com" | ||
}, | ||
"license": { | ||
"name": "Apache License 2.0" | ||
}, | ||
"x-generator": "springwolf" | ||
}, | ||
"defaultContentType": "application/json", | ||
"servers": { | ||
"kafka-server": { | ||
"host": "kafka:29092", | ||
"protocol": "kafka" | ||
} | ||
}, | ||
"channels": { | ||
"vehicle-topic": { | ||
"address": "vehicle-topic", | ||
"messages": { | ||
"io.github.springwolf.examples.kafka.dtos.discriminator.VehicleBase": { | ||
"$ref": "#/components/messages/io.github.springwolf.examples.kafka.dtos.discriminator.VehicleBase" | ||
} | ||
}, | ||
"bindings": { | ||
"kafka": { | ||
"bindingVersion": "0.5.0" | ||
} | ||
} | ||
} | ||
}, | ||
"components": { | ||
"schemas": { | ||
"SpringKafkaDefaultHeaders-VehicleBase": { | ||
"title": "SpringKafkaDefaultHeaders-VehicleBase", | ||
"type": "object", | ||
"properties": { | ||
"__TypeId__": { | ||
"type": "string", | ||
"description": "Spring Type Id Header", | ||
"enum": [ | ||
"io.github.springwolf.examples.kafka.dtos.discriminator.VehicleBase" | ||
], | ||
"examples": [ | ||
"io.github.springwolf.examples.kafka.dtos.discriminator.VehicleBase" | ||
] | ||
} | ||
}, | ||
"examples": [ | ||
{ | ||
"__TypeId__": "io.github.springwolf.examples.kafka.dtos.discriminator.VehicleBase" | ||
} | ||
], | ||
"x-json-schema": { | ||
"$schema": "https://json-schema.org/draft-04/schema#", | ||
"properties": { | ||
"__TypeId__": { | ||
"description": "Spring Type Id Header", | ||
"enum": [ | ||
"io.github.springwolf.examples.kafka.dtos.discriminator.VehicleBase" | ||
], | ||
"type": "string" | ||
} | ||
}, | ||
"title": "SpringKafkaDefaultHeaders-VehicleBase", | ||
"type": "object" | ||
} | ||
}, | ||
"io.github.springwolf.examples.kafka.dtos.discriminator.VehicleBase": { | ||
"discriminator": "vehicleType", | ||
"title": "VehicleBase", | ||
"type": "object", | ||
"properties": { | ||
"powerSource": { | ||
"type": "string" | ||
}, | ||
"topSpeed": { | ||
"type": "integer", | ||
"format": "int32" | ||
}, | ||
"vehicleType": { | ||
"type": "string" | ||
} | ||
}, | ||
"description": "Demonstrates the use of discriminator for polymorphic deserialization (not publishable)", | ||
"examples": [ | ||
{ | ||
"powerSource": "string", | ||
"topSpeed": 0, | ||
"vehicleType": "string" | ||
} | ||
], | ||
"x-json-schema": { | ||
"$schema": "https://json-schema.org/draft-04/schema#", | ||
"description": "Demonstrates the use of discriminator for polymorphic deserialization (not publishable)", | ||
"properties": { | ||
"powerSource": { | ||
"type": "string" | ||
}, | ||
"topSpeed": { | ||
"format": "int32", | ||
"type": "integer" | ||
}, | ||
"vehicleType": { } | ||
}, | ||
"title": "VehicleBase", | ||
"type": "object" | ||
} | ||
} | ||
}, | ||
"messages": { | ||
"io.github.springwolf.examples.kafka.dtos.discriminator.VehicleBase": { | ||
"headers": { | ||
"$ref": "#/components/schemas/SpringKafkaDefaultHeaders-VehicleBase" | ||
}, | ||
"payload": { | ||
"schemaFormat": "application/vnd.aai.asyncapi+json;version=3.0.0", | ||
"schema": { | ||
"$ref": "#/components/schemas/io.github.springwolf.examples.kafka.dtos.discriminator.VehicleBase" | ||
} | ||
}, | ||
"name": "io.github.springwolf.examples.kafka.dtos.discriminator.VehicleBase", | ||
"title": "VehicleBase", | ||
"bindings": { | ||
"kafka": { | ||
"bindingVersion": "0.5.0" | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
"operations": { | ||
"vehicle-topic_receive_receiveExamplePayload": { | ||
"action": "receive", | ||
"channel": { | ||
"$ref": "#/channels/vehicle-topic" | ||
}, | ||
"bindings": { | ||
"kafka": { | ||
"bindingVersion": "0.5.0" | ||
} | ||
}, | ||
"messages": [ | ||
{ | ||
"$ref": "#/channels/vehicle-topic/messages/io.github.springwolf.examples.kafka.dtos.discriminator.VehicleBase" | ||
} | ||
] | ||
} | ||
} | ||
} |
1 change: 1 addition & 0 deletions
1
springwolf-examples/springwolf-kafka-example/src/test/resources/ui-config.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"groups":[{"name":"Only Vehicles"}]} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.