// Copyright 2018 Gin Core Team. All rights reserved.// Use of this source code is governed by a MIT style// license that can be found in the LICENSE file.packagebindingimport("bytes""io""net/http""gopkg.in/yaml.v2")typeyamlBindingstruct{}func(yamlBinding)Name()string{return"yaml"}func(yamlBinding)Bind(req*http.Request,objinterface{})error{returndecodeYAML(req.Body,obj)}func(yamlBinding)BindBody(body[]byte,objinterface{})error{returndecodeYAML(bytes.NewReader(body),obj)}funcdecodeYAML(rio.Reader,objinterface{})error{decoder:=yaml.NewDecoder(r)iferr:=decoder.Decode(obj);err!=nil{returnerr}returnvalidate(obj)}