-
Notifications
You must be signed in to change notification settings - Fork 517
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
Field Attributes #483
Comments
I've added this feature. |
I'll have a look at this for Golang and CSharp but I'll be a few days. |
Thanks @billsegall. The Java and C++ generator changes were pretty trivial for this. |
[CSharp] Add meta attribute PRESENCE to generated codecs. Issue #483.
[golang] Add meta attribute PRESENCE to generated codecs. Issue #483.
Thanks martin for the quick turnaround on this |
Just to clarify that this change will support enforcement of presence=required for a repeating group such that the count has to be greater than zero |
@adkapur Can you elaborate please. How does the enforcement work? |
A repeating group is always present, even if it has zero entries. In the version 1.0 spec, the way to control the number of instances of a group is explained in section "Restricting repeating group entries", by setting the attributes |
The min and max values are tied to the groupSizeEncoding data type but we wanted to know if the real logic codegen will expose presence=required for a field representing number of repeating group entries such as for example Number of Party Roles We are trying to convert FIX into SBE and our message validations will be leveraging the presence=required attribute |
Also within a repeating group some entries may be required and others may be optional so ideally presence should be able to tell us this for each field |
Field attributes such as presence do not seem to be accessible
<field description="Account mnemonic as agreed between buy and sell sides, e.g. broker and institution or investor/intermediary and fund manager." id="1" name="Account" semanticType="String" presence="required" offset="25" type="String12"/>
//String example in rlsbe
public static int accountId()
{
return 1;
}
public static int accountSinceVersion()
{
return 0;
}
public static String accountMetaAttribute(final MetaAttribute metaAttribute)
{
switch (metaAttribute)
{
case EPOCH: return "unix";
case TIME_UNIT: return "nanosecond";
case SEMANTIC_TYPE: return "String";
}
}
public static byte accountNullValue()
{
return (byte)0;
}
public static byte accountMinValue()
{
return (byte)32;
}
public static byte accountMaxValue()
{
return (byte)126;
}
public static int accountLength()
{
return 12;
}
public byte account(final int index)
{
if (index < 0 || index >= 12)
{
throw new IndexOutOfBoundsException("index out of range: index=" + index);
}
}
public static String accountCharacterEncoding()
{
return "UTF-8";
}
public int getAccount(final byte[] dst, final int dstOffset)
{
final int length = 12;
if (dstOffset < 0 || dstOffset > (dst.length - length))
{
throw new IndexOutOfBoundsException("dstOffset out of range for copy: offset=" + dstOffset);
}
}
we’d expect in something related to presence in meta attribute function, although right now that’s not even a member of the MetaAttribute enum:
public static String accountMetaAttribute(final MetaAttribute metaAttribute)
{
switch (metaAttribute)
{
case EPOCH: return "unix";
case TIME_UNIT: return "nanosecond";
case SEMANTIC_TYPE: return "String";
case PRESENCE: return “required”;
}
}
The text was updated successfully, but these errors were encountered: