Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Rust] Updated code generator to resolve Issue #1028 #1037

Merged
merged 8 commits into from
Dec 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -653,6 +653,7 @@ tasks.register('generateRustTestCodecs', JavaExec) {
'sbe-tool/src/test/resources/issue972.xml',
'sbe-tool/src/test/resources/issue984.xml',
'sbe-tool/src/test/resources/issue987.xml',
'sbe-tool/src/test/resources/issue1028.xml',
'sbe-tool/src/test/resources/example-bigendian-test-schema.xml',
'sbe-tool/src/test/resources/nested-composite-name.xml',
]
Expand Down Expand Up @@ -866,7 +867,7 @@ tasks.register('generateGolangCodecs') {
'generateGolangFlyweightCodecTestComposite',
'generateGolangFlyweightCodecsWithXIncludes',
'generateGolangFlyweightCodecsWithXSD',
'generateIrCodecs',
'generateIrCodecs',
':sbe-all:jar'
}

Expand Down
1 change: 1 addition & 0 deletions rust/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ issue_895 = { path = "../generated/rust/issue895" }
issue_972 = { path = "../generated/rust/issue972" }
issue_984 = { path = "../generated/rust/issue984" }
issue_987 = { path = "../generated/rust/issue987" }
issue_1028 = { path = "../generated/rust/issue1028" }
baseline_bigendian = { path = "../generated/rust/baseline-bigendian" }
nested_composite_name = { path = "../generated/rust/nested-composite-name" }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1580,7 +1580,7 @@ private static void generateCompositeDecoder(
indent(out, 2, "offset: usize,\n");
indent(out, 1, "}\n\n");

final int version = tokens.stream().findFirst().get().version();
final int version = tokens.get(1).version(); // skip BEGIN_COMPOSITE
appendImplReaderForComposite(schemaVersionType, version, out, 1, decoderName);

// impl<'a, P> start
Expand Down
30 changes: 30 additions & 0 deletions sbe-tool/src/test/resources/issue1028.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<sbe:messageSchema
xmlns:ns2="http://www.fixprotocol.org/ns/simple/1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:sbe="http://fixprotocol.io/2016/sbe"
package="issue1028"
id="1028"
version="4"
semanticVersion="8.2.3"
description="B3 Binary Entrypoint FIXP messages"
byteOrder="littleEndian"
xsi:schemaLocation="http://fixprotocol.io/2016/sbe sbe.xsd">
<types>
<set name="EventIndicator" encodingType="uint8" description="Set of indicators for a given event. First use case: indicates possible retransmission of message during recovery process." sinceVersion="4">
<choice name="PossResend" description="1=Message is sent during recovery process, 0=Normal message.">0</choice>
</set>
<composite name="messageHeader" description="Message identifiers and length of message root.">
<type name="blockLength" primitiveType="uint16" description="Length of the root of the FIX message contained before repeating groups or variable/conditions fields."/>
<type name="templateId" primitiveType="uint16" description="Template ID used to encode the message."/>
<type name="schemaId" primitiveType="uint16" description="ID of the system publishing the message."/>
<type name="version" primitiveType="uint16" description="Schema version."/>
</composite>
<composite name="OutboundBusinessHeader" description="Header used for outbound business messages.">
<ref name="eventIndicator" type="EventIndicator" sinceVersion="4"/>
</composite>
</types>

<sbe:message name="ExecutionReport_New" id="200" description="Execution Report - New message is sent in response to a NewOrderSingle or SimpleNewOrder messages, or also from a restated iceberg order.">
<field name="businessHeader" type="OutboundBusinessHeader" id="35524" description="Common header to all outbound business messages."/>
</sbe:message>
</sbe:messageSchema>
Loading