Community Blog

Community Blog

CDM Code Generator Workshop Proves a Success

At the end of January, some of the brightest minds in the Capital Markets Fintech industry took part in a unique event that aimed to enhance the Common Domain Model (CDM).

2024-03-04 - CDM Code Generator Workshop Proves a Success -5

The purpose was to automate the generation of a valid JSON Schema from the CDM, and the output was nothing short of impressive:

  • 100+ test cases defined and successfully executed, proving that the generated JSON Schema was valid and an accurate representation of the CDM;
  • 756 JSON Schema files representing the entire CDM production version successfully generated...;
  • ... In under 5 seconds, meeting the performance expectations of a production compiler;
  • 1 production-grade contribution made to the CDM, whose every release includes a JSON Schema going forward;
  • 11 participants from 7 firms deserve praise for giving everything to achieve these results in a short time.

But First, a Quick CDM Primer

The CDM is a standardized, machine-readable, and machine-executable model that represents financial products and their trade lifecycle events.

It allows market participants to achieve consistency in the interpretation and implementation of pre- and post-trade requirements, by creating a digital representation of contracts and events across the lifecycle of financial transactions, while supporting the conversion to and from existing messaging standards.

The CDM brings significant benefits to market participants and regulators, including enhanced interoperability and straight-through processing, better regulatory oversight and an environment for innovation in financial markets.

To get involved and interact with the CDM Community visit here

The event

The two-day codefest was organised by the International Securities Lending Association (ISLA) in conjunction with REGnosys, Trading Apps and the Fintech Open-Source Foundation (FINOS).

Participants also included representatives from ISDA (International Swaps and Derivatives Association), London Reporting House, FIS, Sharegain, Broadridge and LSEG.

Teams worked together to define, code, test and document a major enhancement of the CDM’s infrastructure. Having a small group of participants allowed a hands-on approach to the workshop and promoted a collaborative working environment as the teams set about resolving a series of technical challenges. 

“I'm often surprised by how much gets done in hackathons, but this one blew it out of the park. I arrived mid-way through the second day to see hundreds of JSON schemas being generated, documents being parsed and tests passing. A real tour-de-force by the Regnosys and ISLA teams. Well done!” said Rob Moffat, FINOS Senior Technical Architect

The Goal

The goal for the group was to automate the translation of the CDM into a valid JSON Schema – a process called a Code Generator. 

The driver for the workshop was a real-world business case for a JSON Schema representation of the CDM that conforms to the draft 4 specification as defined by, and used by OpenAPI 3.0.3.

JSON is one of the most popular formats for exchanging data, and the JSON Schema is the vocabulary that enables JSON data consistency, validity and interoperability at scale. 

The resultant code and associated documentation would then be contributed back to the CDM github repository for use by the community.

The Tasks

The CDM is written in a richly expressive Domain-Specific Language called the Rosetta DSL.

The group adopted a test-driven approach that required three important elements: 

1. Source Data

The team needed to manufacture and peer-review Rosetta samples to demonstrate the most common constructs used in the CDM.

2. Target Data

The team also required JSON Schema samples that conform to the structures defined in the example Rosetta files. These were used to assert that the JSON Schema generated exactly matched the Rosetta definition. 

3. Prototyping Code Generators

The core of the workshop was to code the new code generator, using the source and target data samples for acceptance testing. 

CDM code generators require the use of Xtend, a flexible and expressive dialect of Java which is itself an extension to the Eclipse IDE (integrated development environment used in computer programming). 

New test functions were implemented to validate the JSON Schema created by the new Code Generator. These tests were used to confirm that:

  • The JSON Schema generated conforms to the draft 4 specification
  • JSON samples validate against the generated JSON Schema

To maximise the time and skillsets available, the participants split into two groups – one group worked on the Rosetta, JSON and schema examples, while the other worked on coding the new code generator and test functions. 

The Results

In the two days, participants defined over 100 test cases which were all successfully executed. This gave the group confidence that the JSON Schema being generated was valid against the JSON Schema draft 4 specification, as well as being an accurate representation of Rosetta.

As a final test, the code generator was run against the entire CDM production version (then 5.4.0). This processed 756 Rosetta files and successfully created 756 valid JSON Schema files in just under 5 seconds.

This meant the team successfully created a new code generator that can translate a Rosetta artefact into a JSON Schema that conforms to the required draft 4 specification.

This new code generator for the CDM was brought to production readiness and released a few days after the event in CDM version 5.5.0. All sample data, test cases and code have been contributed to the core CDM repository.

2024 is already off to a great start for the CDM and there's more in store including another production release later this year and many enterprise-grade implementations to be announced.

Stay tuned!

Interested in this FINOS open source project, or any of our other projects? Click the link below to see how to get involved in the FINOS Community.

Get Involved