openapi: not optional

This commit is contained in:
2024-12-05 18:48:26 -08:00
parent 005f2ddaee
commit 0c2ee16bde
12 changed files with 81 additions and 521 deletions

View File

@@ -12,19 +12,13 @@ import (
)
func encodeCreateScriptRequest(
req OptScriptCreate,
req *ScriptCreate,
r *http.Request,
) error {
const contentType = "application/json"
if !req.Set {
// Keep request with empty body if value is not set.
return nil
}
e := new(jx.Encoder)
{
if req.Set {
req.Encode(e)
}
req.Encode(e)
}
encoded := e.Bytes()
ht.SetBody(r, bytes.NewReader(encoded), contentType)
@@ -32,19 +26,13 @@ func encodeCreateScriptRequest(
}
func encodeCreateScriptPolicyRequest(
req OptScriptPolicyCreate,
req *ScriptPolicyCreate,
r *http.Request,
) error {
const contentType = "application/json"
if !req.Set {
// Keep request with empty body if value is not set.
return nil
}
e := new(jx.Encoder)
{
if req.Set {
req.Encode(e)
}
req.Encode(e)
}
encoded := e.Bytes()
ht.SetBody(r, bytes.NewReader(encoded), contentType)
@@ -52,19 +40,13 @@ func encodeCreateScriptPolicyRequest(
}
func encodeCreateSubmissionRequest(
req OptSubmissionCreate,
req *SubmissionCreate,
r *http.Request,
) error {
const contentType = "application/json"
if !req.Set {
// Keep request with empty body if value is not set.
return nil
}
e := new(jx.Encoder)
{
if req.Set {
req.Encode(e)
}
req.Encode(e)
}
encoded := e.Bytes()
ht.SetBody(r, bytes.NewReader(encoded), contentType)
@@ -72,19 +54,13 @@ func encodeCreateSubmissionRequest(
}
func encodeUpdateScriptRequest(
req OptScriptUpdate,
req *ScriptUpdate,
r *http.Request,
) error {
const contentType = "application/json"
if !req.Set {
// Keep request with empty body if value is not set.
return nil
}
e := new(jx.Encoder)
{
if req.Set {
req.Encode(e)
}
req.Encode(e)
}
encoded := e.Bytes()
ht.SetBody(r, bytes.NewReader(encoded), contentType)
@@ -92,19 +68,13 @@ func encodeUpdateScriptRequest(
}
func encodeUpdateScriptPolicyRequest(
req OptScriptPolicyUpdate,
req *ScriptPolicyUpdate,
r *http.Request,
) error {
const contentType = "application/json"
if !req.Set {
// Keep request with empty body if value is not set.
return nil
}
e := new(jx.Encoder)
{
if req.Set {
req.Encode(e)
}
req.Encode(e)
}
encoded := e.Bytes()
ht.SetBody(r, bytes.NewReader(encoded), contentType)