Skip to content

Add extensibility to SBE XSD for custom tools #119

Open
@alexeq

Description

@alexeq

I'd like to discuss some possible ways to add extensibility to SBE schema.

SBE schema has its main purpose to define the protocol "on-the-wire". In addition it contains some additional features (namely 'package' attribute, 'semanticType' attribute, custom types for identifiers) for tools that use the schema to generate code, documentation, etc. What should developer do if provided means are not enough?

I see some possible ways to impement that:

  • Create new schema by extending SBE schema and extending SBE elements with custom elements and attributes (requires XSD proficiency, might be cumbersome - didn't research this approach)
  • Add external configuration file that refers to types, messages, fields defined in SBE XML file by name (e.g. "message.NewOrderSingle.javaInterface=com.my.sbe.MyBaseEncoderDecoder", "message.NewOrderSingle.docSection=Order Events" - I've seen some production projects using this approach to extend SBE)
  • Add wildcard elements to SBE XSD, allowing to extend it "in-place" (see below).

I suggest that we allow for some limited extensibility in SBE XSD by adding generic elements ('xs:anyAttribute', 'xs:any') to SBE XSD. Check https://www.ibm.com/developerworks/library/x-xtendschema/index.html, https://www.xml.com/pub/a/2004/10/27/extend.html, and
https://stackoverflow.com/questions/3347822/validating-xml-with-xsds-but-still-allow-extensibility discussion for additional links and info.

Adding 'xs:anyAttribute' with namespace="##other" would allow developers to extend SBE with custom attributes, e.g.:

<messageSchema xmlns="http://fixprotocol.io/2017/sbe" xmlns:my="http://mysbe.impl.com" ...>
    <!-- skipped -->
    <message name="NewOrderSingle" id="99" blockLength="54" semanticType="D"
        my:javaInterface="com.my.sbe.MyBaseEncoderDecoder" my:docSection="Order Events">
        <!-- skipped -->
    </message>
</messageSchema>

More research is need to explore what 'xs:any' might provide for extensibility (whether it's needed and whether it is backward-compatible with real-logic SBE implementation).

Summarizing, I think it would be great if SBE XSD would move to what http://www.xfront.com/ExtensibleContentModels.html defines as 'open content schema': one XML file to provide both "on-the-wire" SBE format using SBE XSD and "in-place" information for all other tools (code generators, documentation formatters, etc).

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions