grokify/go-ringcentral-client

Fix `*interface{}` in `patch_operation_info.go`

grokify opened this issue · 1 comments

*interface{} isn't valid in patch_operation_info.go.

The following error is encountered with 2.3.1:

Error when using struct:

cannot use "github.com/grokify/go-ringcentral/client".UserInfo literal \
(type "github.com/grokify/go-ringcentral/client".UserInfo) as type *interface {} \
in field value: *interface {} is pointer to interface, not interface

Error when using struct pointer:

cannot use "github.com/grokify/go-ringcentral/client".UserInfo literal \
(type *"github.com/grokify/go-ringcentral/client".UserInfo) as type *interface {} \
in field value: *interface {} is pointer to interface, not interface

OpenAPI/Swagger 2.0 Spec is as follows:

    "PatchOperationInfo": {
      "type": "object",
      "required": [
        "op"
      ],
      "properties": {
        "op": {
          "type": "string",
          "enum": [
            "add",
            "replace",
            "remove"
          ]
        },
        "path": {
          "type": "string"
        },
        "value": {
          "type": "object",
          "description": "corresponding 'value' of that field specified by 'path'"
        }
      }
    },

Update to remove the * pointer.

$ git diff client/patch_operation_info.go 
diff --git a/client/patch_operation_info.go b/client/patch_operation_info.go
index 9514e5b..fc1e06c 100644
--- a/client/patch_operation_info.go
+++ b/client/patch_operation_info.go
@@ -15,5 +15,5 @@ type PatchOperationInfo struct {
        Path string `json:"path,omitempty"`
 
        // corresponding 'value' of that field specified by 'path'
-       Value *interface{} `json:"value,omitempty"`
+       Value interface{} `json:"value,omitempty"`
 }

Fixed in b5bbe68