debian-forge-composer/internal/cloudapi/v2/openapi.v2.gen.go
Tom Gundersen c81d0d08ec cloudapi/v2: support logs/manifests endpoints
For now these only work for koji builds.
2022-02-01 20:28:40 +00:00

759 lines
28 KiB
Go

// Package v2 provides primitives to interact with the openapi HTTP API.
//
// Code generated by github.com/deepmap/oapi-codegen version v1.8.2 DO NOT EDIT.
package v2
import (
"bytes"
"compress/gzip"
"encoding/base64"
"fmt"
"net/http"
"net/url"
"path"
"strings"
"github.com/deepmap/oapi-codegen/pkg/runtime"
"github.com/getkin/kin-openapi/openapi3"
"github.com/labstack/echo/v4"
)
const (
BearerScopes = "Bearer.Scopes"
)
// Defines values for ComposeStatusValue.
const (
ComposeStatusValueFailure ComposeStatusValue = "failure"
ComposeStatusValuePending ComposeStatusValue = "pending"
ComposeStatusValueSuccess ComposeStatusValue = "success"
)
// Defines values for ImageStatusValue.
const (
ImageStatusValueBuilding ImageStatusValue = "building"
ImageStatusValueFailure ImageStatusValue = "failure"
ImageStatusValuePending ImageStatusValue = "pending"
ImageStatusValueRegistering ImageStatusValue = "registering"
ImageStatusValueSuccess ImageStatusValue = "success"
ImageStatusValueUploading ImageStatusValue = "uploading"
)
// Defines values for ImageTypes.
const (
ImageTypesAws ImageTypes = "aws"
ImageTypesAzure ImageTypes = "azure"
ImageTypesEdgeCommit ImageTypes = "edge-commit"
ImageTypesEdgeContainer ImageTypes = "edge-container"
ImageTypesEdgeInstaller ImageTypes = "edge-installer"
ImageTypesGcp ImageTypes = "gcp"
ImageTypesGuestImage ImageTypes = "guest-image"
ImageTypesImageInstaller ImageTypes = "image-installer"
ImageTypesVsphere ImageTypes = "vsphere"
)
// Defines values for UploadStatusValue.
const (
UploadStatusValueFailure UploadStatusValue = "failure"
UploadStatusValuePending UploadStatusValue = "pending"
UploadStatusValueRunning UploadStatusValue = "running"
UploadStatusValueSuccess UploadStatusValue = "success"
)
// Defines values for UploadTypes.
const (
UploadTypesAws UploadTypes = "aws"
UploadTypesAwsS3 UploadTypes = "aws.s3"
UploadTypesAzure UploadTypes = "azure"
UploadTypesGcp UploadTypes = "gcp"
)
// AWSEC2UploadOptions defines model for AWSEC2UploadOptions.
type AWSEC2UploadOptions struct {
Region string `json:"region"`
ShareWithAccounts []string `json:"share_with_accounts"`
SnapshotName *string `json:"snapshot_name,omitempty"`
}
// AWSEC2UploadStatus defines model for AWSEC2UploadStatus.
type AWSEC2UploadStatus struct {
Ami string `json:"ami"`
Region string `json:"region"`
}
// AWSS3UploadOptions defines model for AWSS3UploadOptions.
type AWSS3UploadOptions struct {
Region string `json:"region"`
}
// AWSS3UploadStatus defines model for AWSS3UploadStatus.
type AWSS3UploadStatus struct {
Url string `json:"url"`
}
// AzureUploadOptions defines model for AzureUploadOptions.
type AzureUploadOptions struct {
// Name of the uploaded image. It must be unique in the given resource group.
// If name is omitted from the request, a random one based on a UUID is
// generated.
ImageName *string `json:"image_name,omitempty"`
// Location where the image should be uploaded and registered.
// How to list all locations:
// https://docs.microsoft.com/en-us/cli/azure/account?view=azure-cli-latest#az_account_list_locations'
Location string `json:"location"`
// Name of the resource group where the image should be uploaded.
ResourceGroup string `json:"resource_group"`
// ID of subscription where the image should be uploaded.
SubscriptionId string `json:"subscription_id"`
// ID of the tenant where the image should be uploaded.
// How to find it in the Azure Portal:
// https://docs.microsoft.com/en-us/azure/active-directory/fundamentals/active-directory-how-to-find-tenant
TenantId string `json:"tenant_id"`
}
// AzureUploadStatus defines model for AzureUploadStatus.
type AzureUploadStatus struct {
ImageName string `json:"image_name"`
}
// ComposeId defines model for ComposeId.
type ComposeId struct {
// Embedded struct due to allOf(#/components/schemas/ObjectReference)
ObjectReference `yaml:",inline"`
// Embedded fields due to inline allOf schema
Id string `json:"id"`
}
// ComposeLogs defines model for ComposeLogs.
type ComposeLogs struct {
// Embedded struct due to allOf(#/components/schemas/ObjectReference)
ObjectReference `yaml:",inline"`
// Embedded fields due to inline allOf schema
ImageBuilds []interface{} `json:"image_builds"`
Koji *KojiLogs `json:"koji,omitempty"`
}
// ComposeManifests defines model for ComposeManifests.
type ComposeManifests struct {
// Embedded struct due to allOf(#/components/schemas/ObjectReference)
ObjectReference `yaml:",inline"`
// Embedded fields due to inline allOf schema
Manifests []interface{} `json:"manifests"`
}
// ComposeMetadata defines model for ComposeMetadata.
type ComposeMetadata struct {
// Embedded struct due to allOf(#/components/schemas/ObjectReference)
ObjectReference `yaml:",inline"`
// Embedded fields due to inline allOf schema
// ID (hash) of the built commit
OstreeCommit *string `json:"ostree_commit,omitempty"`
// Package list including NEVRA
Packages *[]PackageMetadata `json:"packages,omitempty"`
}
// ComposeRequest defines model for ComposeRequest.
type ComposeRequest struct {
Customizations *Customizations `json:"customizations,omitempty"`
Distribution string `json:"distribution"`
ImageRequest *ImageRequest `json:"image_request,omitempty"`
ImageRequests *[]ImageRequest `json:"image_requests,omitempty"`
Koji *Koji `json:"koji,omitempty"`
}
// ComposeStatus defines model for ComposeStatus.
type ComposeStatus struct {
// Embedded struct due to allOf(#/components/schemas/ObjectReference)
ObjectReference `yaml:",inline"`
// Embedded fields due to inline allOf schema
ImageStatus ImageStatus `json:"image_status"`
ImageStatuses *[]ImageStatus `json:"image_statuses,omitempty"`
KojiStatus *KojiStatus `json:"koji_status,omitempty"`
Status ComposeStatusValue `json:"status"`
}
// ComposeStatusValue defines model for ComposeStatusValue.
type ComposeStatusValue string
// Customizations defines model for Customizations.
type Customizations struct {
Packages *[]string `json:"packages,omitempty"`
PayloadRepositories *[]Repository `json:"payload_repositories,omitempty"`
Subscription *Subscription `json:"subscription,omitempty"`
Users *[]User `json:"users,omitempty"`
}
// Error defines model for Error.
type Error struct {
// Embedded struct due to allOf(#/components/schemas/ObjectReference)
ObjectReference `yaml:",inline"`
// Embedded fields due to inline allOf schema
Code string `json:"code"`
OperationId string `json:"operation_id"`
Reason string `json:"reason"`
}
// ErrorList defines model for ErrorList.
type ErrorList struct {
// Embedded struct due to allOf(#/components/schemas/List)
List `yaml:",inline"`
// Embedded fields due to inline allOf schema
Items []Error `json:"items"`
}
// GCPUploadOptions defines model for GCPUploadOptions.
type GCPUploadOptions struct {
// Name of an existing STANDARD Storage class Bucket.
Bucket string `json:"bucket"`
// The name to use for the imported and shared Compute Engine image.
// The image name must be unique within the GCP project, which is used
// for the OS image upload and import. If not specified a random
// 'composer-api-<uuid>' string is used as the image name.
ImageName *string `json:"image_name,omitempty"`
// The GCP region where the OS image will be imported to and shared from.
// The value must be a valid GCP location. See https://cloud.google.com/storage/docs/locations.
// If not specified, the multi-region location closest to the source
// (source Storage Bucket location) is chosen automatically.
Region string `json:"region"`
// List of valid Google accounts to share the imported Compute Engine image with.
// Each string must contain a specifier of the account type. Valid formats are:
// - 'user:{emailid}': An email address that represents a specific
// Google account. For example, 'alice@example.com'.
// - 'serviceAccount:{emailid}': An email address that represents a
// service account. For example, 'my-other-app@appspot.gserviceaccount.com'.
// - 'group:{emailid}': An email address that represents a Google group.
// For example, 'admins@example.com'.
// - 'domain:{domain}': The G Suite domain (primary) that represents all
// the users of that domain. For example, 'google.com' or 'example.com'.
// If not specified, the imported Compute Engine image is not shared with any
// account.
ShareWithAccounts *[]string `json:"share_with_accounts,omitempty"`
}
// GCPUploadStatus defines model for GCPUploadStatus.
type GCPUploadStatus struct {
ImageName string `json:"image_name"`
ProjectId string `json:"project_id"`
}
// ImageRequest defines model for ImageRequest.
type ImageRequest struct {
Architecture string `json:"architecture"`
ImageType ImageTypes `json:"image_type"`
Ostree *OSTree `json:"ostree,omitempty"`
Repositories []Repository `json:"repositories"`
UploadOptions *UploadOptions `json:"upload_options,omitempty"`
}
// ImageStatus defines model for ImageStatus.
type ImageStatus struct {
Status ImageStatusValue `json:"status"`
UploadStatus *UploadStatus `json:"upload_status,omitempty"`
}
// ImageStatusValue defines model for ImageStatusValue.
type ImageStatusValue string
// ImageTypes defines model for ImageTypes.
type ImageTypes string
// Koji defines model for Koji.
type Koji struct {
Name string `json:"name"`
Release string `json:"release"`
Server string `json:"server"`
TaskId int `json:"task_id"`
Version string `json:"version"`
}
// KojiLogs defines model for KojiLogs.
type KojiLogs struct {
Import interface{} `json:"import"`
Init interface{} `json:"init"`
}
// KojiStatus defines model for KojiStatus.
type KojiStatus struct {
BuildId *int `json:"build_id,omitempty"`
}
// List defines model for List.
type List struct {
Kind string `json:"kind"`
Page int `json:"page"`
Size int `json:"size"`
Total int `json:"total"`
}
// OSTree defines model for OSTree.
type OSTree struct {
Ref *string `json:"ref,omitempty"`
Url *string `json:"url,omitempty"`
}
// ObjectReference defines model for ObjectReference.
type ObjectReference struct {
Href string `json:"href"`
Id string `json:"id"`
Kind string `json:"kind"`
}
// PackageMetadata defines model for PackageMetadata.
type PackageMetadata struct {
Arch string `json:"arch"`
Epoch *string `json:"epoch,omitempty"`
Name string `json:"name"`
Release string `json:"release"`
Sigmd5 string `json:"sigmd5"`
Signature *string `json:"signature,omitempty"`
Type string `json:"type"`
Version string `json:"version"`
}
// Repository defines model for Repository.
type Repository struct {
Baseurl *string `json:"baseurl,omitempty"`
CheckGpg *bool `json:"check_gpg,omitempty"`
GpgKey *string `json:"gpg_key,omitempty"`
IgnoreSsl *bool `json:"ignore_ssl,omitempty"`
Metalink *string `json:"metalink,omitempty"`
Mirrorlist *string `json:"mirrorlist,omitempty"`
Rhsm bool `json:"rhsm"`
}
// Subscription defines model for Subscription.
type Subscription struct {
ActivationKey string `json:"activation_key"`
BaseUrl string `json:"base_url"`
Insights bool `json:"insights"`
Organization string `json:"organization"`
ServerUrl string `json:"server_url"`
}
// UploadOptions defines model for UploadOptions.
type UploadOptions interface{}
// UploadStatus defines model for UploadStatus.
type UploadStatus struct {
Options interface{} `json:"options"`
Status UploadStatusValue `json:"status"`
Type UploadTypes `json:"type"`
}
// UploadStatusValue defines model for UploadStatusValue.
type UploadStatusValue string
// UploadTypes defines model for UploadTypes.
type UploadTypes string
// User defines model for User.
type User struct {
// Embedded struct due to allOf(#/components/schemas/ObjectReference)
ObjectReference `yaml:",inline"`
// Embedded fields due to inline allOf schema
Groups *[]string `json:"groups,omitempty"`
Key *string `json:"key,omitempty"`
Name string `json:"name"`
}
// Page defines model for page.
type Page string
// Size defines model for size.
type Size string
// PostComposeJSONBody defines parameters for PostCompose.
type PostComposeJSONBody ComposeRequest
// GetErrorListParams defines parameters for GetErrorList.
type GetErrorListParams struct {
// Page index
Page *Page `json:"page,omitempty"`
// Number of items in each page
Size *Size `json:"size,omitempty"`
}
// PostComposeJSONRequestBody defines body for PostCompose for application/json ContentType.
type PostComposeJSONRequestBody PostComposeJSONBody
// ServerInterface represents all server handlers.
type ServerInterface interface {
// Create compose
// (POST /compose)
PostCompose(ctx echo.Context) error
// The status of a compose
// (GET /composes/{id})
GetComposeStatus(ctx echo.Context, id string) error
// Get logs for a compose.
// (GET /composes/{id}/logs)
GetComposeLogs(ctx echo.Context, id string) error
// Get the manifests for a compose.
// (GET /composes/{id}/manifests)
GetComposeManifests(ctx echo.Context, id string) error
// Get the metadata for a compose.
// (GET /composes/{id}/metadata)
GetComposeMetadata(ctx echo.Context, id string) error
// Get a list of all possible errors
// (GET /errors)
GetErrorList(ctx echo.Context, params GetErrorListParams) error
// Get error description
// (GET /errors/{id})
GetError(ctx echo.Context, id string) error
// Get the openapi spec in json format
// (GET /openapi)
GetOpenapi(ctx echo.Context) error
}
// ServerInterfaceWrapper converts echo contexts to parameters.
type ServerInterfaceWrapper struct {
Handler ServerInterface
}
// PostCompose converts echo context to params.
func (w *ServerInterfaceWrapper) PostCompose(ctx echo.Context) error {
var err error
ctx.Set(BearerScopes, []string{""})
// Invoke the callback with all the unmarshalled arguments
err = w.Handler.PostCompose(ctx)
return err
}
// GetComposeStatus converts echo context to params.
func (w *ServerInterfaceWrapper) GetComposeStatus(ctx echo.Context) error {
var err error
// ------------- Path parameter "id" -------------
var id string
err = runtime.BindStyledParameterWithLocation("simple", false, "id", runtime.ParamLocationPath, ctx.Param("id"), &id)
if err != nil {
return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter id: %s", err))
}
ctx.Set(BearerScopes, []string{""})
// Invoke the callback with all the unmarshalled arguments
err = w.Handler.GetComposeStatus(ctx, id)
return err
}
// GetComposeLogs converts echo context to params.
func (w *ServerInterfaceWrapper) GetComposeLogs(ctx echo.Context) error {
var err error
// ------------- Path parameter "id" -------------
var id string
err = runtime.BindStyledParameterWithLocation("simple", false, "id", runtime.ParamLocationPath, ctx.Param("id"), &id)
if err != nil {
return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter id: %s", err))
}
// Invoke the callback with all the unmarshalled arguments
err = w.Handler.GetComposeLogs(ctx, id)
return err
}
// GetComposeManifests converts echo context to params.
func (w *ServerInterfaceWrapper) GetComposeManifests(ctx echo.Context) error {
var err error
// ------------- Path parameter "id" -------------
var id string
err = runtime.BindStyledParameterWithLocation("simple", false, "id", runtime.ParamLocationPath, ctx.Param("id"), &id)
if err != nil {
return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter id: %s", err))
}
// Invoke the callback with all the unmarshalled arguments
err = w.Handler.GetComposeManifests(ctx, id)
return err
}
// GetComposeMetadata converts echo context to params.
func (w *ServerInterfaceWrapper) GetComposeMetadata(ctx echo.Context) error {
var err error
// ------------- Path parameter "id" -------------
var id string
err = runtime.BindStyledParameterWithLocation("simple", false, "id", runtime.ParamLocationPath, ctx.Param("id"), &id)
if err != nil {
return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter id: %s", err))
}
ctx.Set(BearerScopes, []string{""})
// Invoke the callback with all the unmarshalled arguments
err = w.Handler.GetComposeMetadata(ctx, id)
return err
}
// GetErrorList converts echo context to params.
func (w *ServerInterfaceWrapper) GetErrorList(ctx echo.Context) error {
var err error
ctx.Set(BearerScopes, []string{""})
// Parameter object where we will unmarshal all parameters from the context
var params GetErrorListParams
// ------------- Optional query parameter "page" -------------
err = runtime.BindQueryParameter("form", true, false, "page", ctx.QueryParams(), &params.Page)
if err != nil {
return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter page: %s", err))
}
// ------------- Optional query parameter "size" -------------
err = runtime.BindQueryParameter("form", true, false, "size", ctx.QueryParams(), &params.Size)
if err != nil {
return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter size: %s", err))
}
// Invoke the callback with all the unmarshalled arguments
err = w.Handler.GetErrorList(ctx, params)
return err
}
// GetError converts echo context to params.
func (w *ServerInterfaceWrapper) GetError(ctx echo.Context) error {
var err error
// ------------- Path parameter "id" -------------
var id string
err = runtime.BindStyledParameterWithLocation("simple", false, "id", runtime.ParamLocationPath, ctx.Param("id"), &id)
if err != nil {
return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter id: %s", err))
}
ctx.Set(BearerScopes, []string{""})
// Invoke the callback with all the unmarshalled arguments
err = w.Handler.GetError(ctx, id)
return err
}
// GetOpenapi converts echo context to params.
func (w *ServerInterfaceWrapper) GetOpenapi(ctx echo.Context) error {
var err error
ctx.Set(BearerScopes, []string{""})
// Invoke the callback with all the unmarshalled arguments
err = w.Handler.GetOpenapi(ctx)
return err
}
// This is a simple interface which specifies echo.Route addition functions which
// are present on both echo.Echo and echo.Group, since we want to allow using
// either of them for path registration
type EchoRouter interface {
CONNECT(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
DELETE(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
GET(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
HEAD(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
OPTIONS(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
PATCH(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
POST(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
PUT(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
TRACE(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
}
// RegisterHandlers adds each server route to the EchoRouter.
func RegisterHandlers(router EchoRouter, si ServerInterface) {
RegisterHandlersWithBaseURL(router, si, "")
}
// Registers handlers, and prepends BaseURL to the paths, so that the paths
// can be served under a prefix.
func RegisterHandlersWithBaseURL(router EchoRouter, si ServerInterface, baseURL string) {
wrapper := ServerInterfaceWrapper{
Handler: si,
}
router.POST(baseURL+"/compose", wrapper.PostCompose)
router.GET(baseURL+"/composes/:id", wrapper.GetComposeStatus)
router.GET(baseURL+"/composes/:id/logs", wrapper.GetComposeLogs)
router.GET(baseURL+"/composes/:id/manifests", wrapper.GetComposeManifests)
router.GET(baseURL+"/composes/:id/metadata", wrapper.GetComposeMetadata)
router.GET(baseURL+"/errors", wrapper.GetErrorList)
router.GET(baseURL+"/errors/:id", wrapper.GetError)
router.GET(baseURL+"/openapi", wrapper.GetOpenapi)
}
// Base64 encoded, gzipped, json marshaled Swagger object
var swaggerSpec = []string{
"H4sIAAAAAAAC/+xce2/ctrL/KoTOBdziSrvyPhx7gaLHcdwct0kc2E4P7o0NgyvNrhhLpEpSXm8Cf/cL",
"PqTVg/tw6/bcc+B/Gq9Ezgx/nBnOg+o3L2JZzihQKbzJNy/HHGcggdtfc1D/xiAiTnJJGPUm3kc8B0Ro",
"DA+e78EDzvIUGsPvcVqAN/H2vcdH3yNqzm8F8KXnexRn6o0e6XsiSiDDaopc5uq5kJzQuZ4myFcH7w9F",
"NgWO2AwRCZlAhCLAUYIswbo0JYFKmjBcK48eu0mex/KlJn38z8vTk8GnPGU4PteimfVzlgOXxPDnMNcy",
"fyul8iYeFMEChAz2Pb/NwvdEgjncLohMbnEUscJuSTX7s7c/GI7GB68Oj8L9gXfjexoDh7gVccw5Xmra",
"FOciYfLWLLguU7YMyrddqR59j8NvBeEQKwHsmtyy3lSz2fQLRFLxrSN1KbEsHEDhjDQlwhkJwuhwGL46",
"Gr56NR4fjePR1IXYEyFuLUbxrWisEf5y+Ly77MZzC/N1wBU8ddtOnYUa5KT/teCwZXEkw3OoVKZli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mQ+OKri",
"Y0IRZSjHXJKoSDG39znQdzJhxTyx10x+vjz/8H3P7R8lPMh+nmLSEtrxweBuXnD0XAxcNv5YN6O3+u6O",
"Baeyop7LjBo32zfaUjVyB3O6AFlwKvQHXOU8LYxOQexlCFr/6quH9IWdanDEtGGJ8qaS3b4YZoRCjLBE",
"9eSNCZ0LmhIvpn37OyjJ9cYbTHH1xcCLPW61xxVYa4yysd0dw/zPtLWmeexgdLXW1mabswONyXXszNws",
"hAccycZBxLX5QYxiyIHGyg7rtlZ+vmnuu22yjFLOF8PYbhjVhyxr7KLcyqfYxUuM/hKj/3+L0Tu+yeXv",
"NPF6TNFxMatPAzrOxbWy1ZC+vmSxrnlSG6dvYfyppr9ag0vbzedxbIYsGC9m9q8xM6Po/35GhisFwmmK",
"ciYEmaZQadPKzLYX9DA1LRIaVd/3G8lWX15Ml0gfnW5D3S0CqOj+0VN/+Bef4dVWvtjoi40+xUbN3Dpp",
"bZdVw2/9+Xduh7i1uimsJaetVeXNCgObEf87Rg4bl/NYXbdx+Zn39iMPFheR+TKpuvzabOninPQUH5EQ",
"+3/OwDnpm2vJujYAPCi/MOvfD3Q80Wo0SzwndL6JgZB4Dn+QjQaRlh+hVGy20bl5/L8AAAD//9iASyXR",
"SwAA",
}
// GetSwagger returns the content of the embedded swagger specification file
// or error if failed to decode
func decodeSpec() ([]byte, error) {
zipped, err := base64.StdEncoding.DecodeString(strings.Join(swaggerSpec, ""))
if err != nil {
return nil, fmt.Errorf("error base64 decoding spec: %s", err)
}
zr, err := gzip.NewReader(bytes.NewReader(zipped))
if err != nil {
return nil, fmt.Errorf("error decompressing spec: %s", err)
}
var buf bytes.Buffer
_, err = buf.ReadFrom(zr)
if err != nil {
return nil, fmt.Errorf("error decompressing spec: %s", err)
}
return buf.Bytes(), nil
}
var rawSpec = decodeSpecCached()
// a naive cached of a decoded swagger spec
func decodeSpecCached() func() ([]byte, error) {
data, err := decodeSpec()
return func() ([]byte, error) {
return data, err
}
}
// Constructs a synthetic filesystem for resolving external references when loading openapi specifications.
func PathToRawSpec(pathToFile string) map[string]func() ([]byte, error) {
var res = make(map[string]func() ([]byte, error))
if len(pathToFile) > 0 {
res[pathToFile] = rawSpec
}
return res
}
// GetSwagger returns the Swagger specification corresponding to the generated code
// in this file. The external references of Swagger specification are resolved.
// The logic of resolving external references is tightly connected to "import-mapping" feature.
// Externally referenced files must be embedded in the corresponding golang packages.
// Urls can be supported but this task was out of the scope.
func GetSwagger() (swagger *openapi3.T, err error) {
var resolvePath = PathToRawSpec("")
loader := openapi3.NewLoader()
loader.IsExternalRefsAllowed = true
loader.ReadFromURIFunc = func(loader *openapi3.Loader, url *url.URL) ([]byte, error) {
var pathToFile = url.String()
pathToFile = path.Clean(pathToFile)
getSpec, ok := resolvePath[pathToFile]
if !ok {
err1 := fmt.Errorf("path not found: %s", pathToFile)
return nil, err1
}
return getSpec()
}
var specData []byte
specData, err = rawSpec()
if err != nil {
return
}
swagger, err = loader.LoadFromData(specData)
if err != nil {
return
}
return
}