6. API version verification

Platforms are required to provide an HTTP header in each call to the Open Service Broker API, to indicate the version of the API specification that the platform supports. You can configure Spring Cloud Open Service Broker to verify the version provided by the platform on each call to the service broker. By default, this version verification is configured to allow any API version.spring-doc.cn

To customize the version verification, set the apiVersion property that specifies the API version required by the service broker, as follows:spring-doc.cn

spring.cloud.openservicebroker.apiVersion=2.13

Alternatively, you can provide a BrokerApiVersion Spring bean, as follows:spring-doc.cn

package com.example.servicebroker;

import org.springframework.cloud.servicebroker.model.BrokerApiVersion;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class ExampleApiVersionConfiguration {
	@Bean
	public BrokerApiVersion brokerApiVersion() {
		return new BrokerApiVersion("2.13");
	}
}

In the case of both a Spring Bean and a property being configured, the Spring Bean takes precedence over the property.spring-doc.cn

If an API version is specified and the platform provides a different version in the X-Broker-API-Version header, the framework returns a 412 Precondition Failed error to the platform.spring-doc.cn

As mentioned earlier, the default version verification is configured to allow any API version. However, to disable version verification entirely, you can set the api-version-check-endabled property to false, as follows:spring-doc.cn

spring.cloud.openservicebroker.api-version-check-enabled = false