Debian Codegraph @

pkg/util/proto/testing/openapi_v3.go

raw symbols SCIP
1 /*
2 Copyright 2022 The Kubernetes Authors.
3
4 Licensed under the Apache License, Version 2.0 (the "License");
5 you may not use this file except in compliance with the License.
6 You may obtain a copy of the License at
7
8 http://www.apache.org/licenses/LICENSE-2.0
9
10 Unless required by applicable law or agreed to in writing, software
11 distributed under the License is distributed on an "AS IS" BASIS,
12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 See the License for the specific language governing permissions and
14 limitations under the License.
15 */
16
17 package testingscip-go gomod k8s.io/kube-openapi . `k8s.io/kube-openapi/pkg/util/proto/testing`/
18
19 import (
20 "osscip-go gomod github.com/golang/go/src go1.21 os/"
21 "path/filepathscip-go gomod github.com/golang/go/src go1.21 `path/filepath`/"
22 "syncscip-go gomod github.com/golang/go/src go1.21 sync/"
23
24 openapi_v3scip-go gomod github.com/google/gnostic-models v0.6.9 `github.com/google/gnostic-models/openapiv3`/ "github.com/google/gnostic-models/openapiv3scip-go gomod github.com/google/gnostic-models v0.6.9 `github.com/google/gnostic-models/openapiv3`/"
25 )
26
27 type FakeV3scip-go gomod k8s.io/kube-openapi . `k8s.io/kube-openapi/pkg/util/proto/testing`/FakeV3# struct {
28 Pathscip-go gomod k8s.io/kube-openapi . `k8s.io/kube-openapi/pkg/util/proto/testing`/FakeV3#Path. string
29
30 lockscip-go gomod k8s.io/kube-openapi . `k8s.io/kube-openapi/pkg/util/proto/testing`/FakeV3#lock. syncscip-go gomod github.com/golang/go/src go1.21 sync/.Mutexscip-go gomod github.com/golang/go/src go1.21 sync/Mutex#
31 documentsscip-go gomod k8s.io/kube-openapi . `k8s.io/kube-openapi/pkg/util/proto/testing`/FakeV3#documents. map[string]*openapi_v3scip-go gomod github.com/google/gnostic-models v0.6.9 `github.com/google/gnostic-models/openapiv3`/.Documentscip-go gomod github.com/google/gnostic-models v0.6.9 `github.com/google/gnostic-models/openapiv3`/Document#
32 errorsscip-go gomod k8s.io/kube-openapi . `k8s.io/kube-openapi/pkg/util/proto/testing`/FakeV3#errors. map[string]error
33 }
34
35 func (f *FakeV3scip-go gomod k8s.io/kube-openapi . `k8s.io/kube-openapi/pkg/util/proto/testing`/FakeV3#) OpenAPIV3Schemascip-go gomod k8s.io/kube-openapi . `k8s.io/kube-openapi/pkg/util/proto/testing`/FakeV3#OpenAPIV3Schema().(groupVersion string) (*openapi_v3scip-go gomod github.com/google/gnostic-models v0.6.9 `github.com/google/gnostic-models/openapiv3`/.Documentscip-go gomod github.com/google/gnostic-models v0.6.9 `github.com/google/gnostic-models/openapiv3`/Document#, error) {
36 f.lockscip-go gomod k8s.io/kube-openapi . `k8s.io/kube-openapi/pkg/util/proto/testing`/FakeV3#lock..Lockscip-go gomod github.com/golang/go/src go1.21 sync/Mutex#Lock().()
37 defer f.lockscip-go gomod k8s.io/kube-openapi . `k8s.io/kube-openapi/pkg/util/proto/testing`/FakeV3#lock..Unlockscip-go gomod github.com/golang/go/src go1.21 sync/Mutex#Unlock().()
38
39 if existing, ok := f.documentsscip-go gomod k8s.io/kube-openapi . `k8s.io/kube-openapi/pkg/util/proto/testing`/FakeV3#documents.[groupVersion]; ok {
40 return existing, nil
41 } else if existingError, ok := f.errorsscip-go gomod k8s.io/kube-openapi . `k8s.io/kube-openapi/pkg/util/proto/testing`/FakeV3#errors.[groupVersion]; ok {
42 return nil, existingError
43 }
44
45 _, err := osscip-go gomod github.com/golang/go/src go1.21 os/.Statscip-go gomod github.com/golang/go/src go1.21 os/Stat().(f.Pathscip-go gomod k8s.io/kube-openapi . `k8s.io/kube-openapi/pkg/util/proto/testing`/FakeV3#Path.)
46 if err != nil {
47 return nil, err
48 }
49 spec, err := osscip-go gomod github.com/golang/go/src go1.21 os/.ReadFilescip-go gomod github.com/golang/go/src go1.21 os/ReadFile().(filepathscip-go gomod github.com/golang/go/src go1.21 `path/filepath`/.Joinscip-go gomod github.com/golang/go/src go1.21 `path/filepath`/Join().(f.Pathscip-go gomod k8s.io/kube-openapi . `k8s.io/kube-openapi/pkg/util/proto/testing`/FakeV3#Path., groupVersion+".json"))
50 if err != nil {
51 return nil, err
52 }
53
54 if f.documentsscip-go gomod k8s.io/kube-openapi . `k8s.io/kube-openapi/pkg/util/proto/testing`/FakeV3#documents. == nil {
55 f.documentsscip-go gomod k8s.io/kube-openapi . `k8s.io/kube-openapi/pkg/util/proto/testing`/FakeV3#documents. = make(map[string]*openapi_v3scip-go gomod github.com/google/gnostic-models v0.6.9 `github.com/google/gnostic-models/openapiv3`/.Documentscip-go gomod github.com/google/gnostic-models v0.6.9 `github.com/google/gnostic-models/openapiv3`/Document#)
56 }
57
58 if f.errorsscip-go gomod k8s.io/kube-openapi . `k8s.io/kube-openapi/pkg/util/proto/testing`/FakeV3#errors. == nil {
59 f.errorsscip-go gomod k8s.io/kube-openapi . `k8s.io/kube-openapi/pkg/util/proto/testing`/FakeV3#errors. = make(map[string]error)
60 }
61
62 result, err := openapi_v3scip-go gomod github.com/google/gnostic-models v0.6.9 `github.com/google/gnostic-models/openapiv3`/.ParseDocumentscip-go gomod github.com/google/gnostic-models v0.6.9 `github.com/google/gnostic-models/openapiv3`/ParseDocument().(spec)
63 if err != nil {
64 f.errorsscip-go gomod k8s.io/kube-openapi . `k8s.io/kube-openapi/pkg/util/proto/testing`/FakeV3#errors.[groupVersion] = err
65 return nil, err
66 }
67
68 f.documentsscip-go gomod k8s.io/kube-openapi . `k8s.io/kube-openapi/pkg/util/proto/testing`/FakeV3#documents.[groupVersion] = result
69 return result, nil
70 }