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

IDL should verify non-optional fields in separate invariant statements

    XMLWordPrintableJSON

Details

    • Icon: Improvement Improvement
    • Resolution: Unresolved
    • Icon: Major - P3 Major - P3
    • None
    • None
    • IDL
    • Service Arch

    Description

      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);
      

      Attachments

        Activity

          People

            backlog-server-servicearch Backlog - Service Architecture
            samantha.ritter@mongodb.com Samantha Ritter (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated: