mirror of
https://github.com/containers/skopeo.git
synced 2025-09-10 02:59:50 +00:00
Re-vendor, and use mtrmac/image-spec:id-based-loader to fix tests
Anyone running (vndr) currently ends up with failing tests in OCI schema validation because gojsonschema has fixed its "$ref" interpretation, exposing inconsistent URI usage inside image-spec/schema. So, this runs (vndr), and uses mtrmac/image-spec:id-based-loader ( https://github.com/opencontainers/image-spec/pull/739 ) to make the tests pass again. As soon as that PR is merged we should revert to using the upstream image-spec repo again.
This commit is contained in:
35
vendor/github.com/opencontainers/image-spec/schema/schema.go
generated
vendored
35
vendor/github.com/opencontainers/image-spec/schema/schema.go
generated
vendored
@@ -35,13 +35,36 @@ var (
|
||||
// having the OCI JSON schema files in root "/".
|
||||
fs = _escFS(false)
|
||||
|
||||
// specs maps OCI schema media types to schema files.
|
||||
// schemaNamespaces is a set of URI prefixes which are treated as containing the schema files of fs.
|
||||
// This is necessary because *.json schema files in this directory use "id" and "$ref" attributes which evaluate to such URIs, e.g.
|
||||
// ./image-manifest-schema.json URI contains
|
||||
// "id": "https://opencontainers.org/schema/image/manifest",
|
||||
// and
|
||||
// "$ref": "content-descriptor.json"
|
||||
// which evaluates as a link to https://opencontainers.org/schema/image/content-descriptor.json .
|
||||
//
|
||||
// To support such links without accessing the network (and trying to load content which is not hosted at these URIs),
|
||||
// fsLoaderFactory accepts any URI starting with one of the schemaNamespaces below,
|
||||
// and uses _escFS to load them from the root of its in-memory filesystem tree.
|
||||
//
|
||||
// (Note that this must contain subdirectories before its parent directories for fsLoaderFactory.refContents to work.)
|
||||
schemaNamespaces = []string{
|
||||
"https://opencontainers.org/schema/image/descriptor/",
|
||||
"https://opencontainers.org/schema/image/index/",
|
||||
"https://opencontainers.org/schema/image/manifest/",
|
||||
"https://opencontainers.org/schema/image/",
|
||||
"https://opencontainers.org/schema/",
|
||||
}
|
||||
|
||||
// specs maps OCI schema media types to schema URIs.
|
||||
// These URIs are expected to be used only by fsLoaderFactory (which trims schemaNamespaces defined above)
|
||||
// and should never cause a network access.
|
||||
specs = map[Validator]string{
|
||||
ValidatorMediaTypeDescriptor: "content-descriptor.json",
|
||||
ValidatorMediaTypeLayoutHeader: "image-layout-schema.json",
|
||||
ValidatorMediaTypeManifest: "image-manifest-schema.json",
|
||||
ValidatorMediaTypeImageIndex: "image-index-schema.json",
|
||||
ValidatorMediaTypeImageConfig: "config-schema.json",
|
||||
ValidatorMediaTypeDescriptor: "https://opencontainers.org/schema/content-descriptor.json",
|
||||
ValidatorMediaTypeLayoutHeader: "https://opencontainers.org/schema/image/image-layout-schema.json",
|
||||
ValidatorMediaTypeManifest: "https://opencontainers.org/schema/image/image-manifest-schema.json",
|
||||
ValidatorMediaTypeImageIndex: "https://opencontainers.org/schema/image/image-index-schema.json",
|
||||
ValidatorMediaTypeImageConfig: "https://opencontainers.org/schema/image/config-schema.json",
|
||||
}
|
||||
)
|
||||
|
||||
|
Reference in New Issue
Block a user