File tree Expand file tree Collapse file tree 3 files changed +223
-7
lines changed Expand file tree Collapse file tree 3 files changed +223
-7
lines changed Original file line number Diff line number Diff line change @@ -16,16 +16,18 @@ import (
16
16
)
17
17
18
18
const (
19
- SchemaPackage = "olm.package"
20
- SchemaChannel = "olm.channel"
21
- SchemaBundle = "olm.bundle"
19
+ SchemaPackage = "olm.package"
20
+ SchemaChannel = "olm.channel"
21
+ SchemaBundle = "olm.bundle"
22
+ SchemaDeprecation = "olm.catalog.deprecation"
22
23
)
23
24
24
25
type DeclarativeConfig struct {
25
- Packages []Package
26
- Channels []Channel
27
- Bundles []Bundle
28
- Others []Meta
26
+ Packages []Package
27
+ Channels []Channel
28
+ Bundles []Bundle
29
+ Deprecations map [string ]Deprecation // mapping package name to deprecation
30
+ Others []Meta
29
31
}
30
32
31
33
type Package struct {
@@ -90,6 +92,19 @@ type RelatedImage struct {
90
92
Image string `json:"image"`
91
93
}
92
94
95
+ type Deprecation struct {
96
+ Schema string `json:"schema"`
97
+ Package string `json:"package"`
98
+ Name string `json:"name,omitempty"`
99
+ Deprecations []DeprecationEntry `json:"deprecations"`
100
+ }
101
+
102
+ type DeprecationEntry struct {
103
+ Schema string `json:"schema"`
104
+ Name string `json:"name,omitempty"`
105
+ Message json.RawMessage `json:"message"`
106
+ }
107
+
93
108
type Meta struct {
94
109
Schema string
95
110
Package string
Original file line number Diff line number Diff line change @@ -297,6 +297,18 @@ func LoadReader(r io.Reader) (*DeclarativeConfig, error) {
297
297
return fmt .Errorf ("parse bundle: %v" , err )
298
298
}
299
299
cfg .Bundles = append (cfg .Bundles , b )
300
+ case SchemaDeprecation :
301
+ var d Deprecation
302
+ if err := json .Unmarshal (in .Blob , & d ); err != nil {
303
+ return fmt .Errorf ("parse deprecation: %v" , err )
304
+ }
305
+ if cfg .Deprecations == nil {
306
+ cfg .Deprecations = make (map [string ]Deprecation )
307
+ }
308
+ if _ , ok := cfg .Deprecations [d .Package ]; ok {
309
+ return fmt .Errorf ("deprecation for package %q already exists" , d .Package )
310
+ }
311
+ cfg .Deprecations [d .Package ] = d
300
312
case "" :
301
313
return fmt .Errorf ("object '%s' is missing root schema field" , string (in .Blob ))
302
314
default :
You can’t perform that action at this time.
0 commit comments