-
Notifications
You must be signed in to change notification settings - Fork 238
Description
A user of an extension for Rancher was reporting that it was showing in the Rancher UI as installed, but wasn't returning
any output. Rancher uses a module called steve as a shim between the UI and a kubernetes server.
During startup. after I installed the component, I saw that steve was failing to load all the schemas, specifically with the error message
SchemaError(github.com/kubewarden/sbomscanner/api/storage/v1alpha1.ContainerRef.imageRef):
unknown model in reference: "github.com~1kubewarden~1sbomscanner~1api~1storage~1v1alpha1.ImageRef"
There is a model for github.com/kubewarden/sbomscanner/api/storage/v1alpha1.ContainerRef.imageRef in the definitions section of the openapi/v2 doc that this code uses, but not one with the tildes.
Today I learned about json-pointer, which makes sense. Otherwise a ref string like "definitions/github.com/kubewarden/sbomscanner/api/storage/v1alpha1.ContainerRef.imageRef" would be ambiguous: is it pointing first at the top-level definitions section, then a sub-section called "github.com", etc.?
Openapi/v2 clients deal with this by decoding these reference strings, converting instances of ~1 to / and ~0 to ~.
The code at
kube-openapi/pkg/util/proto/document.go
Lines 108 to 111 in 5b3e3fd
| reference := strings.TrimPrefix(s.GetXRef(), "#/definitions/") | |
| if _, ok := d.models[reference]; !ok { | |
| return nil, newSchemaError(path, "unknown model in reference: %q", reference) | |
| } |
definitions section.
PR coming up...