Files
query-orchestration/api/queryAPI/api.gen.go
T
Michael McGuinness 3dd0c718cd Merged in feature/openapifixes (pull request #106)
OpenAPI Middleware & Fixes

* updates
2025-03-18 13:06:42 +00:00

867 lines
30 KiB
Go

// Package queryapi provides primitives to interact with the openapi HTTP API.
//
// Code generated by github.com/oapi-codegen/oapi-codegen/v2 version 2.4.1 DO NOT EDIT.
package queryapi
import (
"bytes"
"compress/gzip"
"encoding/base64"
"fmt"
"net/http"
"net/url"
"path"
"strings"
"time"
"github.com/getkin/kin-openapi/openapi3"
"github.com/labstack/echo/v4"
"github.com/oapi-codegen/runtime"
openapi_types "github.com/oapi-codegen/runtime/types"
)
const (
PlaceholderAuthScopes = "placeholderAuth.Scopes"
)
// Defines values for ClientStatus.
const (
INSYNC ClientStatus = "IN_SYNC"
NOTSYNCED ClientStatus = "NOT_SYNCED"
NOTSYNCING ClientStatus = "NOT_SYNCING"
)
// Defines values for ExportStatus.
const (
Completed ExportStatus = "completed"
Failed ExportStatus = "failed"
InProgress ExportStatus = "in_progress"
)
// Defines values for FieldFilterCondition.
const (
ClosedInterval FieldFilterCondition = "closed_interval"
Exclude FieldFilterCondition = "exclude"
GreaterThan FieldFilterCondition = "greater_than"
Include FieldFilterCondition = "include"
LeftClosedInterval FieldFilterCondition = "left_closed_interval"
LessThan FieldFilterCondition = "less_than"
OpenInterval FieldFilterCondition = "open_interval"
RightClosedInterval FieldFilterCondition = "right_closed_interval"
)
// Defines values for QueryType.
const (
CONTEXTFULL QueryType = "CONTEXT_FULL"
JSONEXTRACTOR QueryType = "JSON_EXTRACTOR"
)
// ClientCanSync If the client is allowing active syncs
type ClientCanSync = bool
// ClientCreate The properties for creation.
type ClientCreate struct {
// Id The client external id
Id ClientID `json:"id"`
// Name The client name
Name ClientName `json:"name"`
}
// ClientID The client external id
type ClientID = string
// ClientIDBody The client id.
type ClientIDBody struct {
// Id The client external id
Id ClientID `json:"id"`
}
// ClientName The client name
type ClientName = string
// ClientStatus Specifies the status of a client.
type ClientStatus string
// ClientStatusBody A client status information object.
type ClientStatusBody struct {
// Status Specifies the status of a client.
Status ClientStatus `json:"status"`
}
// ClientUID The client internal unique id
type ClientUID = openapi_types.UUID
// ClientUpdate The properties that may be updated.
type ClientUpdate struct {
// CanSync If the client is allowing active syncs
CanSync *ClientCanSync `json:"can_sync,omitempty"`
// Name The client name
Name *ClientName `json:"name,omitempty"`
}
// CodeVersion The desired code version.
type CodeVersion = int64
// Collector Collector model.
type Collector struct {
// ActiveVersion The desired version.
ActiveVersion Version `json:"active_version"`
// ClientId The client external id
ClientId ClientID `json:"client_id"`
// Fields The fields in the collector.
Fields CollectorFields `json:"fields"`
// LatestVersion The desired version.
LatestVersion Version `json:"latest_version"`
// MinimumCleanerVersion The desired code version.
MinimumCleanerVersion CodeVersion `json:"minimum_cleaner_version"`
// MinimumTextVersion The desired code version.
MinimumTextVersion CodeVersion `json:"minimum_text_version"`
}
// CollectorField The field properties for the collector.
type CollectorField struct {
// Name The output field name.
Name CollectorFieldName `json:"name"`
// QueryId The query id.
QueryId QueryID `json:"query_id"`
}
// CollectorFieldName The output field name.
type CollectorFieldName = string
// CollectorFields The fields in the collector.
type CollectorFields = []CollectorField
// CollectorSet Payload for updating a Collector.
type CollectorSet struct {
// ActiveVersion The desired version.
ActiveVersion *Version `json:"active_version,omitempty"`
// Fields The fields in the collector.
Fields *CollectorFields `json:"fields,omitempty"`
// MinimumCleanerVersion The desired code version.
MinimumCleanerVersion *CodeVersion `json:"minimum_cleaner_version,omitempty"`
// MinimumTextVersion The desired code version.
MinimumTextVersion *CodeVersion `json:"minimum_text_version,omitempty"`
}
// DocClient The properties of a client.
type DocClient struct {
// CanSync If the client is allowing active syncs
CanSync ClientCanSync `json:"can_sync"`
// Id The client external id
Id ClientID `json:"id"`
// Name The client name
Name ClientName `json:"name"`
// Uid The client internal unique id
Uid ClientUID `json:"uid"`
}
// Document The document properties.
type Document struct {
// ClientId The client external id
ClientId ClientID `json:"client_id"`
// Fields The fields and the value for the document
Fields map[string]interface{} `json:"fields"`
// Hash The document hash
Hash Hash `json:"hash"`
// Id The document id.
Id DocumentID `json:"id"`
}
// DocumentID The document id.
type DocumentID = openapi_types.UUID
// DocumentSummary The document summary properties.
type DocumentSummary struct {
// Hash The document hash
Hash Hash `json:"hash"`
// Id The document id.
Id DocumentID `json:"id"`
}
// ErrorMessage Description of error
type ErrorMessage struct {
// Message Message describing the cause.
Message string `json:"message"`
}
// ExportDetails Payload for export trigger response.
type ExportDetails struct {
// ClientId The client external id
ClientId ClientID `json:"client_id"`
// OutputLocation The location in which the export zip file will be found.
OutputLocation *string `json:"output_location,omitempty"`
// Status The possible export states.
Status ExportStatus `json:"status"`
}
// ExportID The export id.
type ExportID = openapi_types.UUID
// ExportStatus The possible export states.
type ExportStatus string
// ExportTrigger Payload for triggering an export.
type ExportTrigger struct {
// FieldFilters Filter the scope based on field output values.
FieldFilters *[]FieldFilter `json:"field_filters,omitempty"`
// IngestionFilters Filter the scope based on ingestion parameters.
IngestionFilters *struct {
// EndDate The last date of ingestion.
EndDate *time.Time `json:"end_date,omitempty"`
// StartDate This first date of ingestion.
StartDate *time.Time `json:"start_date,omitempty"`
} `json:"ingestion_filters,omitempty"`
}
// FieldFilter Filtering a column
type FieldFilter struct {
// Condition The possible field filtering conditions.
Condition FieldFilterCondition `json:"condition"`
// FieldName The output field name.
FieldName CollectorFieldName `json:"field_name"`
// Values The values useful to the filter.
Values []string `json:"values"`
}
// FieldFilterCondition The possible field filtering conditions.
type FieldFilterCondition string
// Hash The document hash
type Hash = string
// IdMessage A single uuid.
type IdMessage struct {
// Id Unique identifier for entity.
Id openapi_types.UUID `json:"id"`
}
// ListDocuments The documents in the client.
type ListDocuments = []DocumentSummary
// ListQueries A set of queries.
type ListQueries struct {
// Queries List of queries.
Queries []Query `json:"queries"`
}
// Query A logic unit of execution.
type Query struct {
// ActiveVersion The desired version.
ActiveVersion Version `json:"active_version"`
// Config Configuration for the query.
Config *QueryConfig `json:"config,omitempty"`
// Id The query id.
Id QueryID `json:"id"`
// LatestVersion The desired version.
LatestVersion Version `json:"latest_version"`
// RequiredQueries List of required query IDs.
RequiredQueries *RequiredQueryIDs `json:"required_queries,omitempty"`
// Type Specifies the type of the query.
Type QueryType `json:"type"`
}
// QueryConfig Configuration for the query.
type QueryConfig = string
// QueryCreate The parameters required to create a query.
type QueryCreate struct {
// Config Configuration for the query.
Config *QueryConfig `json:"config,omitempty"`
// RequiredQueries List of required query IDs.
RequiredQueries *RequiredQueryIDs `json:"required_queries,omitempty"`
// Type Specifies the type of the query.
Type QueryType `json:"type"`
}
// QueryID The query id.
type QueryID = openapi_types.UUID
// QueryTestRequest The properties for a query test request.
type QueryTestRequest struct {
// DocumentId The document id.
DocumentId DocumentID `json:"document_id"`
// QueryVersion The desired version.
QueryVersion Version `json:"query_version"`
}
// QueryTestResponse The response from a query test.
type QueryTestResponse struct {
// Value Result of the query test.
Value string `json:"value"`
}
// QueryType Specifies the type of the query.
type QueryType string
// QueryUpdate The properties that may be updated for a query.
type QueryUpdate struct {
// ActiveVersion The desired version.
ActiveVersion *Version `json:"active_version,omitempty"`
// Config Configuration for the query.
Config *QueryConfig `json:"config,omitempty"`
// RequiredQueries List of required query IDs.
RequiredQueries *RequiredQueryIDs `json:"required_queries,omitempty"`
}
// RequiredQueryIDs List of required query IDs.
type RequiredQueryIDs = []QueryID
// Version The desired version.
type Version = int32
// InternalError Description of error
type InternalError = ErrorMessage
// InvalidRequest Description of error
type InvalidRequest = ErrorMessage
// TooManyRequests Description of error
type TooManyRequests = ErrorMessage
// Unauthorized Description of error
type Unauthorized = ErrorMessage
// CreateClientJSONRequestBody defines body for CreateClient for application/json ContentType.
type CreateClientJSONRequestBody = ClientCreate
// UpdateClientJSONRequestBody defines body for UpdateClient for application/json ContentType.
type UpdateClientJSONRequestBody = ClientUpdate
// SetCollectorByClientIdJSONRequestBody defines body for SetCollectorByClientId for application/json ContentType.
type SetCollectorByClientIdJSONRequestBody = CollectorSet
// TriggerExportJSONRequestBody defines body for TriggerExport for application/json ContentType.
type TriggerExportJSONRequestBody = ExportTrigger
// CreateQueryJSONRequestBody defines body for CreateQuery for application/json ContentType.
type CreateQueryJSONRequestBody = QueryCreate
// UpdateQueryJSONRequestBody defines body for UpdateQuery for application/json ContentType.
type UpdateQueryJSONRequestBody = QueryUpdate
// TestQueryJSONRequestBody defines body for TestQuery for application/json ContentType.
type TestQueryJSONRequestBody = QueryTestRequest
// ServerInterface represents all server handlers.
type ServerInterface interface {
// Create a new client
// (POST /client)
CreateClient(ctx echo.Context) error
// Get a client by ID
// (GET /client/{id})
GetClient(ctx echo.Context, id ClientID) error
// Update a client
// (PATCH /client/{id})
UpdateClient(ctx echo.Context, id ClientID) error
// Get a collector by client ID
// (GET /client/{id}/collector)
GetCollectorByClientId(ctx echo.Context, id ClientID) error
// Set a collector
// (PATCH /client/{id}/collector)
SetCollectorByClientId(ctx echo.Context, id ClientID) error
// List the documents for a client
// (GET /client/{id}/documents)
ListDocumentsByClientId(ctx echo.Context, id ClientID) error
// Trigger an export
// (POST /client/{id}/export)
TriggerExport(ctx echo.Context, id ClientID) error
// Get client sync status
// (GET /client/{id}/status)
GetStatusByClientId(ctx echo.Context, id ClientID) error
// Get document details by its id
// (GET /document/{id})
GetDocument(ctx echo.Context, id DocumentID) error
// Check export state.
// (GET /export/{id})
ExportState(ctx echo.Context, id ExportID) error
// List queries
// (GET /query)
ListQueries(ctx echo.Context) error
// Create a new query
// (POST /query)
CreateQuery(ctx echo.Context) error
// Get a query by ID
// (GET /query/{id})
GetQuery(ctx echo.Context, id QueryID) error
// Update a query
// (PATCH /query/{id})
UpdateQuery(ctx echo.Context, id QueryID) error
// Test a query
// (POST /query/{id}/test)
TestQuery(ctx echo.Context, id QueryID) error
}
// ServerInterfaceWrapper converts echo contexts to parameters.
type ServerInterfaceWrapper struct {
Handler ServerInterface
}
// CreateClient converts echo context to params.
func (w *ServerInterfaceWrapper) CreateClient(ctx echo.Context) error {
var err error
ctx.Set(PlaceholderAuthScopes, []string{})
// Invoke the callback with all the unmarshaled arguments
err = w.Handler.CreateClient(ctx)
return err
}
// GetClient converts echo context to params.
func (w *ServerInterfaceWrapper) GetClient(ctx echo.Context) error {
var err error
// ------------- Path parameter "id" -------------
var id ClientID
err = runtime.BindStyledParameterWithOptions("simple", "id", ctx.Param("id"), &id, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true})
if err != nil {
return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter id: %s", err))
}
ctx.Set(PlaceholderAuthScopes, []string{})
// Invoke the callback with all the unmarshaled arguments
err = w.Handler.GetClient(ctx, id)
return err
}
// UpdateClient converts echo context to params.
func (w *ServerInterfaceWrapper) UpdateClient(ctx echo.Context) error {
var err error
// ------------- Path parameter "id" -------------
var id ClientID
err = runtime.BindStyledParameterWithOptions("simple", "id", ctx.Param("id"), &id, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true})
if err != nil {
return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter id: %s", err))
}
ctx.Set(PlaceholderAuthScopes, []string{})
// Invoke the callback with all the unmarshaled arguments
err = w.Handler.UpdateClient(ctx, id)
return err
}
// GetCollectorByClientId converts echo context to params.
func (w *ServerInterfaceWrapper) GetCollectorByClientId(ctx echo.Context) error {
var err error
// ------------- Path parameter "id" -------------
var id ClientID
err = runtime.BindStyledParameterWithOptions("simple", "id", ctx.Param("id"), &id, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true})
if err != nil {
return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter id: %s", err))
}
ctx.Set(PlaceholderAuthScopes, []string{})
// Invoke the callback with all the unmarshaled arguments
err = w.Handler.GetCollectorByClientId(ctx, id)
return err
}
// SetCollectorByClientId converts echo context to params.
func (w *ServerInterfaceWrapper) SetCollectorByClientId(ctx echo.Context) error {
var err error
// ------------- Path parameter "id" -------------
var id ClientID
err = runtime.BindStyledParameterWithOptions("simple", "id", ctx.Param("id"), &id, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true})
if err != nil {
return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter id: %s", err))
}
ctx.Set(PlaceholderAuthScopes, []string{})
// Invoke the callback with all the unmarshaled arguments
err = w.Handler.SetCollectorByClientId(ctx, id)
return err
}
// ListDocumentsByClientId converts echo context to params.
func (w *ServerInterfaceWrapper) ListDocumentsByClientId(ctx echo.Context) error {
var err error
// ------------- Path parameter "id" -------------
var id ClientID
err = runtime.BindStyledParameterWithOptions("simple", "id", ctx.Param("id"), &id, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true})
if err != nil {
return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter id: %s", err))
}
ctx.Set(PlaceholderAuthScopes, []string{})
// Invoke the callback with all the unmarshaled arguments
err = w.Handler.ListDocumentsByClientId(ctx, id)
return err
}
// TriggerExport converts echo context to params.
func (w *ServerInterfaceWrapper) TriggerExport(ctx echo.Context) error {
var err error
// ------------- Path parameter "id" -------------
var id ClientID
err = runtime.BindStyledParameterWithOptions("simple", "id", ctx.Param("id"), &id, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true})
if err != nil {
return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter id: %s", err))
}
ctx.Set(PlaceholderAuthScopes, []string{})
// Invoke the callback with all the unmarshaled arguments
err = w.Handler.TriggerExport(ctx, id)
return err
}
// GetStatusByClientId converts echo context to params.
func (w *ServerInterfaceWrapper) GetStatusByClientId(ctx echo.Context) error {
var err error
// ------------- Path parameter "id" -------------
var id ClientID
err = runtime.BindStyledParameterWithOptions("simple", "id", ctx.Param("id"), &id, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true})
if err != nil {
return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter id: %s", err))
}
ctx.Set(PlaceholderAuthScopes, []string{})
// Invoke the callback with all the unmarshaled arguments
err = w.Handler.GetStatusByClientId(ctx, id)
return err
}
// GetDocument converts echo context to params.
func (w *ServerInterfaceWrapper) GetDocument(ctx echo.Context) error {
var err error
// ------------- Path parameter "id" -------------
var id DocumentID
err = runtime.BindStyledParameterWithOptions("simple", "id", ctx.Param("id"), &id, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true})
if err != nil {
return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter id: %s", err))
}
ctx.Set(PlaceholderAuthScopes, []string{})
// Invoke the callback with all the unmarshaled arguments
err = w.Handler.GetDocument(ctx, id)
return err
}
// ExportState converts echo context to params.
func (w *ServerInterfaceWrapper) ExportState(ctx echo.Context) error {
var err error
// ------------- Path parameter "id" -------------
var id ExportID
err = runtime.BindStyledParameterWithOptions("simple", "id", ctx.Param("id"), &id, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true})
if err != nil {
return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter id: %s", err))
}
ctx.Set(PlaceholderAuthScopes, []string{})
// Invoke the callback with all the unmarshaled arguments
err = w.Handler.ExportState(ctx, id)
return err
}
// ListQueries converts echo context to params.
func (w *ServerInterfaceWrapper) ListQueries(ctx echo.Context) error {
var err error
ctx.Set(PlaceholderAuthScopes, []string{})
// Invoke the callback with all the unmarshaled arguments
err = w.Handler.ListQueries(ctx)
return err
}
// CreateQuery converts echo context to params.
func (w *ServerInterfaceWrapper) CreateQuery(ctx echo.Context) error {
var err error
ctx.Set(PlaceholderAuthScopes, []string{})
// Invoke the callback with all the unmarshaled arguments
err = w.Handler.CreateQuery(ctx)
return err
}
// GetQuery converts echo context to params.
func (w *ServerInterfaceWrapper) GetQuery(ctx echo.Context) error {
var err error
// ------------- Path parameter "id" -------------
var id QueryID
err = runtime.BindStyledParameterWithOptions("simple", "id", ctx.Param("id"), &id, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true})
if err != nil {
return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter id: %s", err))
}
ctx.Set(PlaceholderAuthScopes, []string{})
// Invoke the callback with all the unmarshaled arguments
err = w.Handler.GetQuery(ctx, id)
return err
}
// UpdateQuery converts echo context to params.
func (w *ServerInterfaceWrapper) UpdateQuery(ctx echo.Context) error {
var err error
// ------------- Path parameter "id" -------------
var id QueryID
err = runtime.BindStyledParameterWithOptions("simple", "id", ctx.Param("id"), &id, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true})
if err != nil {
return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter id: %s", err))
}
ctx.Set(PlaceholderAuthScopes, []string{})
// Invoke the callback with all the unmarshaled arguments
err = w.Handler.UpdateQuery(ctx, id)
return err
}
// TestQuery converts echo context to params.
func (w *ServerInterfaceWrapper) TestQuery(ctx echo.Context) error {
var err error
// ------------- Path parameter "id" -------------
var id QueryID
err = runtime.BindStyledParameterWithOptions("simple", "id", ctx.Param("id"), &id, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true})
if err != nil {
return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter id: %s", err))
}
ctx.Set(PlaceholderAuthScopes, []string{})
// Invoke the callback with all the unmarshaled arguments
err = w.Handler.TestQuery(ctx, id)
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+"/client", wrapper.CreateClient)
router.GET(baseURL+"/client/:id", wrapper.GetClient)
router.PATCH(baseURL+"/client/:id", wrapper.UpdateClient)
router.GET(baseURL+"/client/:id/collector", wrapper.GetCollectorByClientId)
router.PATCH(baseURL+"/client/:id/collector", wrapper.SetCollectorByClientId)
router.GET(baseURL+"/client/:id/documents", wrapper.ListDocumentsByClientId)
router.POST(baseURL+"/client/:id/export", wrapper.TriggerExport)
router.GET(baseURL+"/client/:id/status", wrapper.GetStatusByClientId)
router.GET(baseURL+"/document/:id", wrapper.GetDocument)
router.GET(baseURL+"/export/:id", wrapper.ExportState)
router.GET(baseURL+"/query", wrapper.ListQueries)
router.POST(baseURL+"/query", wrapper.CreateQuery)
router.GET(baseURL+"/query/:id", wrapper.GetQuery)
router.PATCH(baseURL+"/query/:id", wrapper.UpdateQuery)
router.POST(baseURL+"/query/:id/test", wrapper.TestQuery)
}
// Base64 encoded, gzipped, json marshaled Swagger object
var swaggerSpec = []string{
"H4sIAAAAAAAC/+xc23LbSHN+lSnkv1ueSYmUUqkKf8nrZ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uUf1IjNZqStHmlzNJ0qlV6j6R/r4br4OvQtd/I1YrvzUd3rxPc5z/z",
"q/YZhoW3OP9kcb79njJRmNPkW6Q6W9dUNzEoUlGz+oIj7i8yOq2LywVlvk4+DThlilDvUaK89t2b3p5O",
"b72cjBOVOG6oky7pKyXWwL1dha+W4P6f1l83YswimapHZ1p8s6qbNCvDKVU324VfHRMsMUczgBDFDdBv",
"inzkyorUk0zjeWtLRLCv6ib/OY5S3CfbIbczSehnm/rSreSqe9tlRAAjuPz6adsMT3zltNuU6O84z8Gb",
"3p7gsvkUn7NVWFVzH3+eaF2tUS3XDSB7F8t1r+dprnTp1r9DSuVPKdr+Btc73QbxViV/5Sq51YISy4ih",
"+IDyuLaX7dXxxDhOBL6mdbtK195i3hPWZGIFyBRisri7V4wQN9TtVxBPAXeNevjJ8Xp7NVzXr+23RfH3",
"46YHMG7JPKBArjX+rT7+ivXx2sjaFqYN/CcMojSEeac+IVHArBvHo1BnJ6qimez3jLksNXBxcvNI98VX",
"2EiuEX6fRHXnFMSa3vUyajWNPPLfakjHTk9L0W43MbUme7bGlGtlZtSL3LiVVzUm60bdpRArftlux63C",
"7eeuMjGzR36lT9ZIZJTtK3SVQbZKJ/KkKTmbn9w0ai5jS7XplfLl27qLJUXdeK1C1qnuWsmNyqwUS77u",
"CjqVkFohm0PYPG7+PwAA///Y9ZsKxFkAAA==",
}
// 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: %w", err)
}
zr, err := gzip.NewReader(bytes.NewReader(zipped))
if err != nil {
return nil, fmt.Errorf("error decompressing spec: %w", err)
}
var buf bytes.Buffer
_, err = buf.ReadFrom(zr)
if err != nil {
return nil, fmt.Errorf("error decompressing spec: %w", 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) {
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) {
resolvePath := PathToRawSpec("")
loader := openapi3.NewLoader()
loader.IsExternalRefsAllowed = true
loader.ReadFromURIFunc = func(loader *openapi3.Loader, url *url.URL) ([]byte, error) {
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
}