Feature/protobuf runtime generation#145
Merged
bascunansalvador merged 28 commits intoJun 18, 2026
Merged
Conversation
Introduce shared message header analysis so generated Spring Kafka producers and consumers can use typed header DTOs when AsyncAPI message headers are defined. The Spring Kafka model preparation now carries header type metadata through the analyzer, payload model, Java/Kotlin factories, and templates. Generated producer and consumer APIs now include typed header parameters for messages with headers, while no-header messages keep the existing simpler signatures. Producer templates now map non-null typed header values into Kafka record headers, and consumer templates expose the generated header type in handler signatures. Add tests covering header analysis, Java Spring Kafka generation, and Kotlin Spring Kafka generation so typed header imports, method signatures, and producer header mapping remain stable.
Feature/kafka client contract
…eration Feature/protobuf java payload generation
Feature/external native schema files
64f9264
into
feature/protobuf-schema-artifacts
1 check passed
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
!! Experimental !!
Add type-safe spring-kafka API support for native Protobuf payloads.
Previously, the generator could emit native
.protoschema artifacts, but Spring Kafka client generation did not understand those payloads as usable API types. Protobuf payloads were still rejected by the generator compatibility checks, which meant generated producers, consumers, listeners, and handlers could not reference Protobuf message classes.The proposed solution adds a native Protobuf payload type resolver. It reads the
.protocontent from the AsyncAPI multi-format schema and resolves the Java type that generated Kafka APIs should use.For Protobuf payloads, the resolver uses
option java_packagewhen it is present. Ifjava_packageis not defined, it falls back to the Protobufpackage. The resolver also requiresoption java_multiple_files = true;, because that makes the Protobuf message available as a top-level Java type that generated Kafka APIs can reference directly.The
.protoschema must also contain a top-level message with the same name as the payload. If the schema is missing a usable package, missingjava_multiple_files = true, or missing the expected message declaration, the generator now fails with a domain-specific error that explains what must be fixed.Spring Kafka generation was updated to resolve native multi-format payloads through a shared
NativeKafkaPayloadResolver. This keeps native Avro and native Protobuf handling in one place before the Java and Kotlin generator factories build their producer, consumer, listener, and handler models.With this change, generated Spring Kafka APIs can now reference Protobuf payload types directly.