Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions .github/docs/openapi3.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2612,6 +2612,22 @@ func (e *SchemaBothFormsExclusive) Error() string

func (e *SchemaBothFormsExclusive) Unwrap() error

type SchemaCombinatorElementValidationError struct {
// Combinator is the keyword whose element failed ("oneOf", "anyOf",
// "allOf").
Combinator string
Cause error
}
SchemaCombinatorElementValidationError wraps a validation error originating
in one of the sub-schemas listed under a schema's oneOf, anyOf, or allOf
keyword. Combinator names which keyword the offending element belongs
to ("oneOf", "anyOf", "allOf"). The wrapper adds the combinator scope;
the actual failure lives in Cause.

func (e *SchemaCombinatorElementValidationError) Error() string

func (e *SchemaCombinatorElementValidationError) Unwrap() error

type SchemaError struct {
// Value is the value that failed validation.
Value any
Expand Down Expand Up @@ -3318,6 +3334,19 @@ func (t *Tag) UnmarshalJSON(data []byte) error
func (t *Tag) Validate(ctx context.Context, opts ...ValidationOption) error
Validate returns an error if Tag does not comply with the OpenAPI spec.

type TagValidationError struct {
// Name is the tag's `name:` value.
Name string
Cause error
}
TagValidationError wraps a validation error originating inside a single tag
in the document-root Tags list. Name is the tag's `name:` value, so callers
can tell which tag failed without parsing the rendered message.

func (e *TagValidationError) Error() string

func (e *TagValidationError) Unwrap() error

type Tags []*Tag
Tags is specified by OpenAPI/Swagger 3.0 standard.

Expand Down
2 changes: 1 addition & 1 deletion openapi3/openapi3_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,7 @@ components:
name: "tags section is invalid",
spec: strings.Replace(spec, tags,
strings.ReplaceAll(tags, "url: https://tags-ext-docs.com", "url: ''"), 1),
expectedErr: "invalid tags: invalid external docs: url is required",
expectedErr: "invalid tags: tag \"pet\": invalid external docs: url is required",
},
}
for i := range tests {
Expand Down
6 changes: 3 additions & 3 deletions openapi3/schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -1554,7 +1554,7 @@ func (schema *Schema) validate(ctx context.Context, stack []*Schema) ([]*Schema,

var err error
if stack, err = v.validate(ctx, stack); err != nil {
return stack, err
return stack, &SchemaCombinatorElementValidationError{Combinator: "oneOf", Cause: err}
}
}

Expand All @@ -1566,7 +1566,7 @@ func (schema *Schema) validate(ctx context.Context, stack []*Schema) ([]*Schema,

var err error
if stack, err = v.validate(ctx, stack); err != nil {
return stack, err
return stack, &SchemaCombinatorElementValidationError{Combinator: "anyOf", Cause: err}
}
}

Expand All @@ -1578,7 +1578,7 @@ func (schema *Schema) validate(ctx context.Context, stack []*Schema) ([]*Schema,

var err error
if stack, err = v.validate(ctx, stack); err != nil {
return stack, err
return stack, &SchemaCombinatorElementValidationError{Combinator: "allOf", Cause: err}
}
}

Expand Down
3 changes: 2 additions & 1 deletion openapi3/tag.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ func (tags Tags) Validate(ctx context.Context, opts ...ValidationOption) error {
me := newErrCollector(ctx)

for _, v := range tags {
if err := me.emit(v.Validate(ctx)); err != nil {
wrap := func(e error) error { return &TagValidationError{Name: v.Name, Cause: e} }
if err := me.emitWrapped(wrap, v.Validate(ctx)); err != nil {
return err
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
invalid components: schema "CertificateDetail": error parsing regexp: invalid or unsupported Perl syntax: `(?!`
invalid components: schema "CertificateDetail": invalid allOf element: error parsing regexp: invalid or unsupported Perl syntax: `(?!`
Original file line number Diff line number Diff line change
@@ -1 +1 @@
invalid components: schema "AddressBook": error parsing regexp: invalid repeat count: `{0,1023}`
invalid components: schema "AddressBook": invalid allOf element: error parsing regexp: invalid repeat count: `{0,1023}`
Original file line number Diff line number Diff line change
@@ -1 +1 @@
invalid components: schema "CreateDomainAssociationRequest": error parsing regexp: invalid or unsupported Perl syntax: `(?!`
invalid components: schema "CreateDomainAssociationRequest": invalid allOf element: error parsing regexp: invalid or unsupported Perl syntax: `(?!`
Original file line number Diff line number Diff line change
@@ -1 +1 @@
invalid components: schema "StartConfigurationSessionResponse": error parsing regexp: invalid repeat count: `{1,8192}`
invalid components: schema "StartConfigurationSessionResponse": invalid allOf element: error parsing regexp: invalid repeat count: `{1,8192}`
Original file line number Diff line number Diff line change
@@ -1 +1 @@
invalid components: schema "DescribeScalingPoliciesResponse": error parsing regexp: invalid character class range: `\p{Print}`
invalid components: schema "DescribeScalingPoliciesResponse": invalid allOf element: error parsing regexp: invalid character class range: `\p{Print}`
Original file line number Diff line number Diff line change
@@ -1 +1 @@
invalid components: schema "GetReportDefinitionResult": error parsing regexp: invalid or unsupported Perl syntax: `(?=`
invalid components: schema "GetReportDefinitionResult": invalid allOf element: error parsing regexp: invalid or unsupported Perl syntax: `(?=`
Original file line number Diff line number Diff line change
@@ -1 +1 @@
invalid components: schema "AppBlock": error parsing regexp: invalid repeat count: `{0,1023}`
invalid components: schema "AppBlock": invalid allOf element: error parsing regexp: invalid repeat count: `{0,1023}`
Original file line number Diff line number Diff line change
@@ -1 +1 @@
invalid components: schema "CreateScalingPlanRequest": error parsing regexp: invalid character class range: `\p{Print}`
invalid components: schema "CreateScalingPlanRequest": invalid allOf element: error parsing regexp: invalid character class range: `\p{Print}`
Original file line number Diff line number Diff line change
@@ -1 +1 @@
invalid components: schema "AppInstance": error parsing regexp: invalid repeat count: `{0,1023}`
invalid components: schema "AppInstance": invalid allOf element: error parsing regexp: invalid repeat count: `{0,1023}`
Original file line number Diff line number Diff line change
@@ -1 +1 @@
invalid components: schema "AppInstance": error parsing regexp: invalid repeat count: `{0,1023}`
invalid components: schema "AppInstance": invalid allOf element: error parsing regexp: invalid repeat count: `{0,1023}`
Original file line number Diff line number Diff line change
@@ -1 +1 @@
invalid components: schema "CreateMeetingRequest": error parsing regexp: invalid or unsupported Perl syntax: `(?!`
invalid components: schema "CreateMeetingRequest": invalid allOf element: error parsing regexp: invalid or unsupported Perl syntax: `(?!`
Original file line number Diff line number Diff line change
@@ -1 +1 @@
invalid components: schema "AssociateChannelFlowRequest": error parsing regexp: invalid repeat count: `{0,1023}`
invalid components: schema "AssociateChannelFlowRequest": invalid allOf element: error parsing regexp: invalid repeat count: `{0,1023}`
Original file line number Diff line number Diff line change
@@ -1 +1 @@
invalid components: schema "Collaboration": error parsing regexp: invalid or unsupported Perl syntax: `(?!`
invalid components: schema "Collaboration": invalid allOf element: error parsing regexp: invalid or unsupported Perl syntax: `(?!`
Original file line number Diff line number Diff line change
@@ -1 +1 @@
invalid components: schema "CreateDevEnvironmentRequest": error parsing regexp: invalid or unsupported Perl syntax: `(?!`
invalid components: schema "CreateDevEnvironmentRequest": invalid allOf element: error parsing regexp: invalid or unsupported Perl syntax: `(?!`
Original file line number Diff line number Diff line change
@@ -1 +1 @@
invalid components: schema "DescribeUserPoolDomainResponse": error parsing regexp: invalid named capture: `(?<!\.)$`
invalid components: schema "DescribeUserPoolDomainResponse": invalid allOf element: error parsing regexp: invalid named capture: `(?<!\.)$`
Original file line number Diff line number Diff line change
@@ -1 +1 @@
invalid components: schema "CreateEntityRecognizerRequest": error parsing regexp: invalid or unsupported Perl syntax: `(?!`
invalid components: schema "CreateEntityRecognizerRequest": invalid allOf element: error parsing regexp: invalid or unsupported Perl syntax: `(?!`
Original file line number Diff line number Diff line change
@@ -1 +1 @@
invalid components: schema "ComprehendMedicalAsyncJobProperties": error parsing regexp: invalid or unsupported Perl syntax: `(?!`
invalid components: schema "ComprehendMedicalAsyncJobProperties": invalid allOf element: error parsing regexp: invalid or unsupported Perl syntax: `(?!`
Original file line number Diff line number Diff line change
@@ -1 +1 @@
invalid components: schema "CreateInstanceRequest": error parsing regexp: invalid or unsupported Perl syntax: `(?!`
invalid components: schema "CreateInstanceRequest": invalid allOf element: error parsing regexp: invalid or unsupported Perl syntax: `(?!`
Original file line number Diff line number Diff line change
@@ -1 +1 @@
invalid components: schema "AddStorageSystemRequest": error parsing regexp: invalid or unsupported Perl syntax: `(?!`
invalid components: schema "AddStorageSystemRequest": invalid allOf element: error parsing regexp: invalid or unsupported Perl syntax: `(?!`
Original file line number Diff line number Diff line change
@@ -1 +1 @@
invalid components: schema "Account": error parsing regexp: invalid or unsupported Perl syntax: `(?!`
invalid components: schema "Account": invalid allOf element: error parsing regexp: invalid or unsupported Perl syntax: `(?!`
Original file line number Diff line number Diff line change
@@ -1 +1 @@
invalid components: schema "CreateLifecyclePolicyRequest": error parsing regexp: invalid character class range: `\p{all}`
invalid components: schema "CreateLifecyclePolicyRequest": invalid allOf element: error parsing regexp: invalid character class range: `\p{all}`
Original file line number Diff line number Diff line change
@@ -1 +1 @@
invalid components: schema "AutoScalingPolicyDescription": error parsing regexp: invalid character class range: `\p{Print}`
invalid components: schema "AutoScalingPolicyDescription": invalid allOf element: error parsing regexp: invalid character class range: `\p{Print}`
Original file line number Diff line number Diff line change
@@ -1 +1 @@
invalid components: schema "AccessPointDescription": error parsing regexp: invalid or unsupported Perl syntax: `(?!`
invalid components: schema "AccessPointDescription": invalid allOf element: error parsing regexp: invalid or unsupported Perl syntax: `(?!`
Original file line number Diff line number Diff line change
@@ -1 +1 @@
invalid components: schema "Artwork": error parsing regexp: invalid repeat count: `{1,1020}`
invalid components: schema "Artwork": invalid allOf element: error parsing regexp: invalid repeat count: `{1,1020}`
Original file line number Diff line number Diff line change
@@ -1 +1 @@
invalid components: schema "GetManagedEndpointSessionCredentialsRequest": error parsing regexp: invalid or unsupported Perl syntax: `(?!`
invalid components: schema "GetManagedEndpointSessionCredentialsRequest": invalid allOf element: error parsing regexp: invalid or unsupported Perl syntax: `(?!`
Original file line number Diff line number Diff line change
@@ -1 +1 @@
invalid components: schema "ChangeProgressDetails": error parsing regexp: invalid character class range: `\p{XDigit}`
invalid components: schema "ChangeProgressDetails": invalid allOf element: error parsing regexp: invalid character class range: `\p{XDigit}`
Original file line number Diff line number Diff line change
@@ -1 +1 @@
invalid components: schema "HttpParameters": error parsing regexp: invalid or unsupported Perl syntax: `(?!`
invalid components: schema "HttpParameters": invalid allOf element: error parsing regexp: invalid or unsupported Perl syntax: `(?!`
Original file line number Diff line number Diff line change
@@ -1 +1 @@
invalid components: schema "HttpParameters": error parsing regexp: invalid or unsupported Perl syntax: `(?!`
invalid components: schema "HttpParameters": invalid allOf element: error parsing regexp: invalid or unsupported Perl syntax: `(?!`
Original file line number Diff line number Diff line change
@@ -1 +1 @@
invalid components: schema "CreateKxClusterRequest": error parsing regexp: invalid or unsupported Perl syntax: `(?!`
invalid components: schema "CreateKxClusterRequest": invalid allOf element: error parsing regexp: invalid or unsupported Perl syntax: `(?!`
Original file line number Diff line number Diff line change
@@ -1 +1 @@
invalid components: schema "AmazonOpenSearchServerlessDestinationConfiguration": error parsing regexp: invalid or unsupported Perl syntax: `(?!`
invalid components: schema "AmazonOpenSearchServerlessDestinationConfiguration": invalid allOf element: error parsing regexp: invalid or unsupported Perl syntax: `(?!`
Original file line number Diff line number Diff line change
@@ -1 +1 @@
invalid components: schema "FMSPolicyUpdateFirewallCreationConfigAction": error parsing regexp: invalid or unsupported Perl syntax: `(?!`
invalid components: schema "FMSPolicyUpdateFirewallCreationConfigAction": invalid allOf element: error parsing regexp: invalid or unsupported Perl syntax: `(?!`
Original file line number Diff line number Diff line change
@@ -1 +1 @@
invalid components: schema "AntennaDownlinkDemodDecodeConfig": error parsing regexp: invalid repeat count: `{2,8192}`
invalid components: schema "AntennaDownlinkDemodDecodeConfig": invalid allOf element: error parsing regexp: invalid repeat count: `{2,8192}`
Original file line number Diff line number Diff line change
@@ -1 +1 @@
invalid components: schema "GetMalwareScanSettingsResponse": error parsing regexp: invalid or unsupported Perl syntax: `(?!`
invalid components: schema "GetMalwareScanSettingsResponse": invalid allOf element: error parsing regexp: invalid or unsupported Perl syntax: `(?!`
Original file line number Diff line number Diff line change
@@ -1 +1 @@
invalid components: schema "AffectedEntity": error parsing regexp: invalid repeat count: `{0,1600}`
invalid components: schema "AffectedEntity": invalid allOf element: error parsing regexp: invalid repeat count: `{0,1600}`
Original file line number Diff line number Diff line change
@@ -1 +1 @@
invalid components: schema "BatchCreateTableRowsRequest": error parsing regexp: invalid or unsupported Perl syntax: `(?!`
invalid components: schema "BatchCreateTableRowsRequest": invalid allOf element: error parsing regexp: invalid or unsupported Perl syntax: `(?!`
Original file line number Diff line number Diff line change
@@ -1 +1 @@
invalid components: schema "CreateAccountAliasRequest": error parsing regexp: invalid or unsupported Perl syntax: `(?!`
invalid components: schema "CreateAccountAliasRequest": invalid allOf element: error parsing regexp: invalid or unsupported Perl syntax: `(?!`
Original file line number Diff line number Diff line change
@@ -1 +1 @@
invalid components: schema "AlternateIdentifier": error parsing regexp: invalid character class range: `\p\`
invalid components: schema "AlternateIdentifier": invalid allOf element: error parsing regexp: invalid character class range: `\p\`
Original file line number Diff line number Diff line change
@@ -1 +1 @@
invalid components: schema "Filter": error parsing regexp: invalid repeat count: `{1,1024}`
invalid components: schema "Filter": invalid allOf element: error parsing regexp: invalid repeat count: `{1,1024}`
Original file line number Diff line number Diff line change
@@ -1 +1 @@
invalid components: schema "DescribeJobExecutionResponse": error parsing regexp: invalid character class range: `\p\`
invalid components: schema "DescribeJobExecutionResponse": invalid allOf element: error parsing regexp: invalid character class range: `\p\`
Original file line number Diff line number Diff line change
@@ -1 +1 @@
invalid components: schema "BatchPutMessageRequest": error parsing regexp: invalid or unsupported Perl syntax: `(?!`
invalid components: schema "BatchPutMessageRequest": invalid allOf element: error parsing regexp: invalid or unsupported Perl syntax: `(?!`
Original file line number Diff line number Diff line change
@@ -1 +1 @@
invalid components: schema "DescribeTunnelResponse": error parsing regexp: invalid repeat count: `{1,2048}`
invalid components: schema "DescribeTunnelResponse": invalid allOf element: error parsing regexp: invalid repeat count: `{1,2048}`
Original file line number Diff line number Diff line change
@@ -1 +1 @@
invalid components: schema "AssociateEntityToThingRequest": error parsing regexp: invalid character class range: `\p{Alnum}`
invalid components: schema "AssociateEntityToThingRequest": invalid allOf element: error parsing regexp: invalid character class range: `\p{Alnum}`
Original file line number Diff line number Diff line change
@@ -1 +1 @@
invalid components: schema "DownlinkQueueMessage": error parsing regexp: invalid or unsupported Perl syntax: `(?!`
invalid components: schema "DownlinkQueueMessage": invalid allOf element: error parsing regexp: invalid or unsupported Perl syntax: `(?!`
Original file line number Diff line number Diff line change
@@ -1 +1 @@
invalid components: schema "AlfrescoConfiguration": error parsing regexp: invalid or unsupported Perl syntax: `(?!`
invalid components: schema "AlfrescoConfiguration": invalid allOf element: error parsing regexp: invalid or unsupported Perl syntax: `(?!`
Original file line number Diff line number Diff line change
@@ -1 +1 @@
invalid components: schema "CreateRescoreExecutionPlanResponse": error parsing regexp: invalid repeat count: `{0,1023}`
invalid components: schema "CreateRescoreExecutionPlanResponse": invalid allOf element: error parsing regexp: invalid repeat count: `{0,1023}`
Original file line number Diff line number Diff line change
@@ -1 +1 @@
invalid components: schema "AddApplicationInputRequest": error parsing regexp: invalid or unsupported Perl syntax: `(?=`
invalid components: schema "AddApplicationInputRequest": invalid allOf element: error parsing regexp: invalid or unsupported Perl syntax: `(?=`
Original file line number Diff line number Diff line change
@@ -1 +1 @@
invalid components: schema "AcceptGrantRequest": error parsing regexp: invalid repeat count: `{0,1023}`
invalid components: schema "AcceptGrantRequest": invalid allOf element: error parsing regexp: invalid repeat count: `{0,1023}`
Original file line number Diff line number Diff line change
@@ -1 +1 @@
invalid components: schema "CreateMetricSetRequest": error parsing regexp: invalid or unsupported Perl syntax: `(?!`
invalid components: schema "CreateMetricSetRequest": invalid allOf element: error parsing regexp: invalid or unsupported Perl syntax: `(?!`
Original file line number Diff line number Diff line change
@@ -1 +1 @@
invalid components: schema "CreateModelRequest": error parsing regexp: invalid repeat count: `{0,2048}`
invalid components: schema "CreateModelRequest": invalid allOf element: error parsing regexp: invalid repeat count: `{0,2048}`
Original file line number Diff line number Diff line change
@@ -1 +1 @@
invalid components: schema "ApplicationSummary": error parsing regexp: invalid repeat count: `{0,1023}`
invalid components: schema "ApplicationSummary": invalid allOf element: error parsing regexp: invalid repeat count: `{0,1023}`
Original file line number Diff line number Diff line change
@@ -1 +1 @@
invalid components: schema "CreateMemberInput": error parsing regexp: invalid or unsupported Perl syntax: `(?=`
invalid components: schema "CreateMemberInput": invalid allOf element: error parsing regexp: invalid or unsupported Perl syntax: `(?=`
Original file line number Diff line number Diff line change
@@ -1 +1 @@
invalid components: schema "ListDICOMImportJobsResponse": error parsing regexp: invalid repeat count: `{0,8192}`
invalid components: schema "ListDICOMImportJobsResponse": invalid allOf element: error parsing regexp: invalid repeat count: `{0,8192}`
Original file line number Diff line number Diff line change
@@ -1 +1 @@
invalid components: schema "ExportTask": error parsing regexp: invalid repeat count: `{1,1020}`
invalid components: schema "ExportTask": invalid allOf element: error parsing regexp: invalid repeat count: `{1,1020}`
Original file line number Diff line number Diff line change
@@ -1 +1 @@
invalid components: schema "ApiGatewayProxyConfig": error parsing regexp: invalid or unsupported Perl syntax: `(?!`
invalid components: schema "ApiGatewayProxyConfig": invalid allOf element: error parsing regexp: invalid or unsupported Perl syntax: `(?!`
Original file line number Diff line number Diff line change
@@ -1 +1 @@
invalid components: schema "DescribeHomeRegionControlsRequest": error parsing regexp: invalid repeat count: `{0,2048}`
invalid components: schema "DescribeHomeRegionControlsRequest": invalid allOf element: error parsing regexp: invalid repeat count: `{0,2048}`
Original file line number Diff line number Diff line change
@@ -1 +1 @@
invalid components: schema "CreateLinkInput": error parsing regexp: invalid repeat count: `{0,2047}`
invalid components: schema "CreateLinkInput": invalid allOf element: error parsing regexp: invalid repeat count: `{0,2047}`
Original file line number Diff line number Diff line change
@@ -1 +1 @@
invalid components: schema "AnnotationImportItemDetail": error parsing regexp: invalid repeat count: `{1,1024}`
invalid components: schema "AnnotationImportItemDetail": invalid allOf element: error parsing regexp: invalid repeat count: `{1,1024}`
Original file line number Diff line number Diff line change
@@ -1 +1 @@
invalid components: schema "ChangeProgressDetails": error parsing regexp: invalid character class range: `\p{XDigit}`
invalid components: schema "ChangeProgressDetails": invalid allOf element: error parsing regexp: invalid character class range: `\p{XDigit}`
Original file line number Diff line number Diff line change
@@ -1 +1 @@
invalid components: schema "AssociateNodeRequest": error parsing regexp: invalid character class range: `\p{Alnum}`
invalid components: schema "AssociateNodeRequest": invalid allOf element: error parsing regexp: invalid character class range: `\p{Alnum}`
Original file line number Diff line number Diff line change
@@ -1 +1 @@
invalid components: schema "DeleteKeywordResult": error parsing regexp: invalid or unsupported Perl syntax: `(?!`
invalid components: schema "DeleteKeywordResult": invalid allOf element: error parsing regexp: invalid or unsupported Perl syntax: `(?!`
Original file line number Diff line number Diff line change
@@ -1 +1 @@
invalid components: schema "CreatePipeRequest": error parsing regexp: invalid or unsupported Perl syntax: `(?!`
invalid components: schema "CreatePipeRequest": invalid allOf element: error parsing regexp: invalid or unsupported Perl syntax: `(?!`
Original file line number Diff line number Diff line change
@@ -1 +1 @@
invalid components: schema "GetPriceListFileUrlRequest": error parsing regexp: invalid repeat count: `{1,1023}`
invalid components: schema "GetPriceListFileUrlRequest": invalid allOf element: error parsing regexp: invalid repeat count: `{1,1023}`
Original file line number Diff line number Diff line change
@@ -1 +1 @@
invalid components: schema "CreateLedgerRequest": error parsing regexp: invalid or unsupported Perl syntax: `(?!`
invalid components: schema "CreateLedgerRequest": invalid allOf element: error parsing regexp: invalid or unsupported Perl syntax: `(?!`
Original file line number Diff line number Diff line change
@@ -1 +1 @@
invalid components: schema "ActiveIAMPolicyAssignment": error parsing regexp: invalid or unsupported Perl syntax: `(?=`
invalid components: schema "ActiveIAMPolicyAssignment": invalid allOf element: error parsing regexp: invalid or unsupported Perl syntax: `(?=`
Loading
Loading