pmorie / osb-broker-lib

A go library for developing an Open Service Broker
Apache License 2.0
28 stars 23 forks source link

Current broker.CatralogResponse object does not unmarshal #34

Open n3wscott opened 6 years ago

n3wscott commented 6 years ago

With the following code from the stater pack:

    response := &osb.CatalogResponse{}

or

    response := &broker.CatalogResponse{}

and

    data := `
---
services:
- name: example-starter-pack-service
  id: 4f6e6cf6-ffdd-425f-a2c7-3c9258ad246a
  description: The example service from the osb starter pack!
`
    err := yaml.Unmarshal([]byte(data), &response)

Results:

Broker: &{CatalogResponse:{Services:[]}}
OSB: &{Services:[{ID:4f6e6cf6-ffdd-425f-a2c7-3c9258ad246a Name:example-starter-pack-service Description:The example service from the osb starter pack! Tags:[] Requires:[] Bindable:false BindingsRetrievable:false PlanUpdatable:<nil> Plans:[] DashboardClient:<nil> Metadata:map[]}]}

It seems that this does not work as intended:

type CatalogResponse struct {
    osb.CatalogResponse
}

This works:

type CatalogResponse osb.CatalogResponse

But not what was intended by the change I think

n3wscott commented 6 years ago

interesting update, using the current osb broker lib:

type CatalogResponse struct {
    osb.CatalogResponse
}

and the same data, this worked:

err := yaml.Unmarshal([]byte(data), &response.CatalogResponse)
pmorie commented 6 years ago

I just noticed that locally. It's an issue with the starter pack.

On Sat, Mar 24, 2018 at 1:13 PM, Scott Nichols notifications@github.com wrote:

interesting update, using the current osb broker lib:

type CatalogResponse struct { osb.CatalogResponse }

and the same data, this worked:

err := yaml.Unmarshal([]byte(data), &response.CatalogResponse)

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/pmorie/osb-broker-lib/issues/34#issuecomment-375909102, or mute the thread https://github.com/notifications/unsubscribe-auth/AAWXmNCwUJeSyTtlVUc0uzXjHhyUyP4rks5thn6jgaJpZM4S50Dv .