// 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"` } // 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"` } // 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/+xcW3PbRrL+K1M4eTrhndT11KlaRnIc7tqyI8lb2bK0rCHQJCcLYKiZgWRGxf++NTfc", "QYI0qeSBVX4QiLl093R/3dPd8Kvj0mBBQwgFdy5fnTlgD5j68xYL+EACIuSDB9xlZCEIDZ1L9Qr58h0i", "4ZSyAMsXiIRIP6AHR739vxcSevTl/wUJoKn/fnCchgPfcLDwwbl0up2OHdTtOA2Hu3MIsNyxdMypHBPg", "bx8gnIm5c9nvNZwFFgKYJOvfXzvNi8cf7WD99IPTcMRyIRfigpFw5qxWKzmL4QCE4fXKJxCK0XWR1fs5", "IFe9RaPrltNwiPx1gcXcaTghDuS6xHMaDoOniDDwnEvBIkhz8gODqXPp/E87EXVbv+XteGNJ0zV1o2AN", "HZ55fxBKUptLWt59W1BWSQmotwehI95YUvFrBGxZRcToGtEpEnNAT3LY/kmxuyuFYcAXNOSg9GUUSpXD", "/jvGKJM/uDQUECpTwYuFT1xlEe3fuaT2tS7rcrWPwDmegd40y7TdFXFgz8AQyPGS7SqrLdvMjG0nA9VO", "o/AZ+8S7hacIuHhDltS2iOl90YR6yz1xdE/pRxwuDUf8zVi6NYqCogUNkaAUBThcWg75HrhrOLcg2LI5", "nApgRdu4iYIJMGkbHFwaehxNYEoZIMGWJJwhPMMkbKVhuNvrpG1Cg7i0nVD0expxSRAFzuX56aDTaTgB", "CfVzJ8ZWE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9wvThLOMuaxnrjSGP1F66KLQBqaVa", "+CZfklSLJsv0pzNlUJ0pPr0NVmfrXWsC5pgNydhRM/ermSq5JjK1RZ1yLAQU8VntBbbzSq7bV1S65Ds8", "QWmmZRQSQVRsnmq5WjAq0a5oCab1RvfhHAj2s00+FbhvCDW4riTfetNUSlJSL6HwXaal7hjlH9RIjaYk", "bV4pszSdapXeI+nfq+E6+DJ07VdjteJ78xna2wT3+Q/fqn2GYeEY5x8szrdfGCYKc5h8i1Rn65rqJgZF", "KmpWn13E/UVGp3VxuaDM18lXAIdMEeo9SpTXvjvq7eH01svJOFGJ/YY66ZK+UmLTdL1Wha/m4P5H668b", "MWaRTNWjMy2+WdVNmpXhkKqbbbivjgnmmKMJQIjiBuijIu+5siL1JNN43loTEWyrusl/F6MU98l2yG1M", "EvrZpr50K7nq3nYZEcAILr9+2jbDA1857TYl+jvMc3DU2wNcNp/ic7YKq2ruw88jras1quW6AWTrYrnu", "9TzMlS7d+rdLqfwpRdtf4Hqn2yCOVfI3rpJbLSixjBiKdyiPa3tZXx1PjONA4Gtat6t07RjzHrAmEytA", "phCTxd2tYoS4oW67gngKuGvUww+O1+ur4bp+bb8tij8VNz2AcUvmDgVyrfHH+vgb1sdrI2tbmDbw7zCI", "0hDmnfqERAGzbhyPQp2dqIpmst8z5rLUwMXBzSPdF19hI7lG+G0S1Z1DEGt618uo1TTyyD/WkPadnpai", "XW9iak32bI0p18rMqBe5cSuvakzWjbpzIRb8st2OW4Xbz11lYmaP/EqfrJHIKNtX6CqDbJVO5ElTcjY/", "uWrUXMaWatMr5cu3dRdLirrxWoWsU921khuVWSmWfN0VdCohtUI2h7B6XP03AAD//4XAhtjWWAAA", } // 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 }