go-youtubekids-client/oas_validators_gen.go
Aleksander Garin fb9fd9880e - Upgrade schema
- Add constants
- Add default
- Add set default for request payload
- Fixes
2023-08-22 17:46:51 +03:00

758 lines
16 KiB
Go

// Code generated by ogen, DO NOT EDIT.
package go_youtubekids_client
import (
"fmt"
"github.com/go-faster/errors"
"github.com/ogen-go/ogen/validate"
)
func (s *AnchoredSectionRenderer) Validate() error {
var failures []validate.FieldError
if err := func() error {
if s.Content.Set {
if err := func() error {
if err := s.Content.Value.Validate(); err != nil {
return err
}
return nil
}(); err != nil {
return err
}
}
return nil
}(); err != nil {
failures = append(failures, validate.FieldError{
Name: "content",
Error: err,
})
}
if len(failures) > 0 {
return &validate.Error{Fields: failures}
}
return nil
}
func (s *AnchoredSectionRendererContent) Validate() error {
var failures []validate.FieldError
if err := func() error {
if s.SectionListRenderer.Set {
if err := func() error {
if err := s.SectionListRenderer.Value.Validate(); err != nil {
return err
}
return nil
}(); err != nil {
return err
}
}
return nil
}(); err != nil {
failures = append(failures, validate.FieldError{
Name: "sectionListRenderer",
Error: err,
})
}
if len(failures) > 0 {
return &validate.Error{Fields: failures}
}
return nil
}
func (s *BrowseRequestPayload) Validate() error {
var failures []validate.FieldError
if err := func() error {
if err := s.Context.Validate(); err != nil {
return err
}
return nil
}(); err != nil {
failures = append(failures, validate.FieldError{
Name: "context",
Error: err,
})
}
if len(failures) > 0 {
return &validate.Error{Fields: failures}
}
return nil
}
func (s *BrowseResponsePayload) Validate() error {
var failures []validate.FieldError
if err := func() error {
if err := s.Contents.Validate(); err != nil {
return err
}
return nil
}(); err != nil {
failures = append(failures, validate.FieldError{
Name: "contents",
Error: err,
})
}
if len(failures) > 0 {
return &validate.Error{Fields: failures}
}
return nil
}
func (s *BrowseResponsePayloadContents) Validate() error {
var failures []validate.FieldError
if err := func() error {
if s.KidsHomeScreenRenderer.Set {
if err := func() error {
if err := s.KidsHomeScreenRenderer.Value.Validate(); err != nil {
return err
}
return nil
}(); err != nil {
return err
}
}
return nil
}(); err != nil {
failures = append(failures, validate.FieldError{
Name: "kidsHomeScreenRenderer",
Error: err,
})
}
if len(failures) > 0 {
return &validate.Error{Fields: failures}
}
return nil
}
func (s *CompactChannelRenderer) Validate() error {
var failures []validate.FieldError
if err := func() error {
if err := s.DisplayName.Validate(); err != nil {
return err
}
return nil
}(); err != nil {
failures = append(failures, validate.FieldError{
Name: "displayName",
Error: err,
})
}
if err := func() error {
if err := s.VideoCountText.Validate(); err != nil {
return err
}
return nil
}(); err != nil {
failures = append(failures, validate.FieldError{
Name: "videoCountText",
Error: err,
})
}
if err := func() error {
if s.SubscriberCountText.Set {
if err := func() error {
if err := s.SubscriberCountText.Value.Validate(); err != nil {
return err
}
return nil
}(); err != nil {
return err
}
}
return nil
}(); err != nil {
failures = append(failures, validate.FieldError{
Name: "subscriberCountText",
Error: err,
})
}
if err := func() error {
if err := s.Title.Validate(); err != nil {
return err
}
return nil
}(); err != nil {
failures = append(failures, validate.FieldError{
Name: "title",
Error: err,
})
}
if len(failures) > 0 {
return &validate.Error{Fields: failures}
}
return nil
}
func (s *CompactPlaylistRenderer) Validate() error {
var failures []validate.FieldError
if err := func() error {
if err := s.Title.Validate(); err != nil {
return err
}
return nil
}(); err != nil {
failures = append(failures, validate.FieldError{
Name: "title",
Error: err,
})
}
if err := func() error {
if s.ShortBylineText.Set {
if err := func() error {
if err := s.ShortBylineText.Value.Validate(); err != nil {
return err
}
return nil
}(); err != nil {
return err
}
}
return nil
}(); err != nil {
failures = append(failures, validate.FieldError{
Name: "shortBylineText",
Error: err,
})
}
if err := func() error {
if s.VideoCountText.Set {
if err := func() error {
if err := s.VideoCountText.Value.Validate(); err != nil {
return err
}
return nil
}(); err != nil {
return err
}
}
return nil
}(); err != nil {
failures = append(failures, validate.FieldError{
Name: "videoCountText",
Error: err,
})
}
if err := func() error {
if s.VideoCountShortText.Set {
if err := func() error {
if err := s.VideoCountShortText.Value.Validate(); err != nil {
return err
}
return nil
}(); err != nil {
return err
}
}
return nil
}(); err != nil {
failures = append(failures, validate.FieldError{
Name: "videoCountShortText",
Error: err,
})
}
if err := func() error {
if s.ThumbnailText.Set {
if err := func() error {
if err := s.ThumbnailText.Value.Validate(); err != nil {
return err
}
return nil
}(); err != nil {
return err
}
}
return nil
}(); err != nil {
failures = append(failures, validate.FieldError{
Name: "thumbnailText",
Error: err,
})
}
if err := func() error {
if s.LongBylineText.Set {
if err := func() error {
if err := s.LongBylineText.Value.Validate(); err != nil {
return err
}
return nil
}(); err != nil {
return err
}
}
return nil
}(); err != nil {
failures = append(failures, validate.FieldError{
Name: "longBylineText",
Error: err,
})
}
if len(failures) > 0 {
return &validate.Error{Fields: failures}
}
return nil
}
func (s *CompactVideoRenderer) Validate() error {
var failures []validate.FieldError
if err := func() error {
if err := s.Title.Validate(); err != nil {
return err
}
return nil
}(); err != nil {
failures = append(failures, validate.FieldError{
Name: "title",
Error: err,
})
}
if err := func() error {
if s.LongBylineText.Set {
if err := func() error {
if err := s.LongBylineText.Value.Validate(); err != nil {
return err
}
return nil
}(); err != nil {
return err
}
}
return nil
}(); err != nil {
failures = append(failures, validate.FieldError{
Name: "longBylineText",
Error: err,
})
}
if err := func() error {
if s.PublishedTimeText.Set {
if err := func() error {
if err := s.PublishedTimeText.Value.Validate(); err != nil {
return err
}
return nil
}(); err != nil {
return err
}
}
return nil
}(); err != nil {
failures = append(failures, validate.FieldError{
Name: "publishedTimeText",
Error: err,
})
}
if err := func() error {
if err := s.ViewCountText.Validate(); err != nil {
return err
}
return nil
}(); err != nil {
failures = append(failures, validate.FieldError{
Name: "viewCountText",
Error: err,
})
}
if err := func() error {
if s.LengthText.Set {
if err := func() error {
if err := s.LengthText.Value.Validate(); err != nil {
return err
}
return nil
}(); err != nil {
return err
}
}
return nil
}(); err != nil {
failures = append(failures, validate.FieldError{
Name: "lengthText",
Error: err,
})
}
if err := func() error {
if s.ShortBylineText.Set {
if err := func() error {
if err := s.ShortBylineText.Value.Validate(); err != nil {
return err
}
return nil
}(); err != nil {
return err
}
}
return nil
}(); err != nil {
failures = append(failures, validate.FieldError{
Name: "shortBylineText",
Error: err,
})
}
if err := func() error {
if s.ShortViewCountText.Set {
if err := func() error {
if err := s.ShortViewCountText.Value.Validate(); err != nil {
return err
}
return nil
}(); err != nil {
return err
}
}
return nil
}(); err != nil {
failures = append(failures, validate.FieldError{
Name: "shortViewCountText",
Error: err,
})
}
if len(failures) > 0 {
return &validate.Error{Fields: failures}
}
return nil
}
func (s *ItemSectionRenderer) Validate() error {
var failures []validate.FieldError
if err := func() error {
if s.Contents == nil {
return errors.New("nil is invalid value")
}
var failures []validate.FieldError
for i, elem := range s.Contents {
if err := func() error {
if err := elem.Validate(); err != nil {
return err
}
return nil
}(); err != nil {
failures = append(failures, validate.FieldError{
Name: fmt.Sprintf("[%d]", i),
Error: err,
})
}
}
if len(failures) > 0 {
return &validate.Error{Fields: failures}
}
return nil
}(); err != nil {
failures = append(failures, validate.FieldError{
Name: "contents",
Error: err,
})
}
if len(failures) > 0 {
return &validate.Error{Fields: failures}
}
return nil
}
func (s *ItemSectionRendererContentsItem) Validate() error {
var failures []validate.FieldError
if err := func() error {
if s.CompactPlaylistRenderer.Set {
if err := func() error {
if err := s.CompactPlaylistRenderer.Value.Validate(); err != nil {
return err
}
return nil
}(); err != nil {
return err
}
}
return nil
}(); err != nil {
failures = append(failures, validate.FieldError{
Name: "compactPlaylistRenderer",
Error: err,
})
}
if err := func() error {
if s.CompactChannelRenderer.Set {
if err := func() error {
if err := s.CompactChannelRenderer.Value.Validate(); err != nil {
return err
}
return nil
}(); err != nil {
return err
}
}
return nil
}(); err != nil {
failures = append(failures, validate.FieldError{
Name: "compactChannelRenderer",
Error: err,
})
}
if err := func() error {
if s.CompactVideoRenderer.Set {
if err := func() error {
if err := s.CompactVideoRenderer.Value.Validate(); err != nil {
return err
}
return nil
}(); err != nil {
return err
}
}
return nil
}(); err != nil {
failures = append(failures, validate.FieldError{
Name: "compactVideoRenderer",
Error: err,
})
}
if len(failures) > 0 {
return &validate.Error{Fields: failures}
}
return nil
}
func (s *KidsAppContentSettings) Validate() error {
var failures []validate.FieldError
if err := func() error {
if err := s.CorpusPreference.Validate(); err != nil {
return err
}
return nil
}(); err != nil {
failures = append(failures, validate.FieldError{
Name: "corpusPreference",
Error: err,
})
}
if err := func() error {
if err := s.KidsNoSearchMode.Validate(); err != nil {
return err
}
return nil
}(); err != nil {
failures = append(failures, validate.FieldError{
Name: "kidsNoSearchMode",
Error: err,
})
}
if len(failures) > 0 {
return &validate.Error{Fields: failures}
}
return nil
}
func (s KidsAppContentSettingsCorpusPreference) Validate() error {
switch s {
case "KIDS_CORPUS_PREFERENCE_UNKNOWN":
return nil
case "KIDS_CORPUS_PREFERENCE_YOUNGER":
return nil
case "KIDS_CORPUS_PREFERENCE_TWEEN":
return nil
case "KIDS_CORPUS_PREFERENCE_PAM_YOUNGER":
return nil
case "KIDS_CORPUS_PREFERENCE_PAM_TWEEN":
return nil
case "KIDS_CORPUS_PREFERENCE_PRESCHOOL":
return nil
default:
return errors.Errorf("invalid value: %v", s)
}
}
func (s KidsAppContentSettingsKidsNoSearchMode) Validate() error {
switch s {
case "YT_KIDS_NO_SEARCH_MODE_UNKNOWN":
return nil
case "YT_KIDS_NO_SEARCH_MODE_ON":
return nil
case "YT_KIDS_NO_SEARCH_MODE_OFF":
return nil
default:
return errors.Errorf("invalid value: %v", s)
}
}
func (s *KidsAppInfo) Validate() error {
var failures []validate.FieldError
if err := func() error {
if s.ContentSettings.Set {
if err := func() error {
if err := s.ContentSettings.Value.Validate(); err != nil {
return err
}
return nil
}(); err != nil {
return err
}
}
return nil
}(); err != nil {
failures = append(failures, validate.FieldError{
Name: "contentSettings",
Error: err,
})
}
if len(failures) > 0 {
return &validate.Error{Fields: failures}
}
return nil
}
func (s *RequestClient) Validate() error {
var failures []validate.FieldError
if err := func() error {
if err := s.KidsAppInfo.Validate(); err != nil {
return err
}
return nil
}(); err != nil {
failures = append(failures, validate.FieldError{
Name: "kidsAppInfo",
Error: err,
})
}
if len(failures) > 0 {
return &validate.Error{Fields: failures}
}
return nil
}
func (s *RequestContext) Validate() error {
var failures []validate.FieldError
if err := func() error {
if err := s.Client.Validate(); err != nil {
return err
}
return nil
}(); err != nil {
failures = append(failures, validate.FieldError{
Name: "client",
Error: err,
})
}
if len(failures) > 0 {
return &validate.Error{Fields: failures}
}
return nil
}
func (s *ScreenAnchor) Validate() error {
var failures []validate.FieldError
if err := func() error {
if s.AnchoredSectionRenderer.Set {
if err := func() error {
if err := s.AnchoredSectionRenderer.Value.Validate(); err != nil {
return err
}
return nil
}(); err != nil {
return err
}
}
return nil
}(); err != nil {
failures = append(failures, validate.FieldError{
Name: "anchoredSectionRenderer",
Error: err,
})
}
if len(failures) > 0 {
return &validate.Error{Fields: failures}
}
return nil
}
func (s *ScreenRenderer) Validate() error {
var failures []validate.FieldError
if err := func() error {
var failures []validate.FieldError
for i, elem := range s.Anchors {
if err := func() error {
if err := elem.Validate(); err != nil {
return err
}
return nil
}(); err != nil {
failures = append(failures, validate.FieldError{
Name: fmt.Sprintf("[%d]", i),
Error: err,
})
}
}
if len(failures) > 0 {
return &validate.Error{Fields: failures}
}
return nil
}(); err != nil {
failures = append(failures, validate.FieldError{
Name: "anchors",
Error: err,
})
}
if len(failures) > 0 {
return &validate.Error{Fields: failures}
}
return nil
}
func (s *SectionListRenderer) Validate() error {
var failures []validate.FieldError
if err := func() error {
var failures []validate.FieldError
for i, elem := range s.Contents {
if err := func() error {
if err := elem.Validate(); err != nil {
return err
}
return nil
}(); err != nil {
failures = append(failures, validate.FieldError{
Name: fmt.Sprintf("[%d]", i),
Error: err,
})
}
}
if len(failures) > 0 {
return &validate.Error{Fields: failures}
}
return nil
}(); err != nil {
failures = append(failures, validate.FieldError{
Name: "contents",
Error: err,
})
}
if len(failures) > 0 {
return &validate.Error{Fields: failures}
}
return nil
}
func (s *SectionListRendererContentsItem) Validate() error {
var failures []validate.FieldError
if err := func() error {
if s.ItemSectionRenderer.Set {
if err := func() error {
if err := s.ItemSectionRenderer.Value.Validate(); err != nil {
return err
}
return nil
}(); err != nil {
return err
}
}
return nil
}(); err != nil {
failures = append(failures, validate.FieldError{
Name: "itemSectionRenderer",
Error: err,
})
}
if len(failures) > 0 {
return &validate.Error{Fields: failures}
}
return nil
}
func (s *Text) Validate() error {
var failures []validate.FieldError
if err := func() error {
if s.Runs == nil {
return errors.New("nil is invalid value")
}
return nil
}(); err != nil {
failures = append(failures, validate.FieldError{
Name: "runs",
Error: err,
})
}
if len(failures) > 0 {
return &validate.Error{Fields: failures}
}
return nil
}