cloudfoundry / cloudfoundry/brokerapi
If a schema is set on a plan, the other schema types are also set
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 86
- Forks
- 75
- Avg merge
- 1m
- Merged PRs (30d)
- 5
Description
If I set one schema for a ServicePlan (e.g. the Schema for instance creation parameters), the broker's catalog will also contain
the schema keys for the other cases (e.g. instance update and binding creation).
Their Schema's parameters field will then be null, which unfortunately confuses some platforms.
"schemas": {
"service_instance": {
"create": {
"parameters": {
"$schema": "http://json-schema.org/draft-07/schema",
"properties": {
"foo_prop": {
"type": "integer"
}
},
"title": "instance creation params",
"type": "object"
}
},
"update": {
"parameters": null
}
},
"service_binding": {
"create": {
"parameters": null
}
}
}
vs
"schemas": {
"service_instance": {
"create": {
"parameters": {
"$schema": "http://json-schema.org/draft-07/schema",
"properties": {
"foo_prop": {
"type": "integer"
}
},
"title": "instance creation params",
"type": "object"
}
}
}
}
This is because the fields of ServiceSchemas and ServiceInstanceSchema are structs, not pointers to structs.
Originally, they had the json:"omitempty" tag, so I guess the idea was that they should be optional, but that doesn't seem to work with structs in go.
I'm not sure what to do about this without causing a breaking change, though.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by inspecting the ServiceSchemas and ServiceInstanceSchema definitions and how their JSON tags affect catalog serialization. Determine how optional schema cases can be omitted without causing an unintended breaking change, then verify that setting one schema no longer emits the other cases with null parameters.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- api
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100