Error 'json: cannot unmarshal string into Go struct field ServiceExtra.Shareable of type bool' when using customer Service Broker and enabling Instance Sharing Service
search cancel

Error 'json: cannot unmarshal string into Go struct field ServiceExtra.Shareable of type bool' when using customer Service Broker and enabling Instance Sharing Service

book

Article ID: 297933

calendar_today

Updated On:

Products

VMware Tanzu Application Service for VMs

Issue/Introduction

This article explains how to fix a problem when using a custom Service Broker and enabling Instance Sharing Service, the following error is shown with the command cf share-service.

json: cannot unmarshal string into Go struct field ServiceExtra.Shareable of type bool
FAILED


Environment

Product Version: 2.1

Resolution

This is can be fixed changing the value type for the "shareable" flag to boolean.

Note: This depends very much on how the Service Broker is implemented, regarding language, frameworks, etc.

For example, if using Spring Cloud Open Service Broker as the framework to implement the Open Service Broker API, the metadata object is a Map<String, Object> and the shareable flag needs to be added as 'metadataObject.put("shareable", true)' instead of 'metadataObject.put("shareable", "true");'

'metadataObject.put("shareable", "true");' will produce the error mentioned above: 
 

json: cannot unmarshal string into Go struct field ServiceExtra.Shareable of type bool FAILED
 

Whereas, 'metadataObject.put("shareable", true)' will produce the following:
 

shareable:true