Skip to content
This repository has been archived by the owner on May 6, 2022. It is now read-only.

Support for service binding response schemas #96

Merged
merged 1 commit into from
Mar 22, 2018

Conversation

luksa
Copy link
Contributor

@luksa luksa commented Feb 5, 2018

No description provided.

@luksa
Copy link
Contributor Author

luksa commented Feb 5, 2018

@pmorie
Copy link
Contributor

pmorie commented Feb 5, 2018

@luksa why do you say they should be renamed?

for ii := range catalogResponse.Services {
for jj := range catalogResponse.Services[ii].Plans {
catalogResponse.Services[ii].Plans[jj].ParameterSchemas = nil
}
}
} else if !c.APIVersion.AtLeast(Version2_14()) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should make this dependent on alpha features being enabled until openservicebrokerapi/servicebroker#392 is merged and released in the spec, so this should be else if c.EnableAlphaFeatures { instead.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't I add !c.EnableAlphaFeatures as an additional condition? There's a similar if statement a few lines up, which checks if the version is less than 2.13 and removes the entire ParameterSchemas field. AFAICT that's because the client is supposed to only return fields that are part of the specific version of the OSBAPI spec the client is configured to use.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nevermind. I get what you mean. Fixed it.

@luksa
Copy link
Contributor Author

luksa commented Feb 5, 2018

@pmorie The ParameterSchemas struct transitively includes the response schemas next to the parameter schemas, so the ParameterSchemas name is misleading, right? As a user, I'd wouldn't expect to find the response schemas here. Also, the OSBAPI spec calls this field schemas (https://github.com/n3wscott/servicebroker/blob/95910853f5287b7b647fce28e4165f42d3a5b715/spec.md#plan-object).

@pmorie
Copy link
Contributor

pmorie commented Feb 9, 2018

Also, the OSBAPI spec calls this field schemas

Excellent point. Let's do this - I'd like to cut a release of this repo before we rename the schema field, which I think we should do in a separate PR.

@coveralls
Copy link

coveralls commented Feb 13, 2018

Coverage Status

Coverage increased (+0.1%) to 91.971% when pulling 59cb2b6 on luksa:binding_response_schema into 39dbb4e on pmorie:master.

@luksa luksa force-pushed the binding_response_schema branch 4 times, most recently from e539663 to 8271422 Compare March 21, 2018 15:16
v2/types.go Outdated
// update of an API resource, and a schema for the credentials returned by the
// broker
type RequestResponseSchema struct {
*InputParametersSchema
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like we should embed the type rather than a pointer to it - WDYT?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed it.

@luksa luksa force-pushed the binding_response_schema branch from 8271422 to 59cb2b6 Compare March 21, 2018 15:20
type RequestResponseSchema struct {
InputParametersSchema
// The schema definition for the broker's response to the bind request.
Response interface{} `json:"response,omitempty"`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps call the object ResponseSchema?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OH oh oh... I take it back.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me, I am just having brain hemorrhaging from switching between c++ and go...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You mean rename the field Response to ResponseSchema? Not sure if that makes sense - the field name is aligned with the Parameters field in InputParametersSchema and matches the JSON field name.

But what I would love is if I could rename InputParametersSchema to RequestSchema. Then, we'd have RequestSchema.Parameters and RequestResponseSchema.Response.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am sorry, I was 1000% mistaken. I was reading it as the object type Response, but it is of type interface{}.

What you have is great.

@n3wscott
Copy link
Contributor

LGTM

@pmorie pmorie merged commit c231fb9 into kubernetes-retired:master Mar 22, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants