blackducksoftware / hub-client-go

Hub Client for Go (golang)
Apache License 2.0
9 stars 19 forks source link

Handle cases where 'data' is not a string or integer type while consuming policy-rules of a BOM component API #56

Closed akashnagesh closed 4 years ago

akashnagesh commented 4 years ago

Handle cases where 'data' is not a string or integer type while consuming policy-rules of a BOM component API

Addresses https://github.com/blackducksoftware/hub-client-go/issues/55

After talking to the hub team, it appears that assuming PolicyRule.Expression.ExpressionParameter.Data to be a map[string]IntOrString type was incorrect.

PolicyRule.Expression.ExpressionParameter.Data is a dynamic JSON object whose contents are dependent on the details of the policy. Changing the type to be a map[string]interface{} should fix this issue.

Also PolicyRule.Expression.ExpressionParameter.Data is not mentioned in the hub api docs. There's a separate bug tracking this.