openapi: rename unclear endpoints
This commit is contained in:
parent
a9a4eaa20d
commit
1a747bee80
@ -241,9 +241,9 @@ paths:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "#/components/schemas/Error"
|
||||
/submissions/{SubmissionID}/status/validate:
|
||||
/submissions/{SubmissionID}/status/validator-validated:
|
||||
post:
|
||||
summary: Role Validator changes status from Validating -> Validated
|
||||
summary: (Internal endpoint) Role Validator changes status from Validating -> Validated
|
||||
operationId: actionSubmissionValidate
|
||||
tags:
|
||||
- Submissions
|
||||
@ -258,9 +258,9 @@ paths:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "#/components/schemas/Error"
|
||||
/submissions/{SubmissionID}/status/publish:
|
||||
/submissions/{SubmissionID}/status/validator-published:
|
||||
post:
|
||||
summary: Role Validator changes status from Publishing -> Published
|
||||
summary: (Internal endpoint) Role Validator changes status from Publishing -> Published
|
||||
operationId: actionSubmissionPublish
|
||||
tags:
|
||||
- Submissions
|
||||
|
@ -26,9 +26,9 @@ import (
|
||||
type Invoker interface {
|
||||
// ActionSubmissionPublish invokes actionSubmissionPublish operation.
|
||||
//
|
||||
// Role Validator changes status from Publishing -> Published.
|
||||
// (Internal endpoint) Role Validator changes status from Publishing -> Published.
|
||||
//
|
||||
// POST /submissions/{SubmissionID}/status/publish
|
||||
// POST /submissions/{SubmissionID}/status/validator-published
|
||||
ActionSubmissionPublish(ctx context.Context, params ActionSubmissionPublishParams) error
|
||||
// ActionSubmissionReject invokes actionSubmissionReject operation.
|
||||
//
|
||||
@ -68,9 +68,9 @@ type Invoker interface {
|
||||
ActionSubmissionTriggerValidate(ctx context.Context, params ActionSubmissionTriggerValidateParams) error
|
||||
// ActionSubmissionValidate invokes actionSubmissionValidate operation.
|
||||
//
|
||||
// Role Validator changes status from Validating -> Validated.
|
||||
// (Internal endpoint) Role Validator changes status from Validating -> Validated.
|
||||
//
|
||||
// POST /submissions/{SubmissionID}/status/validate
|
||||
// POST /submissions/{SubmissionID}/status/validator-validated
|
||||
ActionSubmissionValidate(ctx context.Context, params ActionSubmissionValidateParams) error
|
||||
// CreateScript invokes createScript operation.
|
||||
//
|
||||
@ -214,9 +214,9 @@ func (c *Client) requestURL(ctx context.Context) *url.URL {
|
||||
|
||||
// ActionSubmissionPublish invokes actionSubmissionPublish operation.
|
||||
//
|
||||
// Role Validator changes status from Publishing -> Published.
|
||||
// (Internal endpoint) Role Validator changes status from Publishing -> Published.
|
||||
//
|
||||
// POST /submissions/{SubmissionID}/status/publish
|
||||
// POST /submissions/{SubmissionID}/status/validator-published
|
||||
func (c *Client) ActionSubmissionPublish(ctx context.Context, params ActionSubmissionPublishParams) error {
|
||||
_, err := c.sendActionSubmissionPublish(ctx, params)
|
||||
return err
|
||||
@ -226,7 +226,7 @@ func (c *Client) sendActionSubmissionPublish(ctx context.Context, params ActionS
|
||||
otelAttrs := []attribute.KeyValue{
|
||||
otelogen.OperationID("actionSubmissionPublish"),
|
||||
semconv.HTTPRequestMethodKey.String("POST"),
|
||||
semconv.HTTPRouteKey.String("/submissions/{SubmissionID}/status/publish"),
|
||||
semconv.HTTPRouteKey.String("/submissions/{SubmissionID}/status/validator-published"),
|
||||
}
|
||||
|
||||
// Run stopwatch.
|
||||
@ -278,7 +278,7 @@ func (c *Client) sendActionSubmissionPublish(ctx context.Context, params ActionS
|
||||
}
|
||||
pathParts[1] = encoded
|
||||
}
|
||||
pathParts[2] = "/status/publish"
|
||||
pathParts[2] = "/status/validator-published"
|
||||
uri.AddPathParts(u, pathParts[:]...)
|
||||
|
||||
stage = "EncodeRequest"
|
||||
@ -1049,9 +1049,9 @@ func (c *Client) sendActionSubmissionTriggerValidate(ctx context.Context, params
|
||||
|
||||
// ActionSubmissionValidate invokes actionSubmissionValidate operation.
|
||||
//
|
||||
// Role Validator changes status from Validating -> Validated.
|
||||
// (Internal endpoint) Role Validator changes status from Validating -> Validated.
|
||||
//
|
||||
// POST /submissions/{SubmissionID}/status/validate
|
||||
// POST /submissions/{SubmissionID}/status/validator-validated
|
||||
func (c *Client) ActionSubmissionValidate(ctx context.Context, params ActionSubmissionValidateParams) error {
|
||||
_, err := c.sendActionSubmissionValidate(ctx, params)
|
||||
return err
|
||||
@ -1061,7 +1061,7 @@ func (c *Client) sendActionSubmissionValidate(ctx context.Context, params Action
|
||||
otelAttrs := []attribute.KeyValue{
|
||||
otelogen.OperationID("actionSubmissionValidate"),
|
||||
semconv.HTTPRequestMethodKey.String("POST"),
|
||||
semconv.HTTPRouteKey.String("/submissions/{SubmissionID}/status/validate"),
|
||||
semconv.HTTPRouteKey.String("/submissions/{SubmissionID}/status/validator-validated"),
|
||||
}
|
||||
|
||||
// Run stopwatch.
|
||||
@ -1113,7 +1113,7 @@ func (c *Client) sendActionSubmissionValidate(ctx context.Context, params Action
|
||||
}
|
||||
pathParts[1] = encoded
|
||||
}
|
||||
pathParts[2] = "/status/validate"
|
||||
pathParts[2] = "/status/validator-validated"
|
||||
uri.AddPathParts(u, pathParts[:]...)
|
||||
|
||||
stage = "EncodeRequest"
|
||||
|
@ -32,16 +32,16 @@ func (c *codeRecorder) WriteHeader(status int) {
|
||||
|
||||
// handleActionSubmissionPublishRequest handles actionSubmissionPublish operation.
|
||||
//
|
||||
// Role Validator changes status from Publishing -> Published.
|
||||
// (Internal endpoint) Role Validator changes status from Publishing -> Published.
|
||||
//
|
||||
// POST /submissions/{SubmissionID}/status/publish
|
||||
// POST /submissions/{SubmissionID}/status/validator-published
|
||||
func (s *Server) handleActionSubmissionPublishRequest(args [1]string, argsEscaped bool, w http.ResponseWriter, r *http.Request) {
|
||||
statusWriter := &codeRecorder{ResponseWriter: w}
|
||||
w = statusWriter
|
||||
otelAttrs := []attribute.KeyValue{
|
||||
otelogen.OperationID("actionSubmissionPublish"),
|
||||
semconv.HTTPRequestMethodKey.String("POST"),
|
||||
semconv.HTTPRouteKey.String("/submissions/{SubmissionID}/status/publish"),
|
||||
semconv.HTTPRouteKey.String("/submissions/{SubmissionID}/status/validator-published"),
|
||||
}
|
||||
|
||||
// Start a span for this request.
|
||||
@ -120,7 +120,7 @@ func (s *Server) handleActionSubmissionPublishRequest(args [1]string, argsEscape
|
||||
mreq := middleware.Request{
|
||||
Context: ctx,
|
||||
OperationName: ActionSubmissionPublishOperation,
|
||||
OperationSummary: "Role Validator changes status from Publishing -> Published",
|
||||
OperationSummary: "(Internal endpoint) Role Validator changes status from Publishing -> Published",
|
||||
OperationID: "actionSubmissionPublish",
|
||||
Body: nil,
|
||||
Params: middleware.Parameters{
|
||||
@ -1351,16 +1351,16 @@ func (s *Server) handleActionSubmissionTriggerValidateRequest(args [1]string, ar
|
||||
|
||||
// handleActionSubmissionValidateRequest handles actionSubmissionValidate operation.
|
||||
//
|
||||
// Role Validator changes status from Validating -> Validated.
|
||||
// (Internal endpoint) Role Validator changes status from Validating -> Validated.
|
||||
//
|
||||
// POST /submissions/{SubmissionID}/status/validate
|
||||
// POST /submissions/{SubmissionID}/status/validator-validated
|
||||
func (s *Server) handleActionSubmissionValidateRequest(args [1]string, argsEscaped bool, w http.ResponseWriter, r *http.Request) {
|
||||
statusWriter := &codeRecorder{ResponseWriter: w}
|
||||
w = statusWriter
|
||||
otelAttrs := []attribute.KeyValue{
|
||||
otelogen.OperationID("actionSubmissionValidate"),
|
||||
semconv.HTTPRequestMethodKey.String("POST"),
|
||||
semconv.HTTPRouteKey.String("/submissions/{SubmissionID}/status/validate"),
|
||||
semconv.HTTPRouteKey.String("/submissions/{SubmissionID}/status/validator-validated"),
|
||||
}
|
||||
|
||||
// Start a span for this request.
|
||||
@ -1439,7 +1439,7 @@ func (s *Server) handleActionSubmissionValidateRequest(args [1]string, argsEscap
|
||||
mreq := middleware.Request{
|
||||
Context: ctx,
|
||||
OperationName: ActionSubmissionValidateOperation,
|
||||
OperationSummary: "Role Validator changes status from Validating -> Validated",
|
||||
OperationSummary: "(Internal endpoint) Role Validator changes status from Validating -> Validated",
|
||||
OperationID: "actionSubmissionValidate",
|
||||
Body: nil,
|
||||
Params: middleware.Parameters{
|
||||
|
@ -356,29 +356,6 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
break
|
||||
}
|
||||
switch elem[0] {
|
||||
case 'p': // Prefix: "publish"
|
||||
origElem := elem
|
||||
if l := len("publish"); len(elem) >= l && elem[0:l] == "publish" {
|
||||
elem = elem[l:]
|
||||
} else {
|
||||
break
|
||||
}
|
||||
|
||||
if len(elem) == 0 {
|
||||
// Leaf node.
|
||||
switch r.Method {
|
||||
case "POST":
|
||||
s.handleActionSubmissionPublishRequest([1]string{
|
||||
args[0],
|
||||
}, elemIsEscaped, w, r)
|
||||
default:
|
||||
s.notAllowed(w, r, "POST")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
elem = origElem
|
||||
case 'r': // Prefix: "re"
|
||||
origElem := elem
|
||||
if l := len("re"); len(elem) >= l && elem[0:l] == "re" {
|
||||
@ -547,9 +524,44 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
elem = origElem
|
||||
case 'v': // Prefix: "validate"
|
||||
case 'v': // Prefix: "validator-"
|
||||
origElem := elem
|
||||
if l := len("validate"); len(elem) >= l && elem[0:l] == "validate" {
|
||||
if l := len("validator-"); len(elem) >= l && elem[0:l] == "validator-" {
|
||||
elem = elem[l:]
|
||||
} else {
|
||||
break
|
||||
}
|
||||
|
||||
if len(elem) == 0 {
|
||||
break
|
||||
}
|
||||
switch elem[0] {
|
||||
case 'p': // Prefix: "published"
|
||||
origElem := elem
|
||||
if l := len("published"); len(elem) >= l && elem[0:l] == "published" {
|
||||
elem = elem[l:]
|
||||
} else {
|
||||
break
|
||||
}
|
||||
|
||||
if len(elem) == 0 {
|
||||
// Leaf node.
|
||||
switch r.Method {
|
||||
case "POST":
|
||||
s.handleActionSubmissionPublishRequest([1]string{
|
||||
args[0],
|
||||
}, elemIsEscaped, w, r)
|
||||
default:
|
||||
s.notAllowed(w, r, "POST")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
elem = origElem
|
||||
case 'v': // Prefix: "validated"
|
||||
origElem := elem
|
||||
if l := len("validated"); len(elem) >= l && elem[0:l] == "validated" {
|
||||
elem = elem[l:]
|
||||
} else {
|
||||
break
|
||||
@ -586,6 +598,9 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
elem = origElem
|
||||
}
|
||||
|
||||
elem = origElem
|
||||
}
|
||||
}
|
||||
s.notFound(w, r)
|
||||
}
|
||||
@ -1018,31 +1033,6 @@ func (s *Server) FindPath(method string, u *url.URL) (r Route, _ bool) {
|
||||
break
|
||||
}
|
||||
switch elem[0] {
|
||||
case 'p': // Prefix: "publish"
|
||||
origElem := elem
|
||||
if l := len("publish"); len(elem) >= l && elem[0:l] == "publish" {
|
||||
elem = elem[l:]
|
||||
} else {
|
||||
break
|
||||
}
|
||||
|
||||
if len(elem) == 0 {
|
||||
// Leaf node.
|
||||
switch method {
|
||||
case "POST":
|
||||
r.name = ActionSubmissionPublishOperation
|
||||
r.summary = "Role Validator changes status from Publishing -> Published"
|
||||
r.operationID = "actionSubmissionPublish"
|
||||
r.pathPattern = "/submissions/{SubmissionID}/status/publish"
|
||||
r.args = args
|
||||
r.count = 1
|
||||
return r, true
|
||||
default:
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
elem = origElem
|
||||
case 'r': // Prefix: "re"
|
||||
origElem := elem
|
||||
if l := len("re"); len(elem) >= l && elem[0:l] == "re" {
|
||||
@ -1223,9 +1213,46 @@ func (s *Server) FindPath(method string, u *url.URL) (r Route, _ bool) {
|
||||
}
|
||||
|
||||
elem = origElem
|
||||
case 'v': // Prefix: "validate"
|
||||
case 'v': // Prefix: "validator-"
|
||||
origElem := elem
|
||||
if l := len("validate"); len(elem) >= l && elem[0:l] == "validate" {
|
||||
if l := len("validator-"); len(elem) >= l && elem[0:l] == "validator-" {
|
||||
elem = elem[l:]
|
||||
} else {
|
||||
break
|
||||
}
|
||||
|
||||
if len(elem) == 0 {
|
||||
break
|
||||
}
|
||||
switch elem[0] {
|
||||
case 'p': // Prefix: "published"
|
||||
origElem := elem
|
||||
if l := len("published"); len(elem) >= l && elem[0:l] == "published" {
|
||||
elem = elem[l:]
|
||||
} else {
|
||||
break
|
||||
}
|
||||
|
||||
if len(elem) == 0 {
|
||||
// Leaf node.
|
||||
switch method {
|
||||
case "POST":
|
||||
r.name = ActionSubmissionPublishOperation
|
||||
r.summary = "(Internal endpoint) Role Validator changes status from Publishing -> Published"
|
||||
r.operationID = "actionSubmissionPublish"
|
||||
r.pathPattern = "/submissions/{SubmissionID}/status/validator-published"
|
||||
r.args = args
|
||||
r.count = 1
|
||||
return r, true
|
||||
default:
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
elem = origElem
|
||||
case 'v': // Prefix: "validated"
|
||||
origElem := elem
|
||||
if l := len("validated"); len(elem) >= l && elem[0:l] == "validated" {
|
||||
elem = elem[l:]
|
||||
} else {
|
||||
break
|
||||
@ -1236,9 +1263,9 @@ func (s *Server) FindPath(method string, u *url.URL) (r Route, _ bool) {
|
||||
switch method {
|
||||
case "POST":
|
||||
r.name = ActionSubmissionValidateOperation
|
||||
r.summary = "Role Validator changes status from Validating -> Validated"
|
||||
r.summary = "(Internal endpoint) Role Validator changes status from Validating -> Validated"
|
||||
r.operationID = "actionSubmissionValidate"
|
||||
r.pathPattern = "/submissions/{SubmissionID}/status/validate"
|
||||
r.pathPattern = "/submissions/{SubmissionID}/status/validator-validated"
|
||||
r.args = args
|
||||
r.count = 1
|
||||
return r, true
|
||||
@ -1264,6 +1291,9 @@ func (s *Server) FindPath(method string, u *url.URL) (r Route, _ bool) {
|
||||
|
||||
elem = origElem
|
||||
}
|
||||
|
||||
elem = origElem
|
||||
}
|
||||
}
|
||||
return r, false
|
||||
}
|
||||
|
@ -10,9 +10,9 @@ import (
|
||||
type Handler interface {
|
||||
// ActionSubmissionPublish implements actionSubmissionPublish operation.
|
||||
//
|
||||
// Role Validator changes status from Publishing -> Published.
|
||||
// (Internal endpoint) Role Validator changes status from Publishing -> Published.
|
||||
//
|
||||
// POST /submissions/{SubmissionID}/status/publish
|
||||
// POST /submissions/{SubmissionID}/status/validator-published
|
||||
ActionSubmissionPublish(ctx context.Context, params ActionSubmissionPublishParams) error
|
||||
// ActionSubmissionReject implements actionSubmissionReject operation.
|
||||
//
|
||||
@ -52,9 +52,9 @@ type Handler interface {
|
||||
ActionSubmissionTriggerValidate(ctx context.Context, params ActionSubmissionTriggerValidateParams) error
|
||||
// ActionSubmissionValidate implements actionSubmissionValidate operation.
|
||||
//
|
||||
// Role Validator changes status from Validating -> Validated.
|
||||
// (Internal endpoint) Role Validator changes status from Validating -> Validated.
|
||||
//
|
||||
// POST /submissions/{SubmissionID}/status/validate
|
||||
// POST /submissions/{SubmissionID}/status/validator-validated
|
||||
ActionSubmissionValidate(ctx context.Context, params ActionSubmissionValidateParams) error
|
||||
// CreateScript implements createScript operation.
|
||||
//
|
||||
|
@ -15,9 +15,9 @@ var _ Handler = UnimplementedHandler{}
|
||||
|
||||
// ActionSubmissionPublish implements actionSubmissionPublish operation.
|
||||
//
|
||||
// Role Validator changes status from Publishing -> Published.
|
||||
// (Internal endpoint) Role Validator changes status from Publishing -> Published.
|
||||
//
|
||||
// POST /submissions/{SubmissionID}/status/publish
|
||||
// POST /submissions/{SubmissionID}/status/validator-published
|
||||
func (UnimplementedHandler) ActionSubmissionPublish(ctx context.Context, params ActionSubmissionPublishParams) error {
|
||||
return ht.ErrNotImplemented
|
||||
}
|
||||
@ -78,9 +78,9 @@ func (UnimplementedHandler) ActionSubmissionTriggerValidate(ctx context.Context,
|
||||
|
||||
// ActionSubmissionValidate implements actionSubmissionValidate operation.
|
||||
//
|
||||
// Role Validator changes status from Validating -> Validated.
|
||||
// (Internal endpoint) Role Validator changes status from Validating -> Validated.
|
||||
//
|
||||
// POST /submissions/{SubmissionID}/status/validate
|
||||
// POST /submissions/{SubmissionID}/status/validator-validated
|
||||
func (UnimplementedHandler) ActionSubmissionValidate(ctx context.Context, params ActionSubmissionValidateParams) error {
|
||||
return ht.ErrNotImplemented
|
||||
}
|
||||
|
@ -66,9 +66,9 @@ pub type ReqwestError=reqwest::Error;
|
||||
|
||||
// there are lots of action endpoints and they all follow the same pattern
|
||||
macro_rules! action{
|
||||
($fname:ident,$action:ident)=>{
|
||||
($fname:ident,$action:expr)=>{
|
||||
pub async fn $fname(&self,config:SubmissionID)->Result<(),Error>{
|
||||
let url_raw=format!(concat!("{}/submissions/{}/status/",stringify!($action)),self.base_url,config.0);
|
||||
let url_raw=format!(concat!("{}/submissions/{}/status/",$action),self.base_url,config.0);
|
||||
let url=reqwest::Url::parse(url_raw.as_str()).map_err(Error::ParseError)?;
|
||||
|
||||
self.post(url).await.map_err(Error::Reqwest)?
|
||||
@ -125,6 +125,6 @@ impl Context{
|
||||
|
||||
Ok(())
|
||||
}
|
||||
action!(action_submission_validate,validate);
|
||||
action!(action_submission_publish,publish);
|
||||
action!(action_submission_validate,"validator-validated");
|
||||
action!(action_submission_publish,"validator-published");
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user