forked from springwolf/springwolf-core
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
POC for Polymorphism (springwolf#890)
* fix issue springwolf#874 * POC: adding polymorphism on payload * POC: adding polymorphism on payload * POC: refactoring for support for inline-schema's * POC: refactoring for support for inline-schema's * POC: refactoring for support for inline-schema's * feat(ui): update server model * feat(kafka): add ConsumerRecord to example * test(core): align test setup * test(core): minor changes * resolving pull-request remarks * chore: fixes after rebase * feat(core): extract types using extractableClasses * feat(ui): handle inline schemas * test(ui): update ui tests * feat(core): add inline schemas also add to schemas section to allow publishing * feat(ui): update mapping of example * feat(e2e): refactor publishing and simplify payloadName retrieval * feat(core): remove empty description * trim newline on yaml-file in kafka-test --------- Co-authored-by: David Beck <[email protected]>
- Loading branch information
Showing
80 changed files
with
849 additions
and
461 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
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
25 changes: 22 additions & 3 deletions
25
.../java/io/github/springwolf/core/asyncapi/scanners/common/payload/PayloadSchemaObject.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 |
---|---|---|
@@ -1,16 +1,35 @@ | ||
// SPDX-License-Identifier: Apache-2.0 | ||
package io.github.springwolf.core.asyncapi.scanners.common.payload; | ||
|
||
import io.github.springwolf.asyncapi.v3.model.schema.SchemaObject; | ||
import io.github.springwolf.asyncapi.v3.model.channel.message.MessageReference; | ||
import io.github.springwolf.asyncapi.v3.model.components.ComponentSchema; | ||
import jakarta.annotation.Nullable; | ||
|
||
/** | ||
* Encapsulates the resolved name for the contained schema. | ||
* | ||
* @param name The fully qualified name or the simple name of the schema. | ||
* @param simpleSchemaName | ||
* @param schema The SchemaObject. | ||
* @param schemaPayload The schema-payload to be inserted in the message, when not null this schema will override the payload of the message. | ||
*/ | ||
public record PayloadSchemaObject(String name, @Nullable SchemaObject schema) { | ||
public record PayloadSchemaObject(String name, String simpleSchemaName, @Nullable ComponentSchema schema) { | ||
public String title() { | ||
return schema != null ? schema.getTitle() : name(); | ||
return (simpleSchemaName() != null) ? simpleSchemaName() : name(); | ||
} | ||
|
||
public Object payload() { | ||
if (schema() != null) { | ||
if (schema().getSchema() != null) { | ||
return schema().getSchema(); | ||
} | ||
if (schema().getReference() != null) { | ||
return schema().getReference(); | ||
} | ||
if (schema().getMultiFormatSchema() != null) { | ||
return schema().getMultiFormatSchema(); | ||
} | ||
} | ||
return MessageReference.toSchema(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
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.