prompt answer response

v0.5.12 v0.5.12
Vernon Keenan 2023-06-17 16:42:54 +00:00
parent 7f54aa7811
commit f0a768157c
4 changed files with 53 additions and 3 deletions

View File

@ -25,6 +25,9 @@ type PromptAnswerResponse struct {
// data
Data []*PromptAnswer `json:"Data"`
// meta
Meta *ResponseMeta `json:"Meta,omitempty"`
}
// Validate validates this prompt answer response
@ -35,6 +38,10 @@ func (m *PromptAnswerResponse) Validate(formats strfmt.Registry) error {
res = append(res, err)
}
if err := m.validateMeta(formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
@ -67,6 +74,25 @@ func (m *PromptAnswerResponse) validateData(formats strfmt.Registry) error {
return nil
}
func (m *PromptAnswerResponse) validateMeta(formats strfmt.Registry) error {
if swag.IsZero(m.Meta) { // not required
return nil
}
if m.Meta != nil {
if err := m.Meta.Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("Meta")
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("Meta")
}
return err
}
}
return nil
}
// ContextValidate validate this prompt answer response based on the context it is used
func (m *PromptAnswerResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
var res []error
@ -75,6 +101,10 @@ func (m *PromptAnswerResponse) ContextValidate(ctx context.Context, formats strf
res = append(res, err)
}
if err := m.contextValidateMeta(ctx, formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
@ -101,6 +131,22 @@ func (m *PromptAnswerResponse) contextValidateData(ctx context.Context, formats
return nil
}
func (m *PromptAnswerResponse) contextValidateMeta(ctx context.Context, formats strfmt.Registry) error {
if m.Meta != nil {
if err := m.Meta.ContextValidate(ctx, formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("Meta")
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("Meta")
}
return err
}
}
return nil
}
// MarshalBinary interface implementation
func (m *PromptAnswerResponse) MarshalBinary() ([]byte, error) {
if m == nil {

View File

@ -25,7 +25,7 @@ type Role struct {
Auth0RoleID *string `json:"Auth0RoleID,omitempty"`
// created by
CreatedByID *string `json:"CreatedByID:,omitempty"`
CreatedByID *string `json:"CreatedByID,omitempty"`
// created date
CreatedDate *string `json:"CreatedDate,omitempty"`

View File

@ -4608,6 +4608,8 @@ definitions:
items:
$ref: "../../lib/swagger/defs/prompt-answer.yaml#/PromptAnswer"
type: array
Meta:
$ref: "#/definitions/ResponseMeta"
type: object
RequestMeta:
properties:
@ -4660,7 +4662,7 @@ definitions:
description: the corresponding auth0 role
type: string
x-nullable: true
"CreatedByID:":
CreatedByID:
description: created by
type: string
x-nullable: true

View File

@ -4608,6 +4608,8 @@ definitions:
items:
$ref: "../../lib/swagger/defs/prompt-answer.yaml#/PromptAnswer"
type: array
Meta:
$ref: "#/definitions/ResponseMeta"
type: object
RequestMeta:
properties:
@ -4660,7 +4662,7 @@ definitions:
description: the corresponding auth0 role
type: string
x-nullable: true
"CreatedByID:":
CreatedByID:
description: created by
type: string
x-nullable: true