go.mod: bump github.com/getkin/kin-openapi to v0.131.0
As deepmap/oapi-codegen didn't work with this newer version, upgrade to oapi-codegen/oapi-codegen v2. Mitigating CVE-2025-30153
This commit is contained in:
parent
c5cb0d0618
commit
b2700903ae
403 changed files with 44758 additions and 16347 deletions
|
|
@ -1,4 +1,4 @@
|
|||
//go:generate go run github.com/deepmap/oapi-codegen/cmd/oapi-codegen --package=v2 --generate types,spec,server -o openapi.v2.gen.go openapi.v2.yml
|
||||
//go:generate go run github.com/oapi-codegen/oapi-codegen/v2/cmd/oapi-codegen --package=v2 --generate types,spec,server -o openapi.v2.gen.go openapi.v2.yml
|
||||
package v2
|
||||
|
||||
import (
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -11,5 +11,5 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
_ "github.com/deepmap/oapi-codegen/cmd/oapi-codegen"
|
||||
_ "github.com/oapi-codegen/oapi-codegen/v2/cmd/oapi-codegen"
|
||||
)
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
// Package api provides primitives to interact with the openapi HTTP API.
|
||||
//
|
||||
// Code generated by github.com/deepmap/oapi-codegen version v1.8.2 DO NOT EDIT.
|
||||
// Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.4.1 DO NOT EDIT.
|
||||
package api
|
||||
|
||||
import (
|
||||
|
|
@ -14,9 +14,10 @@ import (
|
|||
"path"
|
||||
"strings"
|
||||
|
||||
"github.com/deepmap/oapi-codegen/pkg/runtime"
|
||||
"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 (
|
||||
|
|
@ -25,12 +26,12 @@ const (
|
|||
|
||||
// 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"`
|
||||
Href string `json:"href"`
|
||||
Id string `json:"id"`
|
||||
Kind string `json:"kind"`
|
||||
|
||||
// Backward compatibility with workers <= v33, equals reason
|
||||
// Message Backward compatibility with workers <= v33, equals reason
|
||||
Message string `json:"message"`
|
||||
OperationId string `json:"operation_id"`
|
||||
Reason string `json:"reason"`
|
||||
|
|
@ -38,10 +39,10 @@ type Error struct {
|
|||
|
||||
// GetJobResponse defines model for GetJobResponse.
|
||||
type GetJobResponse struct {
|
||||
// Embedded struct due to allOf(#/components/schemas/ObjectReference)
|
||||
ObjectReference `yaml:",inline"`
|
||||
// Embedded fields due to inline allOf schema
|
||||
Canceled bool `json:"canceled"`
|
||||
Canceled bool `json:"canceled"`
|
||||
Href string `json:"href"`
|
||||
Id string `json:"id"`
|
||||
Kind string `json:"kind"`
|
||||
}
|
||||
|
||||
// ObjectReference defines model for ObjectReference.
|
||||
|
|
@ -58,10 +59,10 @@ type PostWorkersRequest struct {
|
|||
|
||||
// PostWorkersResponse defines model for PostWorkersResponse.
|
||||
type PostWorkersResponse struct {
|
||||
// Embedded struct due to allOf(#/components/schemas/ObjectReference)
|
||||
ObjectReference `yaml:",inline"`
|
||||
// Embedded fields due to inline allOf schema
|
||||
WorkerId string `json:"worker_id"`
|
||||
Href string `json:"href"`
|
||||
Id string `json:"id"`
|
||||
Kind string `json:"kind"`
|
||||
WorkerId openapi_types.UUID `json:"worker_id"`
|
||||
}
|
||||
|
||||
// RequestJobRequest defines model for RequestJobRequest.
|
||||
|
|
@ -73,21 +74,21 @@ type RequestJobRequest struct {
|
|||
|
||||
// RequestJobResponse defines model for RequestJobResponse.
|
||||
type RequestJobResponse struct {
|
||||
// Embedded struct due to allOf(#/components/schemas/ObjectReference)
|
||||
ObjectReference `yaml:",inline"`
|
||||
// Embedded fields due to inline allOf schema
|
||||
Args *json.RawMessage `json:"args,omitempty"`
|
||||
ArtifactLocation string `json:"artifact_location"`
|
||||
DynamicArgs *[]json.RawMessage `json:"dynamic_args,omitempty"`
|
||||
Href string `json:"href"`
|
||||
Id string `json:"id"`
|
||||
Kind string `json:"kind"`
|
||||
Location string `json:"location"`
|
||||
Type string `json:"type"`
|
||||
}
|
||||
|
||||
// StatusResponse defines model for StatusResponse.
|
||||
type StatusResponse struct {
|
||||
// Embedded struct due to allOf(#/components/schemas/ObjectReference)
|
||||
ObjectReference `yaml:",inline"`
|
||||
// Embedded fields due to inline allOf schema
|
||||
Href string `json:"href"`
|
||||
Id string `json:"id"`
|
||||
Kind string `json:"kind"`
|
||||
Status string `json:"status"`
|
||||
}
|
||||
|
||||
|
|
@ -97,25 +98,16 @@ type UpdateJobRequest struct {
|
|||
}
|
||||
|
||||
// UpdateJobResponse defines model for UpdateJobResponse.
|
||||
type UpdateJobResponse ObjectReference
|
||||
|
||||
// RequestJobJSONBody defines parameters for RequestJob.
|
||||
type RequestJobJSONBody RequestJobRequest
|
||||
|
||||
// UpdateJobJSONBody defines parameters for UpdateJob.
|
||||
type UpdateJobJSONBody UpdateJobRequest
|
||||
|
||||
// PostWorkersJSONBody defines parameters for PostWorkers.
|
||||
type PostWorkersJSONBody PostWorkersRequest
|
||||
type UpdateJobResponse = ObjectReference
|
||||
|
||||
// RequestJobJSONRequestBody defines body for RequestJob for application/json ContentType.
|
||||
type RequestJobJSONRequestBody RequestJobJSONBody
|
||||
type RequestJobJSONRequestBody = RequestJobRequest
|
||||
|
||||
// UpdateJobJSONRequestBody defines body for UpdateJob for application/json ContentType.
|
||||
type UpdateJobJSONRequestBody UpdateJobJSONBody
|
||||
type UpdateJobJSONRequestBody = UpdateJobRequest
|
||||
|
||||
// PostWorkersJSONRequestBody defines body for PostWorkers for application/json ContentType.
|
||||
type PostWorkersJSONRequestBody PostWorkersJSONBody
|
||||
type PostWorkersJSONRequestBody = PostWorkersRequest
|
||||
|
||||
// ServerInterface represents all server handlers.
|
||||
type ServerInterface interface {
|
||||
|
|
@ -145,7 +137,7 @@ type ServerInterface interface {
|
|||
PostWorkers(ctx echo.Context) error
|
||||
// Refresh worker status
|
||||
// (POST /workers/{worker_id}/status)
|
||||
PostWorkerStatus(ctx echo.Context, workerId string) error
|
||||
PostWorkerStatus(ctx echo.Context, workerId openapi_types.UUID) error
|
||||
}
|
||||
|
||||
// ServerInterfaceWrapper converts echo contexts to parameters.
|
||||
|
|
@ -159,14 +151,14 @@ func (w *ServerInterfaceWrapper) GetError(ctx echo.Context) error {
|
|||
// ------------- Path parameter "id" -------------
|
||||
var id string
|
||||
|
||||
err = runtime.BindStyledParameterWithLocation("simple", false, "id", runtime.ParamLocationPath, ctx.Param("id"), &id)
|
||||
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(BearerScopes, []string{""})
|
||||
ctx.Set(BearerScopes, []string{})
|
||||
|
||||
// Invoke the callback with all the unmarshalled arguments
|
||||
// Invoke the callback with all the unmarshaled arguments
|
||||
err = w.Handler.GetError(ctx, id)
|
||||
return err
|
||||
}
|
||||
|
|
@ -175,7 +167,7 @@ func (w *ServerInterfaceWrapper) GetError(ctx echo.Context) error {
|
|||
func (w *ServerInterfaceWrapper) RequestJob(ctx echo.Context) error {
|
||||
var err error
|
||||
|
||||
// Invoke the callback with all the unmarshalled arguments
|
||||
// Invoke the callback with all the unmarshaled arguments
|
||||
err = w.Handler.RequestJob(ctx)
|
||||
return err
|
||||
}
|
||||
|
|
@ -186,12 +178,12 @@ func (w *ServerInterfaceWrapper) GetJob(ctx echo.Context) error {
|
|||
// ------------- Path parameter "token" -------------
|
||||
var token string
|
||||
|
||||
err = runtime.BindStyledParameterWithLocation("simple", false, "token", runtime.ParamLocationPath, ctx.Param("token"), &token)
|
||||
err = runtime.BindStyledParameterWithOptions("simple", "token", ctx.Param("token"), &token, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true})
|
||||
if err != nil {
|
||||
return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter token: %s", err))
|
||||
}
|
||||
|
||||
// Invoke the callback with all the unmarshalled arguments
|
||||
// Invoke the callback with all the unmarshaled arguments
|
||||
err = w.Handler.GetJob(ctx, token)
|
||||
return err
|
||||
}
|
||||
|
|
@ -202,12 +194,12 @@ func (w *ServerInterfaceWrapper) UpdateJob(ctx echo.Context) error {
|
|||
// ------------- Path parameter "token" -------------
|
||||
var token string
|
||||
|
||||
err = runtime.BindStyledParameterWithLocation("simple", false, "token", runtime.ParamLocationPath, ctx.Param("token"), &token)
|
||||
err = runtime.BindStyledParameterWithOptions("simple", "token", ctx.Param("token"), &token, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true})
|
||||
if err != nil {
|
||||
return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter token: %s", err))
|
||||
}
|
||||
|
||||
// Invoke the callback with all the unmarshalled arguments
|
||||
// Invoke the callback with all the unmarshaled arguments
|
||||
err = w.Handler.UpdateJob(ctx, token)
|
||||
return err
|
||||
}
|
||||
|
|
@ -218,7 +210,7 @@ func (w *ServerInterfaceWrapper) UploadJobArtifact(ctx echo.Context) error {
|
|||
// ------------- Path parameter "token" -------------
|
||||
var token string
|
||||
|
||||
err = runtime.BindStyledParameterWithLocation("simple", false, "token", runtime.ParamLocationPath, ctx.Param("token"), &token)
|
||||
err = runtime.BindStyledParameterWithOptions("simple", "token", ctx.Param("token"), &token, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true})
|
||||
if err != nil {
|
||||
return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter token: %s", err))
|
||||
}
|
||||
|
|
@ -226,12 +218,12 @@ func (w *ServerInterfaceWrapper) UploadJobArtifact(ctx echo.Context) error {
|
|||
// ------------- Path parameter "name" -------------
|
||||
var name string
|
||||
|
||||
err = runtime.BindStyledParameterWithLocation("simple", false, "name", runtime.ParamLocationPath, ctx.Param("name"), &name)
|
||||
err = runtime.BindStyledParameterWithOptions("simple", "name", ctx.Param("name"), &name, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true})
|
||||
if err != nil {
|
||||
return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter name: %s", err))
|
||||
}
|
||||
|
||||
// Invoke the callback with all the unmarshalled arguments
|
||||
// Invoke the callback with all the unmarshaled arguments
|
||||
err = w.Handler.UploadJobArtifact(ctx, token, name)
|
||||
return err
|
||||
}
|
||||
|
|
@ -240,7 +232,7 @@ func (w *ServerInterfaceWrapper) UploadJobArtifact(ctx echo.Context) error {
|
|||
func (w *ServerInterfaceWrapper) GetOpenapi(ctx echo.Context) error {
|
||||
var err error
|
||||
|
||||
// Invoke the callback with all the unmarshalled arguments
|
||||
// Invoke the callback with all the unmarshaled arguments
|
||||
err = w.Handler.GetOpenapi(ctx)
|
||||
return err
|
||||
}
|
||||
|
|
@ -249,7 +241,7 @@ func (w *ServerInterfaceWrapper) GetOpenapi(ctx echo.Context) error {
|
|||
func (w *ServerInterfaceWrapper) GetStatus(ctx echo.Context) error {
|
||||
var err error
|
||||
|
||||
// Invoke the callback with all the unmarshalled arguments
|
||||
// Invoke the callback with all the unmarshaled arguments
|
||||
err = w.Handler.GetStatus(ctx)
|
||||
return err
|
||||
}
|
||||
|
|
@ -258,7 +250,7 @@ func (w *ServerInterfaceWrapper) GetStatus(ctx echo.Context) error {
|
|||
func (w *ServerInterfaceWrapper) PostWorkers(ctx echo.Context) error {
|
||||
var err error
|
||||
|
||||
// Invoke the callback with all the unmarshalled arguments
|
||||
// Invoke the callback with all the unmarshaled arguments
|
||||
err = w.Handler.PostWorkers(ctx)
|
||||
return err
|
||||
}
|
||||
|
|
@ -267,14 +259,14 @@ func (w *ServerInterfaceWrapper) PostWorkers(ctx echo.Context) error {
|
|||
func (w *ServerInterfaceWrapper) PostWorkerStatus(ctx echo.Context) error {
|
||||
var err error
|
||||
// ------------- Path parameter "worker_id" -------------
|
||||
var workerId string
|
||||
var workerId openapi_types.UUID
|
||||
|
||||
err = runtime.BindStyledParameterWithLocation("simple", false, "worker_id", runtime.ParamLocationPath, ctx.Param("worker_id"), &workerId)
|
||||
err = runtime.BindStyledParameterWithOptions("simple", "worker_id", ctx.Param("worker_id"), &workerId, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true})
|
||||
if err != nil {
|
||||
return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter worker_id: %s", err))
|
||||
}
|
||||
|
||||
// Invoke the callback with all the unmarshalled arguments
|
||||
// Invoke the callback with all the unmarshaled arguments
|
||||
err = w.Handler.PostWorkerStatus(ctx, workerId)
|
||||
return err
|
||||
}
|
||||
|
|
@ -322,31 +314,31 @@ func RegisterHandlersWithBaseURL(router EchoRouter, si ServerInterface, baseURL
|
|||
// Base64 encoded, gzipped, json marshaled Swagger object
|
||||
var swaggerSpec = []string{
|
||||
|
||||
"H4sIAAAAAAAC/9xY224bvRF+lQFboC2w1spxeiOgF3FaBE6ROrAb/AFiI5jdHWlpc8kNOWtFEPTuP0iu",
|
||||
"jruSbMC6SK5kS8M5fPNxDpyL3FS10aTZidFcuLykCsOf/7HWWP8HKnU9FqNvc/FXS2MxEn9J14fS9kR6",
|
||||
"nT1Qzjc0Jks6J7FI5qK2pibLkoLC3BTkP3lWkxgJx1bqiVgkoiLncBJ+K8jlVtYsjRYjcYn54xRtAd4e",
|
||||
"ssykkjyDqeQSpsY+knVw1wyHF/m/4OniIgH60aByYAmd0SLpmvL+oNf+XRa9vrRHuz+F33400lIhRt9i",
|
||||
"MCvxHcXrkO5XPpiAj1jcLxLxgfijyW7I1UY7elWMUeekaDO2zBhFqLsRLEX7fdy1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0HdV7iPlb0ccn2g/3y65EWmz",
|
||||
"Gpr3F/vrVuQ5OLXqwrgMUoP3HdpXBB/oKUbR3Uv+RdPPmnKmoh3kTJ431vOrW4L9IH7QZ4/RemXs3Rtu",
|
||||
"pZ/GIUq1e4yFaSnzEixxY7UDR/ZJ5kuhvu3hdvnLySrkzk79O5bHFt6QtXbP3D+wx0HTz+uapu1aGlbR",
|
||||
"ZdIQmkYWbSZdaRpVQEbQOCo8T1ApcE3mfEHSDDkq5QZ3upPcjQe7E/XanlfHE4/yfY+Q+2f5LYh3bmEU",
|
||||
"6Uos85fOV+94i42beLxJrZ//DnWYYy+cfoDas+6NLbmSXKghJaHljJCX2320ngQ+eQUuXH0vjJ4qekUk",
|
||||
"NlD4OCqpCcwTWVTqTrdsLAkVl4P2yaM9XRjQhiHmtoCpVCp8kRE8Us3AFvNH7weO2TMaWFZkGh7A1fhO",
|
||||
"F9bUNRWrZ5gpWVpNE2EVSID96hpWIa87I2+L0TIVh/l9sIZtw+eaPCc3bpSaQROGmqVLf3GwcY0315UA",
|
||||
"+PKirmTCYm+f+p9bPqHU8NfamqLJ/Vd/gygrEtFYJUaiZK7dKE2xlgPfCFwpxzzITeW/SWWFEzrLGqkK",
|
||||
"smfRcvp0Hp4Vd5oA48QjeEC9Y5zQC41ELS8R2/jhfvH/AAAA///y4vKhRRsAAA==",
|
||||
}
|
||||
|
||||
// GetSwagger returns the content of the embedded swagger specification file
|
||||
|
|
@ -354,16 +346,16 @@ var swaggerSpec = []string{
|
|||
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)
|
||||
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: %s", err)
|
||||
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: %s", err)
|
||||
return nil, fmt.Errorf("error decompressing spec: %w", err)
|
||||
}
|
||||
|
||||
return buf.Bytes(), nil
|
||||
|
|
@ -381,7 +373,7 @@ func decodeSpecCached() func() ([]byte, error) {
|
|||
|
||||
// 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))
|
||||
res := make(map[string]func() ([]byte, error))
|
||||
if len(pathToFile) > 0 {
|
||||
res[pathToFile] = rawSpec
|
||||
}
|
||||
|
|
@ -395,12 +387,12 @@ func PathToRawSpec(pathToFile string) map[string]func() ([]byte, error) {
|
|||
// 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("")
|
||||
resolvePath := PathToRawSpec("")
|
||||
|
||||
loader := openapi3.NewLoader()
|
||||
loader.IsExternalRefsAllowed = true
|
||||
loader.ReadFromURIFunc = func(loader *openapi3.Loader, url *url.URL) ([]byte, error) {
|
||||
var pathToFile = url.String()
|
||||
pathToFile := url.String()
|
||||
pathToFile = path.Clean(pathToFile)
|
||||
getSpec, ok := resolvePath[pathToFile]
|
||||
if !ok {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
//go:generate go run github.com/deepmap/oapi-codegen/cmd/oapi-codegen -package=api -generate types,server,spec -o api.gen.go openapi.yml
|
||||
//go:generate go run github.com/oapi-codegen/oapi-codegen/v2/cmd/oapi-codegen -package=api -generate types,server,spec -o api.gen.go openapi.yml
|
||||
|
||||
package api
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue