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

Add support for alternate names for fields in generated code in IDL

    XMLWordPrintable

    Details

    • Type: Task
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 3.5.7
    • Component/s: None
    • Labels:
      None
    • Backwards Compatibility:
      Fully Compatible
    • Epic Link:
    • Sprint:
      Platforms 2017-05-08

      Description

      For some IDL generated classes, it is desirable to differentiate between the field names in BSON and the names in the generated C++ code. A good example of this is oplog entries which use one and two letter field names to keep the BSON small but may desire for the code to have a more verbose description of a field.

      Example:

          demo_struct:
              fields:
                  o:
                      type: int
                      cpp_name: operation
      

      Instead of generating:

      std::int32_t getO() const;
      void setO(std::int32_t value) const;
      

      more descriptive names will be used instead.

      std::int32_t getOperation() const;
      void setOperation(std::int32_t value) const;
      

      Reported by Judah Schvimer

        Attachments

          Activity

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: