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

IDL-generated parse method uses string literals for field names instead of the generated constants

    • Type: Icon: Bug Bug
    • Resolution: Duplicate
    • Priority: Icon: Minor - P4 Minor - P4
    • None
    • Affects Version/s: None
    • Component/s: Internal Code
    • Labels:
      None
    • ALL

      The IDL-generated parser code already has StringData constants for the field names, but the parse method uses string literals directly. Seems like it should be using these constants instead.

      For example:

      constexpr StringData WriteOpTxnInfo::kStmtIdsFieldName;
      constexpr StringData WriteOpTxnInfo::kTxnNumFieldName;
      ...
              if (fieldName == "txnNum") {
                  if (ctxt.checkAndAssertType(element, NumberLong)) {
                      _txnNum = element._numberLong();
                  }
              }
              else if (fieldName == "stmtIds") {
                  std::uint32_t expectedFieldNumber{0};
      ...
      

            Assignee:
            spencer.jackson@mongodb.com Spencer Jackson
            Reporter:
            kaloian.manassiev@mongodb.com Kaloian Manassiev
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: