debian-forge-composer/internal/cloudapi/v2/openapi.v2.gen.go
Chloe Kaubisch 296313f588 cloudapi: specify min_size type
In the filesystem object, use x-go-type to specify
uint64 as the type for the min_size field. Avoids
a type conversion in v2.go.
2022-04-14 10:03:06 +02:00

826 lines
31 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"
ImageTypesAwsHaRhui ImageTypes = "aws-ha-rhui"
ImageTypesAwsRhui ImageTypes = "aws-rhui"
ImageTypesAwsSapRhui ImageTypes = "aws-sap-rhui"
ImageTypesAzure ImageTypes = "azure"
ImageTypesAzureRhui ImageTypes = "azure-rhui"
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"`
}
// ComposeStatusError defines model for ComposeStatusError.
type ComposeStatusError struct {
Details *interface{} `json:"details,omitempty"`
Id int `json:"id"`
Reason string `json:"reason"`
}
// ComposeStatusValue defines model for ComposeStatusValue.
type ComposeStatusValue string
// Customizations defines model for Customizations.
type Customizations struct {
Filesystem *[]Filesystem `json:"filesystem,omitempty"`
Packages *[]string `json:"packages,omitempty"`
// Extra repositories for packages specified in customizations. These
// repositories will only be used to depsolve and retrieve packages
// for the OS itself (they will not be available for the build root or
// any other part of the build process). The package_sets field for these
// repositories is ignored.
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"`
}
// Filesystem defines model for Filesystem.
type Filesystem struct {
MinSize uint64 `json:"min_size"`
Mountpoint string `json:"mountpoint"`
}
// 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 {
Error *ComposeStatusError `json:"error,omitempty"`
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 {
Parent *string `json:"parent,omitempty"`
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"`
// GPG key used to sign packages in this repository.
Gpgkey *string `json:"gpgkey,omitempty"`
IgnoreSsl *bool `json:"ignore_ssl,omitempty"`
Metalink *string `json:"metalink,omitempty"`
Mirrorlist *string `json:"mirrorlist,omitempty"`
// Naming package sets for a repository assigns it to a specific part
// (pipeline) of the build process.
PackageSets *[]string `json:"package_sets,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/+x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PtIKa",
"2vbg9ub3dHx8FGglMq4N8Z7QMb/wcVoULPwsBnE+/iPqRk1VqGyGeGVo5XFutHMV9UNf2rQ8wZ36SHiM",
"cPWLC2E/JYzaggSVnyT6Mw1poKqTN411qhyLh2XZwfQZaIoJMgAUILp5o1ztBX2wGpJM8D0VkksXP3DF",
"7RXfX/74qT9ulXXEKXem+8Ax///0tV33OMHpIjUpH/tc0NB3uQM/869RoBXUxc5CxJT7IQMYyEXEkH4Y",
"9bXw91b84v6PPCOU85djfO4Ym5vnR/winMqv+MWvHP1Xjv7/Wo5+EJvi4p0iHs0pDkLM9u7mQXCJG9m2",
"SUZVeB47PIm0UyWg/1bX344hztr937OgUxAo45eb/XfczDf0/z0ngxsDgrYNXMo5nthoY01bN/sc0IPE",
"PyIh+uYHuXzJttdMJ2ugls54Rz0tA9jQ/VdX/fx/eA3fTOUvH/3lo1/xUb9vlLTyy82B3/H17zZoEm/V",
"u8IG5JS3yn2z1EGwI/5fzBw+HM6PTblNXJzpBTdaqeHp/jXszc2b3SNd6OK05MMtHPzUHXRxxr8TpbAB",
"xFLhdfrMIqfyib2DZgFNTMyPGHABTfQvslFKJOGN2w2bz+h8//F/AwAA//+soao5glcAAA==",
}
// 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
}