Comments (6)
I believe your example of what you have to do only applies to enumerated fields where th valid values are pre-defined. For fields where the valid value only depends on the data type and range, there already is a simpler way, see the two examples from the SBE 1.0 spec:
<composite name="decimal32" >
<type name="mantissa" primitiveType="int32" />
<type name="exponent" primitiveType="int8"
presence="constant">-2</type>
</composite>
<type name="EurexMarketID" semanticType="Exchange"
primitiveType="char" length="4" description="MIC code"
presence="constant">XEUR</type>
Or are you suggesting to also have that capability on the field level, so that a given type can be a constant in one message and not a constant in another?
from fix-simple-binary-encoding.
The XML schema already supports constant values of fields. The spec says
Alternatively, fields may be specified as constant. In which case, the data is not sent on the wire, but may be treated as constants by applications.
and
presence=constant | The field has a constant value that need not be transmitted on the wire. Mutually exclusive with value attributes.
Two issues:
- The only examples of constants are for members of composite types, using a constant
<type>
, or values of an enum. We could add an example of a constant field as @billsegall suggested. - The description of
presence=constant
should be more specific to say "Mutually exclusive with attributes minValue, maxValue, and nullValue."
from fix-simple-binary-encoding.
On second thought, there is an issue with the XML schema that prevents constant field. The XML complexType fieldType
needs to have mixed="true"
to allow the value to be set in the contents of a <field>
XML element.
The memberType
used for member of a composite type already has this property, as do XML complex types enumType
, refType
, setType
, and simpleDataType
..
from fix-simple-binary-encoding.
I see this issue is still open. Any plans to support constants in message fields as @billsegall suggested?
The commented lines dont work today...
<sbe:message name="Constants" id="1" description="Constants">
<field id="1" name="constant1" type="SomeEnum" presence="constant" valueRef="SomeEnum.A"/>
<field id="2" name="constant2" type="uint8" presence="constant" valueRef="SomeEnum.A"/>
<!--<field id="3" name="constant3" type="uint8" presence="constant" value="1"/>-->
<!--<field id="4" name="constant4" type="uint8" presence="constant">1</field>-->
</sbe:message>
from fix-simple-binary-encoding.
@darthninja1 , using XMLSpy to validate the XML, I found that your last example is valid using the latest version 2.0 RC1 schema.
(schemaLocation elided)
<sbe:messageSchema xmlns:sbe="http://fixprotocol.io/2017/sbe" version="0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" >
<types>
<enum name="SomeEnum" encodingType="char">
<validValue name="A">A</validValue>
</enum>
</types>
<sbe:message name="Constants" id="1" description="Constants">
<field id="1" name="constant1" type="SomeEnum" presence="constant" valueRef="SomeEnum.A"/>
<field id="2" name="constant2" type="uint8" presence="constant" valueRef="SomeEnum.A"/>
<!--<field id="3" name="constant3" type="uint8" presence="constant" value="1"/>-->
<field id="4" name="constant4" type="uint8" presence="constant">1</field>
</sbe:message>
</sbe:messageSchema>
from fix-simple-binary-encoding.
If this is to be supported in 2.0 then we need clear rules of precedence. What if someone provides a valueRef
and provides the character data like in constant4
? Is it an error or is there precedence.
from fix-simple-binary-encoding.
Related Issues (20)
- Version 2 XML schema proposal HOT 1
- Invalid character in the v2-0-RC3\resources\xsd\sbe-2.0rc3.xsd HOT 1
- Possibly redundant "description" attrubute in the "semanticAttributes" attributeGroup HOT 5
- Decimal number representation for monetary amounts
- Version 2 RC schema does not allow semanticType on encoding types
- Clarify offset and length related types HOT 5
- How extension mechanism is supposed to work when dimension type is unknown? HOT 7
- Improve variadic-length field specification HOT 1
- Why is nullValue not allowed for required field? HOT 4
- Questions about common field attributes HOT 2
- How unique should message member's `id` be? HOT 3
- Why `symbolicName_t` is limited to 64 chars? HOT 3
- Can enum/set be optional? HOT 2
- Question: Forward compatibility between encoder code and schema version HOT 1
- Can `<field>` override presence of its type? HOT 2
- Schema extension mechanism violation
- SBE 2.0 features in 1.0 spec HOT 1
- Should `ref` use custom offset of the referred type?
- Better version constraints
- Ownership
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from fix-simple-binary-encoding.