Skip to content
Myr

yaml.go

This file

Path

binding/yaml.go

35 lines · 691 bytes · Go

Last changed by

chroe: migrate yaml package to github.com/goccy/go-yaml (#4272)M. Ilham Surya Pratamabefore adoptioncf47752

History of this file

Take it

The walk stopped after 200 commits: lines older than cf32d2d point at it.

chore(deps): bump github.com/pelletier/go-toml/v2 from 2.2.2 to 2.2.4 (#4212)dependabot[bot]before adoptioncf32d2d

lines 1–11why, one step back
1// Copyright 2018 Gin Core Team. All rights reserved.
2// Use of this source code is governed by a MIT style3// license that can be found in the LICENSE file.45package binding67import (8 "bytes"9 "io"10 "net/http"11

chroe: migrate yaml package to github.com/goccy/go-yaml (#4272)M. Ilham Surya Pratamabefore adoptioncf47752

line 12why, one step back
12 "github.com/goccy/go-yaml"

chore(deps): bump github.com/pelletier/go-toml/v2 from 2.2.2 to 2.2.4 (#4212)dependabot[bot]before adoptioncf32d2d

lines 13–35why, one step back
13)
1415type yamlBinding struct{}1617func (yamlBinding) Name() string {18 return "yaml"19}2021func (yamlBinding) Bind(req *http.Request, obj any) error {22 return decodeYAML(req.Body, obj)23}2425func (yamlBinding) BindBody(body []byte, obj any) error {26 return decodeYAML(bytes.NewReader(body), obj)27}2829func decodeYAML(r io.Reader, obj any) error {30 decoder := yaml.NewDecoder(r)31 if err := decoder.Decode(obj); err != nil {32 return err33 }34 return validate(obj)35}