Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-31655

IDL should verify non-optional fields in separate invariant statements

    • Type: Icon: Improvement Improvement
    • Resolution: Unresolved
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: IDL
    • Server Programmability

      When there are multiple required fields in an IDL type, IDL generates a serialize() method that invariants based on the combined AND of all those fields being present:

      invariant(_hasFieldOne && _hasFieldTwo && _hasFieldThree && _hasFieldFour);
      

      When this statement fails it is hard to debug, since it is unclear which field was not present. It would be much more helpful if each field appeared in its own invariant:

      invariant(_hasFieldOne);
      invariant(_hasFieldTwo);
      invariant(_hasFieldThree);
      invariant(_hasFieldFour);
      

            Assignee:
            Unassigned Unassigned
            Reporter:
            samantha.ritter@mongodb.com Samantha Ritter (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated: