ldanko / easyfix

MIT License
3 stars 7 forks source link

Allow conditionally required fields (`required='C'`) #23

Open kskalski opened 4 months ago

kskalski commented 4 months ago

From https://www.fixtrading.org/online-specification/introduction/#message-and-component-definitions Messages are comprised of required, optional and conditionally required (fields which are required based on the presence or value of other fields) fields. Systems should be designed to operate when only the required and conditionally required fields are present.

So they should just be treated as optional for the code gen part

ldanko commented 4 months ago

Do you see any practical difference between Optional and Conditionally Required fields?

It's up to the user to decide if conditions for optional fields to be present are met. Use InputResponder::reject https://github.com/ldanko/easyfix/blob/6b8cad4a79611c1faac53bccffa5a88c70397883/easyfix-session/src/application.rs#L58

(or just send Reject<3> message)

kskalski commented 4 months ago

From what I see, requirements for conditional fields are not formally specified, so it's application specific and should generate runtime error when in application logic the rules violation is detected.

So my take on that is: