From ded61e8535f8aa907fbbb4ed7e3ca17dc19d476b Mon Sep 17 00:00:00 2001 From: paulleignac <99202215+paulleignac@users.noreply.github.com> Date: Thu, 21 Aug 2025 18:17:12 -0300 Subject: [PATCH 1/3] Add mapping of lengthId for fields of type data Fields of type data are supposed to be defined in orchestra XML with an attribute lengthId that points to the tag containing its length as value. The attribute lengthId was dropped when building the xml orchestra from the markdown and could be seen missing on expected tag (example: on field 96 RawData) --- .../md2orchestra/RepositoryBuilder.java | 24 ++++++++++++------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/md2orchestra/src/main/java/io/fixprotocol/md2orchestra/RepositoryBuilder.java b/md2orchestra/src/main/java/io/fixprotocol/md2orchestra/RepositoryBuilder.java index 6717d43..d618efd 100644 --- a/md2orchestra/src/main/java/io/fixprotocol/md2orchestra/RepositoryBuilder.java +++ b/md2orchestra/src/main/java/io/fixprotocol/md2orchestra/RepositoryBuilder.java @@ -168,13 +168,15 @@ private class FieldBuilder implements ElementBuilder { private final String scenario; private final BigInteger tag; private final String type; + private final BigInteger lengthId; public FieldBuilder(final BigInteger tag, final String name, final String scenario, - final String type) { + final String type, final BigInteger lengthId) { this.tag = tag; this.name = name; this.scenario = scenario; this.type = type; + this.lengthId = lengthId; } @Override @@ -217,6 +219,7 @@ public FieldType build() { fieldType.setId(baseFieldType.getId()); fieldType.setName(baseFieldType.getName()); fieldType.setType(baseFieldType.getType()); + fieldType.setLengthId(baseFieldType.getLengthId()); fieldType.setScenario(scenario); repositoryAdapter.addField(fieldType); } @@ -303,7 +306,7 @@ public GroupType build() { if (groupType != null) { FieldRefType numInGroupRef = groupType.getNumInGroup(); if (numInGroupRef != null) { - buildSteps.add(new FieldBuilder(numInGroupRef.getId(), null, DEFAULT_SCENARIO, "NumInGroup")); + buildSteps.add(new FieldBuilder(numInGroupRef.getId(), null, DEFAULT_SCENARIO, "NumInGroup", null)); } repositoryAdapter.copyGroup(groupType); } else { @@ -489,7 +492,7 @@ private void copyReferencedMembers(final List members, int currentDepth, FieldRefType numInGroupRef = group.getNumInGroup(); if (numInGroupRef != null) { buildSteps.add(new FieldBuilder(numInGroupRef.getId(), null, numInGroupRef.getScenario(), - "NumInGroup")); + "NumInGroup", null)); if (currentDepth <= maxDepth) { final List groupMembers = group.getComponentRefOrGroupRefOrFieldRef(); copyReferencedMembers(groupMembers, currentDepth + 1, maxDepth); @@ -1437,6 +1440,9 @@ private void addField(final GraphContext graphContext, final Context keyContext) case "type": field.setType(p.getValue()); break; + case "lengthId": + field.setLengthId(new BigInteger(p.getValue())); + break; case "values": final String values = p.getValue(); if (values != null && !values.isEmpty()) { @@ -1556,11 +1562,13 @@ private void addFieldAndType(final FieldType field) { final String scenario = field.getScenario(); final UnionDataTypeT unionDatatype = field.getUnionDataType(); final String unionType = unionDatatype != null ? unionDatatype.value() : null; - + final BigInteger lengthId = "data".equals(type) ? id.subtract(BigInteger.ONE) : null; + field.setLengthId(lengthId); + if (id == null) { - buildSteps.add(new FieldBuilder(BigInteger.ZERO, name, scenario, type)); + buildSteps.add(new FieldBuilder(BigInteger.ZERO, name, scenario, type, null)); } else if (name == null || type == null) { - buildSteps.add(new FieldBuilder(id, name, scenario, type)); + buildSteps.add(new FieldBuilder(id, name, scenario, type, lengthId)); } else { buildSteps.add(new TypeBuilder(type, scenario)); repositoryAdapter.addField(field); @@ -2233,7 +2241,7 @@ private FieldRefType populateFieldRef(final DetailTable.TableRow detail) { if (fieldRefType.getId() != null) { final FieldType fieldType = repositoryAdapter.findFieldByTag(fieldRefType.getId(), scenario); if (fieldType == null) { - buildSteps.add(new FieldBuilder(fieldRefType.getId(), name, scenario, null)); + buildSteps.add(new FieldBuilder(fieldRefType.getId(), name, scenario, null, null)); } } else { final FieldType fieldType = repositoryAdapter.findFieldByName(name, scenario); @@ -2241,7 +2249,7 @@ private FieldRefType populateFieldRef(final DetailTable.TableRow detail) { fieldRefType.setId(fieldType.getId()); } else { fieldRefType.setId(BigInteger.ZERO); - buildSteps.add(new FieldBuilder(BigInteger.ZERO, name, scenario, null)); + buildSteps.add(new FieldBuilder(BigInteger.ZERO, name, scenario, null, null)); buildSteps.add(new FieldRefBuilder(name, fieldRefType)); } } From adddd80d3c62b91a079b838dd741e874ca8ddedd Mon Sep 17 00:00:00 2001 From: paulleignac <99202215+paulleignac@users.noreply.github.com> Date: Thu, 21 Aug 2025 18:20:44 -0300 Subject: [PATCH 2/3] test fix for lengthId attribute on fields test that defining a tag of type data ensure he lengthId attribute is added to the xml file --- .../md2orchestra/RepositoryBuilderTest.java | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/md2orchestra/src/test/java/io/fixprotocol/md2orchestra/RepositoryBuilderTest.java b/md2orchestra/src/test/java/io/fixprotocol/md2orchestra/RepositoryBuilderTest.java index 3f26554..ff34708 100644 --- a/md2orchestra/src/test/java/io/fixprotocol/md2orchestra/RepositoryBuilderTest.java +++ b/md2orchestra/src/test/java/io/fixprotocol/md2orchestra/RepositoryBuilderTest.java @@ -1271,4 +1271,23 @@ void userDefinedFields() throws Exception { //System.out.println(errors); assertTrue(errors.contains("Unknown type for field")); } + + @Test + void dataFieldLengthId() throws Exception { + String text = + "## Fields\n" + + "\n" + + "| Name | Tag | Type | Values |\n" + + "|------------------|----:|--------------|--------------------------|\n" + + "| CustomRawData | 10060 | data | |\n"; + + InputStream inputStream = new ByteArrayInputStream(text.getBytes()); + RepositoryBuilder builder = RepositoryBuilder.instance(null , jsonOutputStream); + builder.appendInput(inputStream); + ByteArrayOutputStream xmlStream = new ByteArrayOutputStream(8096); + builder.write(xmlStream); + String xml = xmlStream.toString(); + assertTrue(xml.contains("lengthId=\"10059\"")); + builder.closeEventLogger(); + } } From 44c7bc88bb202b54e1c5bae07724446ef8f77c22 Mon Sep 17 00:00:00 2001 From: paulleignac <99202215+paulleignac@users.noreply.github.com> Date: Mon, 25 Aug 2025 12:17:46 -0300 Subject: [PATCH 3/3] bump jackson version Upgrade jackson version to remove vulnerability in dependency --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index e0b3f4f..e18b12e 100644 --- a/pom.xml +++ b/pom.xml @@ -63,7 +63,7 @@ UTF-8 4.8-1 1.4 - 2.13.4.1 + 2.19.2 11 5.9.1 2.19.0 @@ -198,4 +198,4 @@ - \ No newline at end of file +