mirror of
https://github.com/openai/openai-go.git
synced 2026-04-01 09:07:22 +09:00
chore(internal): codegen related update
This commit is contained in:
@@ -469,5 +469,5 @@ func WriteExtras(writer *multipart.Writer, extras map[string]any) (err error) {
|
||||
break
|
||||
}
|
||||
}
|
||||
return
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ func parseFormStructTag(field reflect.StructField) (tag parsedStructTag, ok bool
|
||||
raw, ok = field.Tag.Lookup(jsonStructTag)
|
||||
}
|
||||
if !ok {
|
||||
return
|
||||
return tag, ok
|
||||
}
|
||||
parts := strings.Split(raw, ",")
|
||||
if len(parts) == 0 {
|
||||
@@ -45,7 +45,7 @@ func parseFormStructTag(field reflect.StructField) (tag parsedStructTag, ok bool
|
||||
}
|
||||
|
||||
parseApiStructTag(field, &tag)
|
||||
return
|
||||
return tag, ok
|
||||
}
|
||||
|
||||
func parseApiStructTag(field reflect.StructField, tag *parsedStructTag) {
|
||||
@@ -68,5 +68,5 @@ func parseApiStructTag(field reflect.StructField, tag *parsedStructTag) {
|
||||
|
||||
func parseFormatStructTag(field reflect.StructField) (format string, ok bool) {
|
||||
format, ok = field.Tag.Lookup(formatStructTag)
|
||||
return
|
||||
return format, ok
|
||||
}
|
||||
|
||||
@@ -286,7 +286,7 @@ func (e *encoder) newStructTypeEncoder(t reflect.Type) encoderFunc {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
return
|
||||
return json, err
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -268,7 +268,7 @@ type MarshallingUnionStruct struct {
|
||||
func (r *MarshallingUnionStruct) UnmarshalJSON(data []byte) (err error) {
|
||||
*r = MarshallingUnionStruct{}
|
||||
err = UnmarshalRoot(data, &r.Union)
|
||||
return
|
||||
return err
|
||||
}
|
||||
|
||||
func (r MarshallingUnionStruct) MarshalJSON() (data []byte, err error) {
|
||||
|
||||
@@ -20,7 +20,7 @@ type parsedStructTag struct {
|
||||
func parseJSONStructTag(field reflect.StructField) (tag parsedStructTag, ok bool) {
|
||||
raw, ok := field.Tag.Lookup(jsonStructTag)
|
||||
if !ok {
|
||||
return
|
||||
return tag, ok
|
||||
}
|
||||
parts := strings.Split(raw, ",")
|
||||
if len(parts) == 0 {
|
||||
@@ -42,7 +42,7 @@ func parseJSONStructTag(field reflect.StructField) (tag parsedStructTag, ok bool
|
||||
|
||||
// the `api` struct tag is only used alongside `json` for custom behaviour
|
||||
parseApiStructTag(field, &tag)
|
||||
return
|
||||
return tag, ok
|
||||
}
|
||||
|
||||
func parseApiStructTag(field reflect.StructField, tag *parsedStructTag) {
|
||||
@@ -65,5 +65,5 @@ func parseApiStructTag(field reflect.StructField, tag *parsedStructTag) {
|
||||
|
||||
func parseFormatStructTag(field reflect.StructField) (format string, ok bool) {
|
||||
format, ok = field.Tag.Lookup(formatStructTag)
|
||||
return
|
||||
return format, ok
|
||||
}
|
||||
|
||||
@@ -103,7 +103,7 @@ func (e *encoder) newTypeEncoder(t reflect.Type) encoderFunc {
|
||||
encoder := e.typeEncoder(t.Elem())
|
||||
return func(key string, value reflect.Value) (pairs []Pair, err error) {
|
||||
if !value.IsValid() || value.IsNil() {
|
||||
return
|
||||
return pairs, err
|
||||
}
|
||||
return encoder(key, value.Elem())
|
||||
}
|
||||
@@ -205,7 +205,7 @@ func (e *encoder) newStructTypeEncoder(t reflect.Type) encoderFunc {
|
||||
}
|
||||
pairs = append(pairs, subpairs...)
|
||||
}
|
||||
return
|
||||
return pairs, err
|
||||
}
|
||||
}
|
||||
|
||||
@@ -256,7 +256,7 @@ func (e *encoder) newMapEncoder(t reflect.Type) encoderFunc {
|
||||
}
|
||||
pairs = append(pairs, subpairs...)
|
||||
}
|
||||
return
|
||||
return pairs, err
|
||||
}
|
||||
}
|
||||
|
||||
@@ -300,7 +300,7 @@ func (e *encoder) newArrayTypeEncoder(t reflect.Type) encoderFunc {
|
||||
}
|
||||
pairs = append(pairs, subpairs...)
|
||||
}
|
||||
return
|
||||
return pairs, err
|
||||
}
|
||||
case ArrayQueryFormatIndices:
|
||||
panic("The array indices format is not supported yet")
|
||||
@@ -315,7 +315,7 @@ func (e *encoder) newArrayTypeEncoder(t reflect.Type) encoderFunc {
|
||||
}
|
||||
pairs = append(pairs, subpairs...)
|
||||
}
|
||||
return
|
||||
return pairs, err
|
||||
}
|
||||
default:
|
||||
panic(fmt.Sprintf("Unknown ArrayFormat value: %d", e.settings.ArrayFormat))
|
||||
|
||||
@@ -18,7 +18,7 @@ type parsedStructTag struct {
|
||||
func parseQueryStructTag(field reflect.StructField) (tag parsedStructTag, ok bool) {
|
||||
raw, ok := field.Tag.Lookup(queryStructTag)
|
||||
if !ok {
|
||||
return
|
||||
return tag, ok
|
||||
}
|
||||
parts := strings.Split(raw, ",")
|
||||
if len(parts) == 0 {
|
||||
@@ -35,10 +35,10 @@ func parseQueryStructTag(field reflect.StructField) (tag parsedStructTag, ok boo
|
||||
tag.inline = true
|
||||
}
|
||||
}
|
||||
return
|
||||
return tag, ok
|
||||
}
|
||||
|
||||
func parseFormatStructTag(field reflect.StructField) (format string, ok bool) {
|
||||
format, ok = field.Tag.Lookup(formatStructTag)
|
||||
return
|
||||
return format, ok
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user