spring-cloud-open-service-broker
spring-cloud-open-service-broker copied to clipboard
`ServiceInstanceBindingController.getCreateResponseCode` should fail on `response.isBindingExisted()`
To generate the response in ServiceInstanceBindingController.createServiceInstanceBinding this little method is called:
https://github.com/spring-cloud/spring-cloud-open-service-broker/blob/a32b84e1836f37b74a40bf1a8262c9c924f63cb8/spring-cloud-open-service-broker-core/src/main/java/org/springframework/cloud/servicebroker/controller/ServiceInstanceBindingController.java#L144-L155
When the binding existed the method returns 200 OK. But based on OSB api spec (both v2.15 and v2.16), the response should fail with 409 Conflict
| 409 Conflict | MUST be returned if a Service Binding with the same id, for the same Service Instance, already exists or is being created but with different parameters. |
|---|
Maybe I misunderstood that or am I missing something? Thanks.
Thanks for reporting! I'll review the spec and double check our tests.
hmm. this is a bit ambiguous. the spec also says a 200 OK SHOULD be returned if the Service Binding already exists and the requested parameters are identical to the existing Service Binding.
I see. I think the difference is in the parameters (if same 200 OK, if different 409 conflict)
response.isBindingExisted() isn't adequate to support those two different scenarios. It might make sense to deprecate this property and provide an alternative method for configuring or returning the correct response code. If we do that, then it would be the responsibility of the developer to determine whether the parameters are identical or not.
We already have a ServiceInstanceBindingExistsException that you can throw to return a 409, so this change isn't correct. Reopening this issue to reevaluate how to handle this.