openapi: generate
This commit is contained in:
@@ -1262,22 +1262,22 @@ func (s *Server) handleListScriptsRequest(args [0]string, argsEscaped bool, w ht
|
||||
}
|
||||
}
|
||||
|
||||
// handleUpdateSubmissionModelRequest handles updateSubmissionModel operation.
|
||||
// handleUpdateSubmissionValidatedModelRequest handles updateSubmissionValidatedModel operation.
|
||||
//
|
||||
// Update model following role restrictions.
|
||||
// Update validated model.
|
||||
//
|
||||
// POST /submissions/{SubmissionID}/model
|
||||
func (s *Server) handleUpdateSubmissionModelRequest(args [1]string, argsEscaped bool, w http.ResponseWriter, r *http.Request) {
|
||||
// POST /submissions/{SubmissionID}/validated-model
|
||||
func (s *Server) handleUpdateSubmissionValidatedModelRequest(args [1]string, argsEscaped bool, w http.ResponseWriter, r *http.Request) {
|
||||
statusWriter := &codeRecorder{ResponseWriter: w}
|
||||
w = statusWriter
|
||||
otelAttrs := []attribute.KeyValue{
|
||||
otelogen.OperationID("updateSubmissionModel"),
|
||||
otelogen.OperationID("updateSubmissionValidatedModel"),
|
||||
semconv.HTTPRequestMethodKey.String("POST"),
|
||||
semconv.HTTPRouteKey.String("/submissions/{SubmissionID}/model"),
|
||||
semconv.HTTPRouteKey.String("/submissions/{SubmissionID}/validated-model"),
|
||||
}
|
||||
|
||||
// Start a span for this request.
|
||||
ctx, span := s.cfg.Tracer.Start(r.Context(), UpdateSubmissionModelOperation,
|
||||
ctx, span := s.cfg.Tracer.Start(r.Context(), UpdateSubmissionValidatedModelOperation,
|
||||
trace.WithAttributes(otelAttrs...),
|
||||
serverSpanKind,
|
||||
)
|
||||
@@ -1332,11 +1332,11 @@ func (s *Server) handleUpdateSubmissionModelRequest(args [1]string, argsEscaped
|
||||
}
|
||||
err error
|
||||
opErrContext = ogenerrors.OperationContext{
|
||||
Name: UpdateSubmissionModelOperation,
|
||||
ID: "updateSubmissionModel",
|
||||
Name: UpdateSubmissionValidatedModelOperation,
|
||||
ID: "updateSubmissionValidatedModel",
|
||||
}
|
||||
)
|
||||
params, err := decodeUpdateSubmissionModelParams(args, argsEscaped, r)
|
||||
params, err := decodeUpdateSubmissionValidatedModelParams(args, argsEscaped, r)
|
||||
if err != nil {
|
||||
err = &ogenerrors.DecodeParamsError{
|
||||
OperationContext: opErrContext,
|
||||
@@ -1347,13 +1347,13 @@ func (s *Server) handleUpdateSubmissionModelRequest(args [1]string, argsEscaped
|
||||
return
|
||||
}
|
||||
|
||||
var response *UpdateSubmissionModelNoContent
|
||||
var response *UpdateSubmissionValidatedModelNoContent
|
||||
if m := s.cfg.Middleware; m != nil {
|
||||
mreq := middleware.Request{
|
||||
Context: ctx,
|
||||
OperationName: UpdateSubmissionModelOperation,
|
||||
OperationSummary: "Update model following role restrictions",
|
||||
OperationID: "updateSubmissionModel",
|
||||
OperationName: UpdateSubmissionValidatedModelOperation,
|
||||
OperationSummary: "Update validated model",
|
||||
OperationID: "updateSubmissionValidatedModel",
|
||||
Body: nil,
|
||||
Params: middleware.Parameters{
|
||||
{
|
||||
@@ -1361,9 +1361,9 @@ func (s *Server) handleUpdateSubmissionModelRequest(args [1]string, argsEscaped
|
||||
In: "path",
|
||||
}: params.SubmissionID,
|
||||
{
|
||||
Name: "ModelID",
|
||||
Name: "ValidatedModelID",
|
||||
In: "query",
|
||||
}: params.ModelID,
|
||||
}: params.ValidatedModelID,
|
||||
{
|
||||
Name: "VersionID",
|
||||
In: "query",
|
||||
@@ -1374,8 +1374,8 @@ func (s *Server) handleUpdateSubmissionModelRequest(args [1]string, argsEscaped
|
||||
|
||||
type (
|
||||
Request = struct{}
|
||||
Params = UpdateSubmissionModelParams
|
||||
Response = *UpdateSubmissionModelNoContent
|
||||
Params = UpdateSubmissionValidatedModelParams
|
||||
Response = *UpdateSubmissionValidatedModelNoContent
|
||||
)
|
||||
response, err = middleware.HookMiddleware[
|
||||
Request,
|
||||
@@ -1384,14 +1384,14 @@ func (s *Server) handleUpdateSubmissionModelRequest(args [1]string, argsEscaped
|
||||
](
|
||||
m,
|
||||
mreq,
|
||||
unpackUpdateSubmissionModelParams,
|
||||
unpackUpdateSubmissionValidatedModelParams,
|
||||
func(ctx context.Context, request Request, params Params) (response Response, err error) {
|
||||
err = s.h.UpdateSubmissionModel(ctx, params)
|
||||
err = s.h.UpdateSubmissionValidatedModel(ctx, params)
|
||||
return response, err
|
||||
},
|
||||
)
|
||||
} else {
|
||||
err = s.h.UpdateSubmissionModel(ctx, params)
|
||||
err = s.h.UpdateSubmissionValidatedModel(ctx, params)
|
||||
}
|
||||
if err != nil {
|
||||
if errRes, ok := errors.Into[*ErrorStatusCode](err); ok {
|
||||
@@ -1410,7 +1410,7 @@ func (s *Server) handleUpdateSubmissionModelRequest(args [1]string, argsEscaped
|
||||
return
|
||||
}
|
||||
|
||||
if err := encodeUpdateSubmissionModelResponse(response, w, span); err != nil {
|
||||
if err := encodeUpdateSubmissionValidatedModelResponse(response, w, span); err != nil {
|
||||
defer recordError("EncodeResponse", err)
|
||||
if !errors.Is(err, ht.ErrInternalServerErrorResponse) {
|
||||
s.cfg.ErrorHandler(ctx, w, r, err)
|
||||
|
||||
Reference in New Issue
Block a user