Skip to content
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

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

Open
kskalski opened this issue May 9, 2024 · 2 comments
Open

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

kskalski opened this issue May 9, 2024 · 2 comments

Comments

@kskalski
Copy link
Contributor

kskalski commented May 9, 2024

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
Copy link
Owner

ldanko commented May 9, 2024

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

(or just send Reject<3> message)

@kskalski
Copy link
Contributor Author

kskalski commented May 9, 2024

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:

  • for the generated API messages this is the same as optional, since it should support cases of those fields omitted
  • for the "reflection" way to inspect schema (easyfix-dictionary crate?), those fields might be good to mark as conditionally required, so user could treat them specially or at least know about them

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants