1 // Package publishserviceapi provides primitives to interact with the openapi HTTP API.
3 // Code generated by github.com/deepmap/oapi-codegen version v1.10.1 DO NOT EDIT.
4 package publishserviceapi
16 "github.com/deepmap/oapi-codegen/pkg/runtime"
17 "github.com/getkin/kin-openapi/openapi3"
18 "github.com/labstack/echo/v4"
19 externalRef0 "oransc.org/nonrtric/capifcore/internal/common"
20 externalRef1 "oransc.org/nonrtric/capifcore/internal/common29122"
21 externalRef2 "oransc.org/nonrtric/capifcore/internal/common29571"
24 // ServerInterface represents all server handlers.
25 type ServerInterface interface {
27 // (GET /{apfId}/service-apis)
28 GetApfIdServiceApis(ctx echo.Context, apfId ApfId) error
30 // (POST /{apfId}/service-apis)
31 PostApfIdServiceApis(ctx echo.Context, apfId ApfId) error
33 // (DELETE /{apfId}/service-apis/{serviceApiId})
34 DeleteApfIdServiceApisServiceApiId(ctx echo.Context, apfId ApfId, serviceApiId ServiceApiId) error
36 // (GET /{apfId}/service-apis/{serviceApiId})
37 GetApfIdServiceApisServiceApiId(ctx echo.Context, apfId ApfId, serviceApiId ServiceApiId) error
39 // (PATCH /{apfId}/service-apis/{serviceApiId})
40 ModifyIndAPFPubAPI(ctx echo.Context, apfId ApfId, serviceApiId ServiceApiId) error
42 // (PUT /{apfId}/service-apis/{serviceApiId})
43 PutApfIdServiceApisServiceApiId(ctx echo.Context, apfId ApfId, serviceApiId ServiceApiId) error
46 // ServerInterfaceWrapper converts echo contexts to parameters.
47 type ServerInterfaceWrapper struct {
48 Handler ServerInterface
51 // GetApfIdServiceApis converts echo context to params.
52 func (w *ServerInterfaceWrapper) GetApfIdServiceApis(ctx echo.Context) error {
54 // ------------- Path parameter "apfId" -------------
57 err = runtime.BindStyledParameterWithLocation("simple", false, "apfId", runtime.ParamLocationPath, ctx.Param("apfId"), &apfId)
59 return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter apfId: %s", err))
62 // Invoke the callback with all the unmarshalled arguments
63 err = w.Handler.GetApfIdServiceApis(ctx, apfId)
67 // PostApfIdServiceApis converts echo context to params.
68 func (w *ServerInterfaceWrapper) PostApfIdServiceApis(ctx echo.Context) error {
70 // ------------- Path parameter "apfId" -------------
73 err = runtime.BindStyledParameterWithLocation("simple", false, "apfId", runtime.ParamLocationPath, ctx.Param("apfId"), &apfId)
75 return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter apfId: %s", err))
78 // Invoke the callback with all the unmarshalled arguments
79 err = w.Handler.PostApfIdServiceApis(ctx, apfId)
83 // DeleteApfIdServiceApisServiceApiId converts echo context to params.
84 func (w *ServerInterfaceWrapper) DeleteApfIdServiceApisServiceApiId(ctx echo.Context) error {
86 // ------------- Path parameter "apfId" -------------
89 err = runtime.BindStyledParameterWithLocation("simple", false, "apfId", runtime.ParamLocationPath, ctx.Param("apfId"), &apfId)
91 return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter apfId: %s", err))
94 // ------------- Path parameter "serviceApiId" -------------
95 var serviceApiId ServiceApiId
97 err = runtime.BindStyledParameterWithLocation("simple", false, "serviceApiId", runtime.ParamLocationPath, ctx.Param("serviceApiId"), &serviceApiId)
99 return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter serviceApiId: %s", err))
102 // Invoke the callback with all the unmarshalled arguments
103 err = w.Handler.DeleteApfIdServiceApisServiceApiId(ctx, apfId, serviceApiId)
107 // GetApfIdServiceApisServiceApiId converts echo context to params.
108 func (w *ServerInterfaceWrapper) GetApfIdServiceApisServiceApiId(ctx echo.Context) error {
110 // ------------- Path parameter "apfId" -------------
113 err = runtime.BindStyledParameterWithLocation("simple", false, "apfId", runtime.ParamLocationPath, ctx.Param("apfId"), &apfId)
115 return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter apfId: %s", err))
118 // ------------- Path parameter "serviceApiId" -------------
119 var serviceApiId ServiceApiId
121 err = runtime.BindStyledParameterWithLocation("simple", false, "serviceApiId", runtime.ParamLocationPath, ctx.Param("serviceApiId"), &serviceApiId)
123 return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter serviceApiId: %s", err))
126 // Invoke the callback with all the unmarshalled arguments
127 err = w.Handler.GetApfIdServiceApisServiceApiId(ctx, apfId, serviceApiId)
131 // ModifyIndAPFPubAPI converts echo context to params.
132 func (w *ServerInterfaceWrapper) ModifyIndAPFPubAPI(ctx echo.Context) error {
134 // ------------- Path parameter "apfId" -------------
137 err = runtime.BindStyledParameterWithLocation("simple", false, "apfId", runtime.ParamLocationPath, ctx.Param("apfId"), &apfId)
139 return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter apfId: %s", err))
142 // ------------- Path parameter "serviceApiId" -------------
143 var serviceApiId ServiceApiId
145 err = runtime.BindStyledParameterWithLocation("simple", false, "serviceApiId", runtime.ParamLocationPath, ctx.Param("serviceApiId"), &serviceApiId)
147 return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter serviceApiId: %s", err))
150 // Invoke the callback with all the unmarshalled arguments
151 err = w.Handler.ModifyIndAPFPubAPI(ctx, apfId, serviceApiId)
155 // PutApfIdServiceApisServiceApiId converts echo context to params.
156 func (w *ServerInterfaceWrapper) PutApfIdServiceApisServiceApiId(ctx echo.Context) error {
158 // ------------- Path parameter "apfId" -------------
161 err = runtime.BindStyledParameterWithLocation("simple", false, "apfId", runtime.ParamLocationPath, ctx.Param("apfId"), &apfId)
163 return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter apfId: %s", err))
166 // ------------- Path parameter "serviceApiId" -------------
167 var serviceApiId ServiceApiId
169 err = runtime.BindStyledParameterWithLocation("simple", false, "serviceApiId", runtime.ParamLocationPath, ctx.Param("serviceApiId"), &serviceApiId)
171 return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter serviceApiId: %s", err))
174 // Invoke the callback with all the unmarshalled arguments
175 err = w.Handler.PutApfIdServiceApisServiceApiId(ctx, apfId, serviceApiId)
179 // This is a simple interface which specifies echo.Route addition functions which
180 // are present on both echo.Echo and echo.Group, since we want to allow using
181 // either of them for path registration
182 type EchoRouter interface {
183 CONNECT(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
184 DELETE(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
185 GET(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
186 HEAD(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
187 OPTIONS(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
188 PATCH(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
189 POST(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
190 PUT(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
191 TRACE(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
194 // RegisterHandlers adds each server route to the EchoRouter.
195 func RegisterHandlers(router EchoRouter, si ServerInterface) {
196 RegisterHandlersWithBaseURL(router, si, "")
199 // Registers handlers, and prepends BaseURL to the paths, so that the paths
200 // can be served under a prefix.
201 func RegisterHandlersWithBaseURL(router EchoRouter, si ServerInterface, baseURL string) {
203 wrapper := ServerInterfaceWrapper{
207 router.GET(baseURL+"/:apfId/service-apis", wrapper.GetApfIdServiceApis)
208 router.POST(baseURL+"/:apfId/service-apis", wrapper.PostApfIdServiceApis)
209 router.DELETE(baseURL+"/:apfId/service-apis/:serviceApiId", wrapper.DeleteApfIdServiceApisServiceApiId)
210 router.GET(baseURL+"/:apfId/service-apis/:serviceApiId", wrapper.GetApfIdServiceApisServiceApiId)
211 router.PATCH(baseURL+"/:apfId/service-apis/:serviceApiId", wrapper.ModifyIndAPFPubAPI)
212 router.PUT(baseURL+"/:apfId/service-apis/:serviceApiId", wrapper.PutApfIdServiceApisServiceApiId)
216 // Base64 encoded, gzipped, json marshaled Swagger object
217 var swaggerSpec = []string{
219 "H4sIAAAAAAAC/+xa4XLbuBF+FQzbmcZTmrJkO7nonyLLPl1yNmvKN9M5ZzwQuRJxIQEWAOWoGT1QX6NP",
220 "1gFAUhQFS7KVJtee/tiSACx2F7v77S7wxQlZmjEKVAqn+8URYQwp1h97MPnAQiwJo+prBCLkJDNfnVEM",
221 "KClGEaETxlPz+RV4Uw+FZEZChKOIgxAuuvIDFDLGI0KxBOGiCEuMQqASOBpeHKHHGDggGQPqDS5RxtmM",
222 "RIRO9S8C+IyEgHr+EBFhdoXIc1wn4ywDLglofvWevSji6sufOUycrtNnacroBZbYm+M0+VNrKW2rELXV",
223 "L9eBEM7CdaJwGK0LPIyASjIhIDRTdQFexrycZ+B0HSE5oVO17xRYjwN+JvdXwKYcZzEJ9eLFoqLMxr9B",
224 "KBXlHkx8ziYkgXW5biHjIBTJugRqrpZxXc0YJhv1wxGbGFL+EMHnjAmli0lOQz3TIjheNbRCeKu0dZtU",
225 "R4UlvtSmt23hxXKmWsdSTOg1Ti0KudBjSDL0GJMw1mKMIWF0KpBkNv6JsoIJDuFiSUhYNFROQxFITBLh",
226 "uA6RkIptvA8t9NW+KaFDs75dcYU5x3M1mHEmWciSbcT9ct7CdQSEOSdy/jPImEUWEYJiAkrNDCTyLGNc",
227 "QoTG89J+dhUrWNltq0Az4MKuWHVCxeiue/9STN+86cJ1OPwjJxwip/trYfk1Tj5afE35bE6JsdGRHm3y",
228 "6zMhyDgBNMNJDgJhDugY3Q7+djcIRg+3g8C/uQ4GXaRibFgnpyJI4VxqX6SYAyGPOYiMUaGoBHfvgv7t",
229 "8N3g4fpmNLz8+w5URD5W3I3hmDJJJvN7pUWgeapkbnLluE5zi5oalj7Rz4Vk6U0G/AkAacSd2qBiDqNQ",
230 "E0CspGCJ9yxNSwVvOuv1E1m4jiJ/k9kjAJFKRQIkwgJ9Wc5coAxzWeru7naIhOR5KHMOaMK4hWn0SGTM",
231 "cok4CJbzEBAWgoXEDG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qxeLD5q99f1mZanc3Jiep1UApUmvuqWmuK3",
257 "9ZswUXa5x44XDrZexGLN/ZtpmHOhyjBSpbRJUjewV+LI1o94ws8XrnN68uaZ0bJSTUut1SR+2IPED4rE",
258 "mdHwi0iotZpEew8SbUPidA8Sp4bE2R4kzgyJ13uQeK1JdN6+nETnrSJxvseJnJsTOd9DnedGnRFMcJ7I",
259 "F5Mp12s3ypiwXTYbx0AYUXgsUWk1GvlMfPdwpIvadyyaPysSvSAArSYcit/FWjhsfwsmmuXAMqmvJRN5",
260 "GIIQkzxJ5vphTu0KIOSg73yq/FOU7T4OMudFJ0vNvHfKN3D3jmnRxYAjUxObT1rupx9v9hmVpnpaZYHC",
261 "YzJfY8RFOAz1281pWYhUfbaubsbdMiYXrUpMDaytWdsKuK0v9dRssdHa1pKtQ+hdDb3tPQRpG0HaewjS",
262 "NoK0z/cgcX4AADsALFxnJwfS3p2AtPQk7mhWocWTFc0qdlxoUk30COrV1C5IIlYXvAxQVogsFu43TaHP",
263 "7G/et9WIKMUyjBuvv3s+GUaICGQOKjpksr/PcHqIQpY0dEt1vGtgsZTIf8CocvLtM9HV+rsWv4Q1RT3U",
264 "4Ica/BD8qhrcfqP7M4vIZI4wRfCZCKk8ZMcwaFYOadTzL/18bPqZ/6eRb5ceQAp8CsdazX/9CgHQ3MDv",
265 "1BT4DqF4pF9n1cOx5TGteQTQbBZgGumHoMX92sq9SJ5FumBvEGq2DcqXBmMWzXUctya51wz1jVI89HJ+",
266 "DzhxaBgcGgbfFK1cR+KpAhD9sKPI8daeDzkf9dsWS0p/p6PI7gm9n/9BE/rfVWv7uxcUdTSogKiJBFuQ",
267 "5gAWB7A4gMW37S4Xb2TK4Gzel2y4zHFcZ4Y5weOkerKlZhq3Ltiq3qfAZ5xmCXghS51m+CgWPvlC+413",
268 "3nih3el0PMXzx8V/AgAA///zJgSKrkQAAA==",
271 // GetSwagger returns the content of the embedded swagger specification file
272 // or error if failed to decode
273 func decodeSpec() ([]byte, error) {
274 zipped, err := base64.StdEncoding.DecodeString(strings.Join(swaggerSpec, ""))
276 return nil, fmt.Errorf("error base64 decoding spec: %s", err)
278 zr, err := gzip.NewReader(bytes.NewReader(zipped))
280 return nil, fmt.Errorf("error decompressing spec: %s", err)
283 _, err = buf.ReadFrom(zr)
285 return nil, fmt.Errorf("error decompressing spec: %s", err)
288 return buf.Bytes(), nil
291 var rawSpec = decodeSpecCached()
293 // a naive cached of a decoded swagger spec
294 func decodeSpecCached() func() ([]byte, error) {
295 data, err := decodeSpec()
296 return func() ([]byte, error) {
301 // Constructs a synthetic filesystem for resolving external references when loading openapi specifications.
302 func PathToRawSpec(pathToFile string) map[string]func() ([]byte, error) {
303 var res = make(map[string]func() ([]byte, error))
304 if len(pathToFile) > 0 {
305 res[pathToFile] = rawSpec
308 pathPrefix := path.Dir(pathToFile)
310 for rawPath, rawFunc := range externalRef0.PathToRawSpec(path.Join(pathPrefix, "CommonData.yaml")) {
311 if _, ok := res[rawPath]; ok {
312 // it is not possible to compare functions in golang, so always overwrite the old value
314 res[rawPath] = rawFunc
316 for rawPath, rawFunc := range externalRef1.PathToRawSpec(path.Join(pathPrefix, "TS29122_CommonData.yaml")) {
317 if _, ok := res[rawPath]; ok {
318 // it is not possible to compare functions in golang, so always overwrite the old value
320 res[rawPath] = rawFunc
322 for rawPath, rawFunc := range externalRef2.PathToRawSpec(path.Join(pathPrefix, "TS29571_CommonData.yaml")) {
323 if _, ok := res[rawPath]; ok {
324 // it is not possible to compare functions in golang, so always overwrite the old value
326 res[rawPath] = rawFunc
331 // GetSwagger returns the Swagger specification corresponding to the generated code
332 // in this file. The external references of Swagger specification are resolved.
333 // The logic of resolving external references is tightly connected to "import-mapping" feature.
334 // Externally referenced files must be embedded in the corresponding golang packages.
335 // Urls can be supported but this task was out of the scope.
336 func GetSwagger() (swagger *openapi3.T, err error) {
337 var resolvePath = PathToRawSpec("")
339 loader := openapi3.NewLoader()
340 loader.IsExternalRefsAllowed = true
341 loader.ReadFromURIFunc = func(loader *openapi3.Loader, url *url.URL) ([]byte, error) {
342 var pathToFile = url.String()
343 pathToFile = path.Clean(pathToFile)
344 getSpec, ok := resolvePath[pathToFile]
346 err1 := fmt.Errorf("path not found: %s", pathToFile)
352 specData, err = rawSpec()
356 swagger, err = loader.LoadFromData(specData)