@@ -18,29 +18,35 @@ var apiInfo = map[string]swagger.Info{
18
18
19
19
// customizeSwaggerDefinition applies selective patches to the swagger API docs
20
20
// TODO: move most of these upstream or to go-restful
21
- func customizeSwaggerDefinition (api map [ string ] swagger.ApiDeclaration ) {
21
+ func customizeSwaggerDefinition (api * swagger.ApiDeclarationList ) {
22
22
for path , info := range apiInfo {
23
- if dec , ok := api [ path ] ; ok {
23
+ if dec , ok := api . At ( path ) ; ok {
24
24
if len (info .Title ) > 0 {
25
25
dec .Info .Title = info .Title
26
26
}
27
27
if len (info .Description ) > 0 {
28
28
dec .Info .Description = info .Description
29
29
}
30
- api [ path ] = dec
30
+ api . Put ( path , dec )
31
31
} else {
32
32
glog .Warningf ("No API exists for predefined swagger description %s" , path )
33
33
}
34
34
}
35
35
for _ , version := range []string {OpenShiftAPIPrefixV1 } {
36
- model := api [version ].Models ["runtime.RawExtension" ]
36
+ apiDeclaration , _ := api .At (version )
37
+ models := & apiDeclaration .Models
38
+
39
+ model , _ := models .At ("runtime.RawExtension" )
37
40
model .Required = []string {}
38
- model .Properties = map [ string ] swagger.ModelProperty {}
41
+ model .Properties = swagger.ModelPropertyList {}
39
42
model .Description = "this may be any JSON object with a 'kind' and 'apiVersion' field; and is preserved unmodified by processing"
40
- api [ version ]. Models [ "runtime.RawExtension" ] = model
43
+ models . Put ( "runtime.RawExtension" , model )
41
44
42
- model = api [ version ]. Models [ "patch.Object" ]
45
+ model , _ = models . At ( "patch.Object" )
43
46
model .Description = "represents an object patch, which may be any of: JSON patch (RFC 6902), JSON merge patch (RFC 7396), or the Kubernetes strategic merge patch"
44
- api [version ].Models ["patch.Object" ] = model
47
+ models .Put ("patch.Object" , model )
48
+
49
+ apiDeclaration .Models = * models
50
+ api .Put (version , apiDeclaration )
45
51
}
46
52
}
0 commit comments