mongo-go-driver - PR #2413: GODRIVER-3726 Use unmarshaling for AutoEncryptOpts in the unified spec test

XMLWordPrintableJSON

    • Type: Task
    • Resolution: Duplicate
    • Priority: Unknown
    • None
    • Affects Version/s: None
    • Component/s: None
    • None
    • Hide

      1. What would you like to communicate to the user about this feature?
      2. Would you like the user to see examples of the syntax and/or executable code and its output?
      3. Which versions of the driver/connector does this apply to?

      Show
      1. What would you like to communicate to the user about this feature? 2. Would you like the user to see examples of the syntax and/or executable code and its output? 3. Which versions of the driver/connector does this apply to?
    • None
    • None
    • None
    • None
    • None
    • None

      linborland has created PR #2413: GODRIVER-3726 Use unmarshaling for AutoEncryptOpts in the unified spec test in mongo-go-driver

      Issue Text:
      GODRIVER-3726

        1. Summary

      Replace the giant switch condition in the createAutoEncryptionOptions function with a struct that mirrors the “autoEncryptOpts” JSON document format. Call the new struct AutoEncryptOpts. Unmarshal the JSON data into that struct instead of matching field names in a switch condition.

        1. Background & Motivation

      Currently, the “autoEncryptOpts” JSON object is decoded as a bson.Raw, which can hold any BSON document value (see here). That unstructured document is then converted into an options.AutoEncryptionOptions by the createAutoEncryptionOptions function. While it works, the unstructured document makes it difficult to reason about the structure of the “autoEncryptOpts” data when writing code.

            Assignee:
            Unassigned
            Reporter:
            TPM Jira Automations Bot
            None
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: