2019-05-04 06:41
浏览 200


I have used swagger CLI to generate go code to call my flask app. swagger codegen converts fields.Raw type defined with flask_restplus model to *interface{} in go

assigning the value to the field with *interface{} type in go returns back

prog.go:18:26: cannot use notebook_spec_secrets (type map[string]string) as type *interface {} in assignment: *interface {} is pointer to interface, not interface

You can test it here

A quick and dirty fix will be changing the generated code by swagger cli and change

NotebookSpec *interface{}


NotebookSpec interface{}

  1. Is it possible to cast dictionary to *interface{} in go? (my google search shows a pointer to the interface in go is invalid and logically is not correct )

  2. How to define a dictionary field with flask-restplus

run_definition = api.model('Run definition',

                                              "eventhub_source_cs": "Endpoint=sb://;SharedAccessKeyName=xxxx;SharedAccessKey=xxxx=;EntityPath=sourceeh",
                                              "eventhub_destination_cs": "Endpoint=sb://;SharedAccessKeyName=xxxx;SharedAccessKey=xxxx=;EntityPath=desteh",
                                              "adl2_destination_oauth2_clientid": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
                                              "adl2_destination_oauth2_clientsecret": "xxxx=",
                                              "adl2_destination_oauth2_tenantid": "xxxx=",
                                              "adl2_destination_cs": "abfss://<file-system-name>@<storage-account-name>",

1条回答 默认 最新

相关推荐 更多相似问题