cloudfoundry / cloud_controller_ng

Cloud Foundry Cloud Controller
Apache License 2.0
193 stars 359 forks source link

Cloud Controller does not accept service-broker schemas with json-schema draft-06 anymore #2677

Closed wanddynosios closed 2 years ago

wanddynosios commented 2 years ago

Issue

After Upgrading to cf-deployment v17.1.0 (CAPI 1.123.0), our service-broker schemas (via AWS Servicebroker) which use json-schema draft-06 do not work anymore:

$ cf update-service-broker ocf-aws-services-broker $BROKER_USER $BROKER_USER_PASSWORD "https://aws-sb.${SYSTEM_DOMAIN}"
Updating service broker ocf-aws-services-broker as admin...

Job (***) failed: Service broker catalog is invalid: 
Service aws-s3
  Plan standard
    Schemas
      Schema service_instance.create.parameters is not valid. Custom meta schemas are not supported.

Context

CC has updated its json-schema gem to 2.8.1.

In this update, the gem has changed the syntax for the latest json-schema to "http://json-schema.org/draft/schema#". This was apparently because json-schema.org has released it in violation of the usual naming-scheme, and the gem adapted to that (see changelog).

json-schema.org later fixed that and named the schema in accordance to the scheme: "http://json-schema.org/draft-06/schema#". The "draft/schema#"-version is now undefined, as the link does not provide the schema. The gem however has not adapted to this change (since 2018).

To accommodate this change, CC has adapted the "wrong" naming scheme, so it is now pinned to an invalid version without any chance of upgrading.

Steps to Reproduce

Try to apply any service-schema with draft-06 (in CC 1.123.0)

Expected result

There is no breaking change and the apply works with draft-06 as before.

Current result

see above.

Possible Fix

I would suggest switching to another json-schema-validator, as per this suggestion.

philippthun commented 2 years ago

The json-schema gem has been reverted to version 2.8.0. The link for JSON schema draft 6 is https://json-schema.org/draft-06/schema.

This change will be included in the next capi-release (CAPI 1.128.0).

Note: As a workaround, changing the JSON schema to "draft-4" should mitigate the problem (this is also the version guaranteed to work: "Platforms MUST support at least JSON Schema draft v4.").