diff --git a/buf.gen.yaml b/buf.gen.yaml index 0194c51..f343965 100755 --- a/buf.gen.yaml +++ b/buf.gen.yaml @@ -1,4 +1,4 @@ -#!/usr/bin/env -S buf generate buf.build/authzed/api:67357f5a752f8e985833adc0944b46a2c1e2083b --template +#!/usr/bin/env -S buf generate buf.build/authzed/api:e93c981415ea208595a50a95fa8572f6e22d1e81 --template version: "v1" plugins: - remote: "buf.build/library/plugins/go:v1.27.1-1" diff --git a/proto/apidocs.swagger.json b/proto/apidocs.swagger.json index d017f6b..c5ee77e 100644 --- a/proto/apidocs.swagger.json +++ b/proto/apidocs.swagger.json @@ -511,7 +511,7 @@ "apiv1WatchRequest": { "type": "object", "properties": { - "objectTypes": { + "optionalObjectTypes": { "type": "array", "items": { "type": "string" diff --git a/proto/authzed/api/v0/acl_service.pb.go b/proto/authzed/api/v0/acl_service.pb.go index faee475..50456bc 100644 --- a/proto/authzed/api/v0/acl_service.pb.go +++ b/proto/authzed/api/v0/acl_service.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.27.1 -// protoc v3.19.0 +// protoc v3.19.1 // source: authzed/api/v0/acl_service.proto package v0 diff --git a/proto/authzed/api/v0/acl_service.pb.validate.go b/proto/authzed/api/v0/acl_service.pb.validate.go index c7583d5..038ad4b 100644 --- a/proto/authzed/api/v0/acl_service.pb.validate.go +++ b/proto/authzed/api/v0/acl_service.pb.validate.go @@ -15,7 +15,7 @@ import ( "time" "unicode/utf8" - "google.golang.org/protobuf/types/known/anypb" + "github.com/golang/protobuf/ptypes" ) // ensure the imports are used @@ -30,7 +30,7 @@ var ( _ = time.Duration(0) _ = (*url.URL)(nil) _ = (*mail.Address)(nil) - _ = anypb.Any{} + _ = ptypes.DynamicAny{} ) // Validate checks the field values on RelationTupleFilter with the rules @@ -41,47 +41,11 @@ func (m *RelationTupleFilter) Validate() error { return nil } - if len(m.GetNamespace()) > 128 { - return RelationTupleFilterValidationError{ - field: "Namespace", - reason: "value length must be at most 128 bytes", - } - } - - if !_RelationTupleFilter_Namespace_Pattern.MatchString(m.GetNamespace()) { - return RelationTupleFilterValidationError{ - field: "Namespace", - reason: "value does not match regex pattern \"^([a-z][a-z0-9_]{2,61}[a-z0-9]/)?[a-z][a-z0-9_]{2,62}[a-z0-9]$\"", - } - } - - if len(m.GetObjectId()) > 128 { - return RelationTupleFilterValidationError{ - field: "ObjectId", - reason: "value length must be at most 128 bytes", - } - } + // no validation rules for Namespace - if !_RelationTupleFilter_ObjectId_Pattern.MatchString(m.GetObjectId()) { - return RelationTupleFilterValidationError{ - field: "ObjectId", - reason: "value does not match regex pattern \"^([a-zA-Z0-9_][a-zA-Z0-9/_-]{0,127})?$\"", - } - } + // no validation rules for ObjectId - if len(m.GetRelation()) > 64 { - return RelationTupleFilterValidationError{ - field: "Relation", - reason: "value length must be at most 64 bytes", - } - } - - if !_RelationTupleFilter_Relation_Pattern.MatchString(m.GetRelation()) { - return RelationTupleFilterValidationError{ - field: "Relation", - reason: "value does not match regex pattern \"^([a-z][a-z0-9_]{2,62}[a-z0-9])?$\"", - } - } + // no validation rules for Relation if v, ok := interface{}(m.GetUserset()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { @@ -93,18 +57,6 @@ func (m *RelationTupleFilter) Validate() error { } } - for idx, item := range m.GetFilters() { - _, _ = idx, item - - if _, ok := RelationTupleFilter_Filter_name[int32(item)]; !ok { - return RelationTupleFilterValidationError{ - field: fmt.Sprintf("Filters[%v]", idx), - reason: "value must be one of the defined enum values", - } - } - - } - return nil } @@ -164,12 +116,6 @@ var _ interface { ErrorName() string } = RelationTupleFilterValidationError{} -var _RelationTupleFilter_Namespace_Pattern = regexp.MustCompile("^([a-z][a-z0-9_]{2,61}[a-z0-9]/)?[a-z][a-z0-9_]{2,62}[a-z0-9]$") - -var _RelationTupleFilter_ObjectId_Pattern = regexp.MustCompile("^([a-zA-Z0-9_][a-zA-Z0-9/_-]{0,127})?$") - -var _RelationTupleFilter_Relation_Pattern = regexp.MustCompile("^([a-z][a-z0-9_]{2,62}[a-z0-9])?$") - // Validate checks the field values on ReadRequest with the rules defined in // the proto definition for this message. If any rules are violated, an error // is returned. @@ -178,23 +124,9 @@ func (m *ReadRequest) Validate() error { return nil } - if len(m.GetTuplesets()) < 1 { - return ReadRequestValidationError{ - field: "Tuplesets", - reason: "value must contain at least 1 item(s)", - } - } - for idx, item := range m.GetTuplesets() { _, _ = idx, item - if item == nil { - return ReadRequestValidationError{ - field: fmt.Sprintf("Tuplesets[%v]", idx), - reason: "value is required", - } - } - if v, ok := interface{}(item).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return ReadRequestValidationError{ @@ -375,13 +307,6 @@ func (m *WriteRequest) Validate() error { for idx, item := range m.GetWriteConditions() { _, _ = idx, item - if item == nil { - return WriteRequestValidationError{ - field: fmt.Sprintf("WriteConditions[%v]", idx), - reason: "value is required", - } - } - if v, ok := interface{}(item).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return WriteRequestValidationError{ @@ -397,13 +322,6 @@ func (m *WriteRequest) Validate() error { for idx, item := range m.GetUpdates() { _, _ = idx, item - if item == nil { - return WriteRequestValidationError{ - field: fmt.Sprintf("Updates[%v]", idx), - reason: "value is required", - } - } - if v, ok := interface{}(item).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return WriteRequestValidationError{ @@ -556,13 +474,6 @@ func (m *CheckRequest) Validate() error { return nil } - if m.GetTestUserset() == nil { - return CheckRequestValidationError{ - field: "TestUserset", - reason: "value is required", - } - } - if v, ok := interface{}(m.GetTestUserset()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return CheckRequestValidationError{ @@ -573,13 +484,6 @@ func (m *CheckRequest) Validate() error { } } - if m.GetUser() == nil { - return CheckRequestValidationError{ - field: "User", - reason: "value is required", - } - } - if v, ok := interface{}(m.GetUser()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return CheckRequestValidationError{ @@ -665,13 +569,6 @@ func (m *ContentChangeCheckRequest) Validate() error { return nil } - if m.GetTestUserset() == nil { - return ContentChangeCheckRequestValidationError{ - field: "TestUserset", - reason: "value is required", - } - } - if v, ok := interface{}(m.GetTestUserset()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return ContentChangeCheckRequestValidationError{ @@ -682,13 +579,6 @@ func (m *ContentChangeCheckRequest) Validate() error { } } - if m.GetUser() == nil { - return ContentChangeCheckRequestValidationError{ - field: "User", - reason: "value is required", - } - } - if v, ok := interface{}(m.GetUser()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return ContentChangeCheckRequestValidationError{ @@ -845,13 +735,6 @@ func (m *ExpandRequest) Validate() error { return nil } - if m.GetUserset() == nil { - return ExpandRequestValidationError{ - field: "Userset", - reason: "value is required", - } - } - if v, ok := interface{}(m.GetUserset()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return ExpandRequestValidationError{ diff --git a/proto/authzed/api/v0/core.pb.go b/proto/authzed/api/v0/core.pb.go index 3c927be..cf394cc 100644 --- a/proto/authzed/api/v0/core.pb.go +++ b/proto/authzed/api/v0/core.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.27.1 -// protoc v3.19.0 +// protoc v3.19.1 // source: authzed/api/v0/core.proto package v0 diff --git a/proto/authzed/api/v0/core.pb.validate.go b/proto/authzed/api/v0/core.pb.validate.go index 4969432..a8047b8 100644 --- a/proto/authzed/api/v0/core.pb.validate.go +++ b/proto/authzed/api/v0/core.pb.validate.go @@ -15,7 +15,7 @@ import ( "time" "unicode/utf8" - "google.golang.org/protobuf/types/known/anypb" + "github.com/golang/protobuf/ptypes" ) // ensure the imports are used @@ -30,7 +30,7 @@ var ( _ = time.Duration(0) _ = (*url.URL)(nil) _ = (*mail.Address)(nil) - _ = anypb.Any{} + _ = ptypes.DynamicAny{} ) // Validate checks the field values on RelationTuple with the rules defined in @@ -41,13 +41,6 @@ func (m *RelationTuple) Validate() error { return nil } - if m.GetObjectAndRelation() == nil { - return RelationTupleValidationError{ - field: "ObjectAndRelation", - reason: "value is required", - } - } - if v, ok := interface{}(m.GetObjectAndRelation()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return RelationTupleValidationError{ @@ -58,13 +51,6 @@ func (m *RelationTuple) Validate() error { } } - if m.GetUser() == nil { - return RelationTupleValidationError{ - field: "User", - reason: "value is required", - } - } - if v, ok := interface{}(m.GetUser()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return RelationTupleValidationError{ @@ -140,47 +126,11 @@ func (m *ObjectAndRelation) Validate() error { return nil } - if len(m.GetNamespace()) > 128 { - return ObjectAndRelationValidationError{ - field: "Namespace", - reason: "value length must be at most 128 bytes", - } - } + // no validation rules for Namespace - if !_ObjectAndRelation_Namespace_Pattern.MatchString(m.GetNamespace()) { - return ObjectAndRelationValidationError{ - field: "Namespace", - reason: "value does not match regex pattern \"^([a-z][a-z0-9_]{2,61}[a-z0-9]/)?[a-z][a-z0-9_]{2,62}[a-z0-9]$\"", - } - } + // no validation rules for ObjectId - if len(m.GetObjectId()) > 128 { - return ObjectAndRelationValidationError{ - field: "ObjectId", - reason: "value length must be at most 128 bytes", - } - } - - if !_ObjectAndRelation_ObjectId_Pattern.MatchString(m.GetObjectId()) { - return ObjectAndRelationValidationError{ - field: "ObjectId", - reason: "value does not match regex pattern \"^[a-zA-Z0-9_][a-zA-Z0-9/_-]{0,127}$\"", - } - } - - if len(m.GetRelation()) > 64 { - return ObjectAndRelationValidationError{ - field: "Relation", - reason: "value length must be at most 64 bytes", - } - } - - if !_ObjectAndRelation_Relation_Pattern.MatchString(m.GetRelation()) { - return ObjectAndRelationValidationError{ - field: "Relation", - reason: "value does not match regex pattern \"^(\\\\.\\\\.\\\\.|[a-z][a-z0-9_]{2,62}[a-z0-9])$\"", - } - } + // no validation rules for Relation return nil } @@ -241,12 +191,6 @@ var _ interface { ErrorName() string } = ObjectAndRelationValidationError{} -var _ObjectAndRelation_Namespace_Pattern = regexp.MustCompile("^([a-z][a-z0-9_]{2,61}[a-z0-9]/)?[a-z][a-z0-9_]{2,62}[a-z0-9]$") - -var _ObjectAndRelation_ObjectId_Pattern = regexp.MustCompile("^[a-zA-Z0-9_][a-zA-Z0-9/_-]{0,127}$") - -var _ObjectAndRelation_Relation_Pattern = regexp.MustCompile("^(\\.\\.\\.|[a-z][a-z0-9_]{2,62}[a-z0-9])$") - // Validate checks the field values on RelationReference with the rules defined // in the proto definition for this message. If any rules are violated, an // error is returned. @@ -255,33 +199,9 @@ func (m *RelationReference) Validate() error { return nil } - if len(m.GetNamespace()) > 128 { - return RelationReferenceValidationError{ - field: "Namespace", - reason: "value length must be at most 128 bytes", - } - } - - if !_RelationReference_Namespace_Pattern.MatchString(m.GetNamespace()) { - return RelationReferenceValidationError{ - field: "Namespace", - reason: "value does not match regex pattern \"^([a-z][a-z0-9_]{2,61}[a-z0-9]/)?[a-z][a-z0-9_]{2,62}[a-z0-9]$\"", - } - } - - if len(m.GetRelation()) > 64 { - return RelationReferenceValidationError{ - field: "Relation", - reason: "value length must be at most 64 bytes", - } - } + // no validation rules for Namespace - if !_RelationReference_Relation_Pattern.MatchString(m.GetRelation()) { - return RelationReferenceValidationError{ - field: "Relation", - reason: "value does not match regex pattern \"^(\\\\.\\\\.\\\\.|[a-z][a-z0-9_]{2,62}[a-z0-9])$\"", - } - } + // no validation rules for Relation return nil } @@ -342,10 +262,6 @@ var _ interface { ErrorName() string } = RelationReferenceValidationError{} -var _RelationReference_Namespace_Pattern = regexp.MustCompile("^([a-z][a-z0-9_]{2,61}[a-z0-9]/)?[a-z][a-z0-9_]{2,62}[a-z0-9]$") - -var _RelationReference_Relation_Pattern = regexp.MustCompile("^(\\.\\.\\.|[a-z][a-z0-9_]{2,62}[a-z0-9])$") - // Validate checks the field values on User with the rules defined in the proto // definition for this message. If any rules are violated, an error is returned. func (m *User) Validate() error { @@ -357,13 +273,6 @@ func (m *User) Validate() error { case *User_Userset: - if m.GetUserset() == nil { - return UserValidationError{ - field: "Userset", - reason: "value is required", - } - } - if v, ok := interface{}(m.GetUserset()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return UserValidationError{ @@ -374,12 +283,6 @@ func (m *User) Validate() error { } } - default: - return UserValidationError{ - field: "UserOneof", - reason: "value is required", - } - } return nil @@ -446,12 +349,7 @@ func (m *Zookie) Validate() error { return nil } - if len(m.GetToken()) < 1 { - return ZookieValidationError{ - field: "Token", - reason: "value length must be at least 1 bytes", - } - } + // no validation rules for Token return nil } @@ -518,19 +416,7 @@ func (m *RelationTupleUpdate) Validate() error { return nil } - if _, ok := RelationTupleUpdate_Operation_name[int32(m.GetOperation())]; !ok { - return RelationTupleUpdateValidationError{ - field: "Operation", - reason: "value must be one of the defined enum values", - } - } - - if m.GetTuple() == nil { - return RelationTupleUpdateValidationError{ - field: "Tuple", - reason: "value is required", - } - } + // no validation rules for Operation if v, ok := interface{}(m.GetTuple()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { diff --git a/proto/authzed/api/v0/developer.pb.go b/proto/authzed/api/v0/developer.pb.go index f120934..795fbf9 100644 --- a/proto/authzed/api/v0/developer.pb.go +++ b/proto/authzed/api/v0/developer.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.27.1 -// protoc v3.19.0 +// protoc v3.19.1 // source: authzed/api/v0/developer.proto package v0 diff --git a/proto/authzed/api/v0/developer.pb.validate.go b/proto/authzed/api/v0/developer.pb.validate.go index e60674c..8876718 100644 --- a/proto/authzed/api/v0/developer.pb.validate.go +++ b/proto/authzed/api/v0/developer.pb.validate.go @@ -15,7 +15,7 @@ import ( "time" "unicode/utf8" - "google.golang.org/protobuf/types/known/anypb" + "github.com/golang/protobuf/ptypes" ) // ensure the imports are used @@ -30,7 +30,7 @@ var ( _ = time.Duration(0) _ = (*url.URL)(nil) _ = (*mail.Address)(nil) - _ = anypb.Any{} + _ = ptypes.DynamicAny{} ) // Validate checks the field values on FormatSchemaRequest with the rules diff --git a/proto/authzed/api/v0/namespace.pb.go b/proto/authzed/api/v0/namespace.pb.go index d89c575..32e1488 100644 --- a/proto/authzed/api/v0/namespace.pb.go +++ b/proto/authzed/api/v0/namespace.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.27.1 -// protoc v3.19.0 +// protoc v3.19.1 // source: authzed/api/v0/namespace.proto package v0 diff --git a/proto/authzed/api/v0/namespace.pb.validate.go b/proto/authzed/api/v0/namespace.pb.validate.go index d4d9e42..1e06fad 100644 --- a/proto/authzed/api/v0/namespace.pb.validate.go +++ b/proto/authzed/api/v0/namespace.pb.validate.go @@ -15,7 +15,7 @@ import ( "time" "unicode/utf8" - "google.golang.org/protobuf/types/known/anypb" + "github.com/golang/protobuf/ptypes" ) // ensure the imports are used @@ -30,7 +30,7 @@ var ( _ = time.Duration(0) _ = (*url.URL)(nil) _ = (*mail.Address)(nil) - _ = anypb.Any{} + _ = ptypes.DynamicAny{} ) // Validate checks the field values on Metadata with the rules defined in the @@ -40,32 +40,17 @@ func (m *Metadata) Validate() error { return nil } - if len(m.GetMetadataMessage()) < 1 { - return MetadataValidationError{ - field: "MetadataMessage", - reason: "value must contain at least 1 item(s)", - } - } - for idx, item := range m.GetMetadataMessage() { _, _ = idx, item - if item == nil { - return MetadataValidationError{ - field: fmt.Sprintf("MetadataMessage[%v]", idx), - reason: "value is required", - } - } - - if a := item; a != nil { - - if _, ok := _Metadata_MetadataMessage_InLookup[a.GetTypeUrl()]; !ok { + if v, ok := interface{}(item).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { return MetadataValidationError{ field: fmt.Sprintf("MetadataMessage[%v]", idx), - reason: "type URL must be in list [type.googleapis.com/impl.v1.DocComment type.googleapis.com/impl.v1.RelationMetadata]", + reason: "embedded message failed validation", + cause: err, } } - } } @@ -135,19 +120,7 @@ func (m *NamespaceDefinition) Validate() error { return nil } - if len(m.GetName()) > 128 { - return NamespaceDefinitionValidationError{ - field: "Name", - reason: "value length must be at most 128 bytes", - } - } - - if !_NamespaceDefinition_Name_Pattern.MatchString(m.GetName()) { - return NamespaceDefinitionValidationError{ - field: "Name", - reason: "value does not match regex pattern \"^([a-z][a-z0-9_]{2,62}[a-z0-9]/)?[a-z][a-z0-9_]{2,62}[a-z0-9]$\"", - } - } + // no validation rules for Name for idx, item := range m.GetRelation() { _, _ = idx, item @@ -233,8 +206,6 @@ var _ interface { ErrorName() string } = NamespaceDefinitionValidationError{} -var _NamespaceDefinition_Name_Pattern = regexp.MustCompile("^([a-z][a-z0-9_]{2,62}[a-z0-9]/)?[a-z][a-z0-9_]{2,62}[a-z0-9]$") - // Validate checks the field values on Relation with the rules defined in the // proto definition for this message. If any rules are violated, an error is returned. func (m *Relation) Validate() error { @@ -242,19 +213,7 @@ func (m *Relation) Validate() error { return nil } - if len(m.GetName()) > 64 { - return RelationValidationError{ - field: "Name", - reason: "value length must be at most 64 bytes", - } - } - - if !_Relation_Name_Pattern.MatchString(m.GetName()) { - return RelationValidationError{ - field: "Name", - reason: "value does not match regex pattern \"^[a-z][a-z0-9_]{2,62}[a-z0-9]$\"", - } - } + // no validation rules for Name if v, ok := interface{}(m.GetUsersetRewrite()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { @@ -343,8 +302,6 @@ var _ interface { ErrorName() string } = RelationValidationError{} -var _Relation_Name_Pattern = regexp.MustCompile("^[a-z][a-z0-9_]{2,62}[a-z0-9]$") - // Validate checks the field values on TypeInformation with the rules defined // in the proto definition for this message. If any rules are violated, an // error is returned. @@ -437,13 +394,6 @@ func (m *UsersetRewrite) Validate() error { case *UsersetRewrite_Union: - if m.GetUnion() == nil { - return UsersetRewriteValidationError{ - field: "Union", - reason: "value is required", - } - } - if v, ok := interface{}(m.GetUnion()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return UsersetRewriteValidationError{ @@ -456,13 +406,6 @@ func (m *UsersetRewrite) Validate() error { case *UsersetRewrite_Intersection: - if m.GetIntersection() == nil { - return UsersetRewriteValidationError{ - field: "Intersection", - reason: "value is required", - } - } - if v, ok := interface{}(m.GetIntersection()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return UsersetRewriteValidationError{ @@ -475,13 +418,6 @@ func (m *UsersetRewrite) Validate() error { case *UsersetRewrite_Exclusion: - if m.GetExclusion() == nil { - return UsersetRewriteValidationError{ - field: "Exclusion", - reason: "value is required", - } - } - if v, ok := interface{}(m.GetExclusion()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return UsersetRewriteValidationError{ @@ -492,12 +428,6 @@ func (m *UsersetRewrite) Validate() error { } } - default: - return UsersetRewriteValidationError{ - field: "RewriteOperation", - reason: "value is required", - } - } return nil @@ -565,23 +495,9 @@ func (m *SetOperation) Validate() error { return nil } - if len(m.GetChild()) < 1 { - return SetOperationValidationError{ - field: "Child", - reason: "value must contain at least 1 item(s)", - } - } - for idx, item := range m.GetChild() { _, _ = idx, item - if item == nil { - return SetOperationValidationError{ - field: fmt.Sprintf("Child[%v]", idx), - reason: "value is required", - } - } - if v, ok := interface{}(item).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return SetOperationValidationError{ @@ -659,13 +575,6 @@ func (m *TupleToUserset) Validate() error { return nil } - if m.GetTupleset() == nil { - return TupleToUsersetValidationError{ - field: "Tupleset", - reason: "value is required", - } - } - if v, ok := interface{}(m.GetTupleset()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return TupleToUsersetValidationError{ @@ -676,13 +585,6 @@ func (m *TupleToUserset) Validate() error { } } - if m.GetComputedUserset() == nil { - return TupleToUsersetValidationError{ - field: "ComputedUserset", - reason: "value is required", - } - } - if v, ok := interface{}(m.GetComputedUserset()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return TupleToUsersetValidationError{ @@ -758,26 +660,9 @@ func (m *ComputedUserset) Validate() error { return nil } - if _, ok := ComputedUserset_Object_name[int32(m.GetObject())]; !ok { - return ComputedUsersetValidationError{ - field: "Object", - reason: "value must be one of the defined enum values", - } - } + // no validation rules for Object - if len(m.GetRelation()) > 64 { - return ComputedUsersetValidationError{ - field: "Relation", - reason: "value length must be at most 64 bytes", - } - } - - if !_ComputedUserset_Relation_Pattern.MatchString(m.GetRelation()) { - return ComputedUsersetValidationError{ - field: "Relation", - reason: "value does not match regex pattern \"^[a-z][a-z0-9_]{2,62}[a-z0-9]$\"", - } - } + // no validation rules for Relation return nil } @@ -836,8 +721,6 @@ var _ interface { ErrorName() string } = ComputedUsersetValidationError{} -var _ComputedUserset_Relation_Pattern = regexp.MustCompile("^[a-z][a-z0-9_]{2,62}[a-z0-9]$") - // Validate checks the field values on SetOperation_Child with the rules // defined in the proto definition for this message. If any rules are // violated, an error is returned. @@ -862,13 +745,6 @@ func (m *SetOperation_Child) Validate() error { case *SetOperation_Child_ComputedUserset: - if m.GetComputedUserset() == nil { - return SetOperation_ChildValidationError{ - field: "ComputedUserset", - reason: "value is required", - } - } - if v, ok := interface{}(m.GetComputedUserset()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return SetOperation_ChildValidationError{ @@ -881,13 +757,6 @@ func (m *SetOperation_Child) Validate() error { case *SetOperation_Child_TupleToUserset: - if m.GetTupleToUserset() == nil { - return SetOperation_ChildValidationError{ - field: "TupleToUserset", - reason: "value is required", - } - } - if v, ok := interface{}(m.GetTupleToUserset()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return SetOperation_ChildValidationError{ @@ -900,13 +769,6 @@ func (m *SetOperation_Child) Validate() error { case *SetOperation_Child_UsersetRewrite: - if m.GetUsersetRewrite() == nil { - return SetOperation_ChildValidationError{ - field: "UsersetRewrite", - reason: "value is required", - } - } - if v, ok := interface{}(m.GetUsersetRewrite()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return SetOperation_ChildValidationError{ @@ -917,12 +779,6 @@ func (m *SetOperation_Child) Validate() error { } } - default: - return SetOperation_ChildValidationError{ - field: "ChildType", - reason: "value is required", - } - } return nil @@ -1059,19 +915,7 @@ func (m *TupleToUserset_Tupleset) Validate() error { return nil } - if len(m.GetRelation()) > 64 { - return TupleToUserset_TuplesetValidationError{ - field: "Relation", - reason: "value length must be at most 64 bytes", - } - } - - if !_TupleToUserset_Tupleset_Relation_Pattern.MatchString(m.GetRelation()) { - return TupleToUserset_TuplesetValidationError{ - field: "Relation", - reason: "value does not match regex pattern \"^[a-z][a-z0-9_]{2,62}[a-z0-9]$\"", - } - } + // no validation rules for Relation return nil } @@ -1131,5 +975,3 @@ var _ interface { Cause() error ErrorName() string } = TupleToUserset_TuplesetValidationError{} - -var _TupleToUserset_Tupleset_Relation_Pattern = regexp.MustCompile("^[a-z][a-z0-9_]{2,62}[a-z0-9]$") diff --git a/proto/authzed/api/v0/namespace_service.pb.go b/proto/authzed/api/v0/namespace_service.pb.go index 5c4e770..5a1da69 100644 --- a/proto/authzed/api/v0/namespace_service.pb.go +++ b/proto/authzed/api/v0/namespace_service.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.27.1 -// protoc v3.19.0 +// protoc v3.19.1 // source: authzed/api/v0/namespace_service.proto package v0 diff --git a/proto/authzed/api/v0/namespace_service.pb.validate.go b/proto/authzed/api/v0/namespace_service.pb.validate.go index 431fa3a..7e1b3ab 100644 --- a/proto/authzed/api/v0/namespace_service.pb.validate.go +++ b/proto/authzed/api/v0/namespace_service.pb.validate.go @@ -15,7 +15,7 @@ import ( "time" "unicode/utf8" - "google.golang.org/protobuf/types/known/anypb" + "github.com/golang/protobuf/ptypes" ) // ensure the imports are used @@ -30,7 +30,7 @@ var ( _ = time.Duration(0) _ = (*url.URL)(nil) _ = (*mail.Address)(nil) - _ = anypb.Any{} + _ = ptypes.DynamicAny{} ) // Validate checks the field values on ReadConfigRequest with the rules defined @@ -41,19 +41,7 @@ func (m *ReadConfigRequest) Validate() error { return nil } - if len(m.GetNamespace()) > 128 { - return ReadConfigRequestValidationError{ - field: "Namespace", - reason: "value length must be at most 128 bytes", - } - } - - if !_ReadConfigRequest_Namespace_Pattern.MatchString(m.GetNamespace()) { - return ReadConfigRequestValidationError{ - field: "Namespace", - reason: "value does not match regex pattern \"^([a-z][a-z0-9_]{2,62}[a-z0-9]/)?[a-z][a-z0-9_]{2,62}[a-z0-9]$\"", - } - } + // no validation rules for Namespace if v, ok := interface{}(m.GetAtRevision()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { @@ -124,8 +112,6 @@ var _ interface { ErrorName() string } = ReadConfigRequestValidationError{} -var _ReadConfigRequest_Namespace_Pattern = regexp.MustCompile("^([a-z][a-z0-9_]{2,62}[a-z0-9]/)?[a-z][a-z0-9_]{2,62}[a-z0-9]$") - // Validate checks the field values on ReadConfigResponse with the rules // defined in the proto definition for this message. If any rules are // violated, an error is returned. @@ -223,23 +209,9 @@ func (m *WriteConfigRequest) Validate() error { return nil } - if len(m.GetConfigs()) < 1 { - return WriteConfigRequestValidationError{ - field: "Configs", - reason: "value must contain at least 1 item(s)", - } - } - for idx, item := range m.GetConfigs() { _, _ = idx, item - if item == nil { - return WriteConfigRequestValidationError{ - field: fmt.Sprintf("Configs[%v]", idx), - reason: "value is required", - } - } - if v, ok := interface{}(item).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return WriteConfigRequestValidationError{ @@ -396,32 +368,6 @@ func (m *DeleteConfigsRequest) Validate() error { return nil } - if len(m.GetNamespaces()) < 1 { - return DeleteConfigsRequestValidationError{ - field: "Namespaces", - reason: "value must contain at least 1 item(s)", - } - } - - for idx, item := range m.GetNamespaces() { - _, _ = idx, item - - if len(item) > 128 { - return DeleteConfigsRequestValidationError{ - field: fmt.Sprintf("Namespaces[%v]", idx), - reason: "value length must be at most 128 bytes", - } - } - - if !_DeleteConfigsRequest_Namespaces_Pattern.MatchString(item) { - return DeleteConfigsRequestValidationError{ - field: fmt.Sprintf("Namespaces[%v]", idx), - reason: "value does not match regex pattern \"^([a-z][a-z0-9_]{2,62}[a-z0-9]/)?[a-z][a-z0-9_]{2,62}[a-z0-9]$\"", - } - } - - } - return nil } @@ -481,8 +427,6 @@ var _ interface { ErrorName() string } = DeleteConfigsRequestValidationError{} -var _DeleteConfigsRequest_Namespaces_Pattern = regexp.MustCompile("^([a-z][a-z0-9_]{2,62}[a-z0-9]/)?[a-z][a-z0-9_]{2,62}[a-z0-9]$") - // Validate checks the field values on DeleteConfigsResponse with the rules // defined in the proto definition for this message. If any rules are // violated, an error is returned. diff --git a/proto/authzed/api/v0/watch_service.pb.go b/proto/authzed/api/v0/watch_service.pb.go index 54fc7cf..be0425b 100644 --- a/proto/authzed/api/v0/watch_service.pb.go +++ b/proto/authzed/api/v0/watch_service.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.27.1 -// protoc v3.19.0 +// protoc v3.19.1 // source: authzed/api/v0/watch_service.proto package v0 diff --git a/proto/authzed/api/v0/watch_service.pb.validate.go b/proto/authzed/api/v0/watch_service.pb.validate.go index 23d1ee1..089e615 100644 --- a/proto/authzed/api/v0/watch_service.pb.validate.go +++ b/proto/authzed/api/v0/watch_service.pb.validate.go @@ -15,7 +15,7 @@ import ( "time" "unicode/utf8" - "google.golang.org/protobuf/types/known/anypb" + "github.com/golang/protobuf/ptypes" ) // ensure the imports are used @@ -30,7 +30,7 @@ var ( _ = time.Duration(0) _ = (*url.URL)(nil) _ = (*mail.Address)(nil) - _ = anypb.Any{} + _ = ptypes.DynamicAny{} ) // Validate checks the field values on WatchRequest with the rules defined in @@ -41,32 +41,6 @@ func (m *WatchRequest) Validate() error { return nil } - if len(m.GetNamespaces()) < 1 { - return WatchRequestValidationError{ - field: "Namespaces", - reason: "value must contain at least 1 item(s)", - } - } - - for idx, item := range m.GetNamespaces() { - _, _ = idx, item - - if len(item) > 128 { - return WatchRequestValidationError{ - field: fmt.Sprintf("Namespaces[%v]", idx), - reason: "value length must be at most 128 bytes", - } - } - - if !_WatchRequest_Namespaces_Pattern.MatchString(item) { - return WatchRequestValidationError{ - field: fmt.Sprintf("Namespaces[%v]", idx), - reason: "value does not match regex pattern \"^([a-z][a-z0-9_]{2,62}[a-z0-9]/)?[a-z][a-z0-9_]{2,62}[a-z0-9]$\"", - } - } - - } - if v, ok := interface{}(m.GetStartRevision()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return WatchRequestValidationError{ @@ -134,8 +108,6 @@ var _ interface { ErrorName() string } = WatchRequestValidationError{} -var _WatchRequest_Namespaces_Pattern = regexp.MustCompile("^([a-z][a-z0-9_]{2,62}[a-z0-9]/)?[a-z][a-z0-9_]{2,62}[a-z0-9]$") - // Validate checks the field values on WatchResponse with the rules defined in // the proto definition for this message. If any rules are violated, an error // is returned. diff --git a/proto/authzed/api/v1/core.pb.go b/proto/authzed/api/v1/core.pb.go index a91b4ef..988117a 100644 --- a/proto/authzed/api/v1/core.pb.go +++ b/proto/authzed/api/v1/core.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.27.1 -// protoc v3.19.0 +// protoc v3.19.1 // source: authzed/api/v1/core.proto package v1 diff --git a/proto/authzed/api/v1/core.pb.validate.go b/proto/authzed/api/v1/core.pb.validate.go index d4b2600..2e23b1a 100644 --- a/proto/authzed/api/v1/core.pb.validate.go +++ b/proto/authzed/api/v1/core.pb.validate.go @@ -15,7 +15,7 @@ import ( "time" "unicode/utf8" - "google.golang.org/protobuf/types/known/anypb" + "github.com/golang/protobuf/ptypes" ) // ensure the imports are used @@ -30,7 +30,7 @@ var ( _ = time.Duration(0) _ = (*url.URL)(nil) _ = (*mail.Address)(nil) - _ = anypb.Any{} + _ = ptypes.DynamicAny{} ) // Validate checks the field values on Relationship with the rules defined in @@ -41,13 +41,6 @@ func (m *Relationship) Validate() error { return nil } - if m.GetResource() == nil { - return RelationshipValidationError{ - field: "Resource", - reason: "value is required", - } - } - if v, ok := interface{}(m.GetResource()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return RelationshipValidationError{ @@ -58,26 +51,7 @@ func (m *Relationship) Validate() error { } } - if len(m.GetRelation()) > 64 { - return RelationshipValidationError{ - field: "Relation", - reason: "value length must be at most 64 bytes", - } - } - - if !_Relationship_Relation_Pattern.MatchString(m.GetRelation()) { - return RelationshipValidationError{ - field: "Relation", - reason: "value does not match regex pattern \"^[a-z][a-z0-9_]{2,62}[a-z0-9]$\"", - } - } - - if m.GetSubject() == nil { - return RelationshipValidationError{ - field: "Subject", - reason: "value is required", - } - } + // no validation rules for Relation if v, ok := interface{}(m.GetSubject()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { @@ -146,8 +120,6 @@ var _ interface { ErrorName() string } = RelationshipValidationError{} -var _Relationship_Relation_Pattern = regexp.MustCompile("^[a-z][a-z0-9_]{2,62}[a-z0-9]$") - // Validate checks the field values on SubjectReference with the rules defined // in the proto definition for this message. If any rules are violated, an // error is returned. @@ -166,19 +138,7 @@ func (m *SubjectReference) Validate() error { } } - if len(m.GetOptionalRelation()) > 64 { - return SubjectReferenceValidationError{ - field: "OptionalRelation", - reason: "value length must be at most 64 bytes", - } - } - - if !_SubjectReference_OptionalRelation_Pattern.MatchString(m.GetOptionalRelation()) { - return SubjectReferenceValidationError{ - field: "OptionalRelation", - reason: "value does not match regex pattern \"^([a-z][a-z0-9_]{2,62}[a-z0-9])?$\"", - } - } + // no validation rules for OptionalRelation return nil } @@ -237,8 +197,6 @@ var _ interface { ErrorName() string } = SubjectReferenceValidationError{} -var _SubjectReference_OptionalRelation_Pattern = regexp.MustCompile("^([a-z][a-z0-9_]{2,62}[a-z0-9])?$") - // Validate checks the field values on ObjectReference with the rules defined // in the proto definition for this message. If any rules are violated, an // error is returned. @@ -247,33 +205,9 @@ func (m *ObjectReference) Validate() error { return nil } - if len(m.GetObjectType()) > 128 { - return ObjectReferenceValidationError{ - field: "ObjectType", - reason: "value length must be at most 128 bytes", - } - } - - if !_ObjectReference_ObjectType_Pattern.MatchString(m.GetObjectType()) { - return ObjectReferenceValidationError{ - field: "ObjectType", - reason: "value does not match regex pattern \"^([a-z][a-z0-9_]{2,61}[a-z0-9]/)?[a-z][a-z0-9_]{2,62}[a-z0-9]$\"", - } - } - - if len(m.GetObjectId()) > 128 { - return ObjectReferenceValidationError{ - field: "ObjectId", - reason: "value length must be at most 128 bytes", - } - } + // no validation rules for ObjectType - if !_ObjectReference_ObjectId_Pattern.MatchString(m.GetObjectId()) { - return ObjectReferenceValidationError{ - field: "ObjectId", - reason: "value does not match regex pattern \"^[a-zA-Z0-9_][a-zA-Z0-9/_-]{0,127}$\"", - } - } + // no validation rules for ObjectId return nil } @@ -332,10 +266,6 @@ var _ interface { ErrorName() string } = ObjectReferenceValidationError{} -var _ObjectReference_ObjectType_Pattern = regexp.MustCompile("^([a-z][a-z0-9_]{2,61}[a-z0-9]/)?[a-z][a-z0-9_]{2,62}[a-z0-9]$") - -var _ObjectReference_ObjectId_Pattern = regexp.MustCompile("^[a-zA-Z0-9_][a-zA-Z0-9/_-]{0,127}$") - // Validate checks the field values on ZedToken with the rules defined in the // proto definition for this message. If any rules are violated, an error is returned. func (m *ZedToken) Validate() error { @@ -343,12 +273,7 @@ func (m *ZedToken) Validate() error { return nil } - if len(m.GetToken()) < 1 { - return ZedTokenValidationError{ - field: "Token", - reason: "value length must be at least 1 bytes", - } - } + // no validation rules for Token return nil } @@ -415,19 +340,7 @@ func (m *RelationshipUpdate) Validate() error { return nil } - if _, ok := RelationshipUpdate_Operation_name[int32(m.GetOperation())]; !ok { - return RelationshipUpdateValidationError{ - field: "Operation", - reason: "value must be one of the defined enum values", - } - } - - if m.GetRelationship() == nil { - return RelationshipUpdateValidationError{ - field: "Relationship", - reason: "value is required", - } - } + // no validation rules for Operation if v, ok := interface{}(m.GetRelationship()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { @@ -544,12 +457,6 @@ func (m *PermissionRelationshipTree) Validate() error { } } - default: - return PermissionRelationshipTreeValidationError{ - field: "TreeType", - reason: "value is required", - } - } return nil diff --git a/proto/authzed/api/v1/openapi.pb.go b/proto/authzed/api/v1/openapi.pb.go index ba2dff2..7affa26 100644 --- a/proto/authzed/api/v1/openapi.pb.go +++ b/proto/authzed/api/v1/openapi.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.27.1 -// protoc v3.19.0 +// protoc v3.19.1 // source: authzed/api/v1/openapi.proto package v1 diff --git a/proto/authzed/api/v1/openapi.pb.validate.go b/proto/authzed/api/v1/openapi.pb.validate.go index 6c52268..18c3062 100644 --- a/proto/authzed/api/v1/openapi.pb.validate.go +++ b/proto/authzed/api/v1/openapi.pb.validate.go @@ -15,7 +15,7 @@ import ( "time" "unicode/utf8" - "google.golang.org/protobuf/types/known/anypb" + "github.com/golang/protobuf/ptypes" ) // ensure the imports are used @@ -30,5 +30,5 @@ var ( _ = time.Duration(0) _ = (*url.URL)(nil) _ = (*mail.Address)(nil) - _ = anypb.Any{} + _ = ptypes.DynamicAny{} ) diff --git a/proto/authzed/api/v1/permission_service.pb.go b/proto/authzed/api/v1/permission_service.pb.go index 87c9e7a..501bd6c 100644 --- a/proto/authzed/api/v1/permission_service.pb.go +++ b/proto/authzed/api/v1/permission_service.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.27.1 -// protoc v3.19.0 +// protoc v3.19.1 // source: authzed/api/v1/permission_service.proto package v1 diff --git a/proto/authzed/api/v1/permission_service.pb.validate.go b/proto/authzed/api/v1/permission_service.pb.validate.go index fd06cc0..cb64b2d 100644 --- a/proto/authzed/api/v1/permission_service.pb.validate.go +++ b/proto/authzed/api/v1/permission_service.pb.validate.go @@ -15,7 +15,7 @@ import ( "time" "unicode/utf8" - "google.golang.org/protobuf/types/known/anypb" + "github.com/golang/protobuf/ptypes" ) // ensure the imports are used @@ -30,7 +30,7 @@ var ( _ = time.Duration(0) _ = (*url.URL)(nil) _ = (*mail.Address)(nil) - _ = anypb.Any{} + _ = ptypes.DynamicAny{} ) // Validate checks the field values on Consistency with the rules defined in @@ -44,13 +44,7 @@ func (m *Consistency) Validate() error { switch m.Requirement.(type) { case *Consistency_MinimizeLatency: - - if m.GetMinimizeLatency() != true { - return ConsistencyValidationError{ - field: "MinimizeLatency", - reason: "value must equal true", - } - } + // no validation rules for MinimizeLatency case *Consistency_AtLeastAsFresh: @@ -77,19 +71,7 @@ func (m *Consistency) Validate() error { } case *Consistency_FullyConsistent: - - if m.GetFullyConsistent() != true { - return ConsistencyValidationError{ - field: "FullyConsistent", - reason: "value must equal true", - } - } - - default: - return ConsistencyValidationError{ - field: "Requirement", - reason: "value is required", - } + // no validation rules for FullyConsistent } @@ -158,47 +140,11 @@ func (m *RelationshipFilter) Validate() error { return nil } - if len(m.GetResourceType()) > 128 { - return RelationshipFilterValidationError{ - field: "ResourceType", - reason: "value length must be at most 128 bytes", - } - } - - if !_RelationshipFilter_ResourceType_Pattern.MatchString(m.GetResourceType()) { - return RelationshipFilterValidationError{ - field: "ResourceType", - reason: "value does not match regex pattern \"^([a-z][a-z0-9_]{2,61}[a-z0-9]/)?[a-z][a-z0-9_]{2,62}[a-z0-9]$\"", - } - } - - if len(m.GetOptionalResourceId()) > 128 { - return RelationshipFilterValidationError{ - field: "OptionalResourceId", - reason: "value length must be at most 128 bytes", - } - } + // no validation rules for ResourceType - if !_RelationshipFilter_OptionalResourceId_Pattern.MatchString(m.GetOptionalResourceId()) { - return RelationshipFilterValidationError{ - field: "OptionalResourceId", - reason: "value does not match regex pattern \"^([a-zA-Z0-9_][a-zA-Z0-9/_-]{0,127})?$\"", - } - } + // no validation rules for OptionalResourceId - if len(m.GetOptionalRelation()) > 64 { - return RelationshipFilterValidationError{ - field: "OptionalRelation", - reason: "value length must be at most 64 bytes", - } - } - - if !_RelationshipFilter_OptionalRelation_Pattern.MatchString(m.GetOptionalRelation()) { - return RelationshipFilterValidationError{ - field: "OptionalRelation", - reason: "value does not match regex pattern \"^([a-z][a-z0-9_]{2,62}[a-z0-9])?$\"", - } - } + // no validation rules for OptionalRelation if v, ok := interface{}(m.GetOptionalSubjectFilter()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { @@ -269,12 +215,6 @@ var _ interface { ErrorName() string } = RelationshipFilterValidationError{} -var _RelationshipFilter_ResourceType_Pattern = regexp.MustCompile("^([a-z][a-z0-9_]{2,61}[a-z0-9]/)?[a-z][a-z0-9_]{2,62}[a-z0-9]$") - -var _RelationshipFilter_OptionalResourceId_Pattern = regexp.MustCompile("^([a-zA-Z0-9_][a-zA-Z0-9/_-]{0,127})?$") - -var _RelationshipFilter_OptionalRelation_Pattern = regexp.MustCompile("^([a-z][a-z0-9_]{2,62}[a-z0-9])?$") - // Validate checks the field values on SubjectFilter with the rules defined in // the proto definition for this message. If any rules are violated, an error // is returned. @@ -283,33 +223,9 @@ func (m *SubjectFilter) Validate() error { return nil } - if len(m.GetSubjectType()) > 128 { - return SubjectFilterValidationError{ - field: "SubjectType", - reason: "value length must be at most 128 bytes", - } - } + // no validation rules for SubjectType - if !_SubjectFilter_SubjectType_Pattern.MatchString(m.GetSubjectType()) { - return SubjectFilterValidationError{ - field: "SubjectType", - reason: "value does not match regex pattern \"^([a-z][a-z0-9_]{2,61}[a-z0-9]/)?[a-z][a-z0-9_]{2,62}[a-z0-9]$\"", - } - } - - if len(m.GetOptionalSubjectId()) > 128 { - return SubjectFilterValidationError{ - field: "OptionalSubjectId", - reason: "value length must be at most 128 bytes", - } - } - - if !_SubjectFilter_OptionalSubjectId_Pattern.MatchString(m.GetOptionalSubjectId()) { - return SubjectFilterValidationError{ - field: "OptionalSubjectId", - reason: "value does not match regex pattern \"^([a-zA-Z0-9_][a-zA-Z0-9/_-]{0,127})?$\"", - } - } + // no validation rules for OptionalSubjectId if v, ok := interface{}(m.GetOptionalRelation()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { @@ -378,10 +294,6 @@ var _ interface { ErrorName() string } = SubjectFilterValidationError{} -var _SubjectFilter_SubjectType_Pattern = regexp.MustCompile("^([a-z][a-z0-9_]{2,61}[a-z0-9]/)?[a-z][a-z0-9_]{2,62}[a-z0-9]$") - -var _SubjectFilter_OptionalSubjectId_Pattern = regexp.MustCompile("^([a-zA-Z0-9_][a-zA-Z0-9/_-]{0,127})?$") - // Validate checks the field values on ReadRelationshipsRequest with the rules // defined in the proto definition for this message. If any rules are // violated, an error is returned. @@ -400,13 +312,6 @@ func (m *ReadRelationshipsRequest) Validate() error { } } - if m.GetRelationshipFilter() == nil { - return ReadRelationshipsRequestValidationError{ - field: "RelationshipFilter", - reason: "value is required", - } - } - if v, ok := interface{}(m.GetRelationshipFilter()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return ReadRelationshipsRequestValidationError{ @@ -571,19 +476,7 @@ func (m *Precondition) Validate() error { return nil } - if _, ok := Precondition_Operation_name[int32(m.GetOperation())]; !ok { - return PreconditionValidationError{ - field: "Operation", - reason: "value must be one of the defined enum values", - } - } - - if m.GetFilter() == nil { - return PreconditionValidationError{ - field: "Filter", - reason: "value is required", - } - } + // no validation rules for Operation if v, ok := interface{}(m.GetFilter()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { @@ -663,13 +556,6 @@ func (m *WriteRelationshipsRequest) Validate() error { for idx, item := range m.GetUpdates() { _, _ = idx, item - if item == nil { - return WriteRelationshipsRequestValidationError{ - field: fmt.Sprintf("Updates[%v]", idx), - reason: "value is required", - } - } - if v, ok := interface{}(item).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return WriteRelationshipsRequestValidationError{ @@ -685,13 +571,6 @@ func (m *WriteRelationshipsRequest) Validate() error { for idx, item := range m.GetOptionalPreconditions() { _, _ = idx, item - if item == nil { - return WriteRelationshipsRequestValidationError{ - field: fmt.Sprintf("OptionalPreconditions[%v]", idx), - reason: "value is required", - } - } - if v, ok := interface{}(item).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return WriteRelationshipsRequestValidationError{ @@ -848,13 +727,6 @@ func (m *DeleteRelationshipsRequest) Validate() error { return nil } - if m.GetRelationshipFilter() == nil { - return DeleteRelationshipsRequestValidationError{ - field: "RelationshipFilter", - reason: "value is required", - } - } - if v, ok := interface{}(m.GetRelationshipFilter()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return DeleteRelationshipsRequestValidationError{ @@ -868,13 +740,6 @@ func (m *DeleteRelationshipsRequest) Validate() error { for idx, item := range m.GetOptionalPreconditions() { _, _ = idx, item - if item == nil { - return DeleteRelationshipsRequestValidationError{ - field: fmt.Sprintf("OptionalPreconditions[%v]", idx), - reason: "value is required", - } - } - if v, ok := interface{}(item).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return DeleteRelationshipsRequestValidationError{ @@ -1042,13 +907,6 @@ func (m *CheckPermissionRequest) Validate() error { } } - if m.GetResource() == nil { - return CheckPermissionRequestValidationError{ - field: "Resource", - reason: "value is required", - } - } - if v, ok := interface{}(m.GetResource()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return CheckPermissionRequestValidationError{ @@ -1059,26 +917,7 @@ func (m *CheckPermissionRequest) Validate() error { } } - if len(m.GetPermission()) > 64 { - return CheckPermissionRequestValidationError{ - field: "Permission", - reason: "value length must be at most 64 bytes", - } - } - - if !_CheckPermissionRequest_Permission_Pattern.MatchString(m.GetPermission()) { - return CheckPermissionRequestValidationError{ - field: "Permission", - reason: "value does not match regex pattern \"^([a-z][a-z0-9_]{2,62}[a-z0-9])?$\"", - } - } - - if m.GetSubject() == nil { - return CheckPermissionRequestValidationError{ - field: "Subject", - reason: "value is required", - } - } + // no validation rules for Permission if v, ok := interface{}(m.GetSubject()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { @@ -1149,8 +988,6 @@ var _ interface { ErrorName() string } = CheckPermissionRequestValidationError{} -var _CheckPermissionRequest_Permission_Pattern = regexp.MustCompile("^([a-z][a-z0-9_]{2,62}[a-z0-9])?$") - // Validate checks the field values on CheckPermissionResponse with the rules // defined in the proto definition for this message. If any rules are // violated, an error is returned. @@ -1248,13 +1085,6 @@ func (m *ExpandPermissionTreeRequest) Validate() error { } } - if m.GetResource() == nil { - return ExpandPermissionTreeRequestValidationError{ - field: "Resource", - reason: "value is required", - } - } - if v, ok := interface{}(m.GetResource()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return ExpandPermissionTreeRequestValidationError{ @@ -1265,19 +1095,7 @@ func (m *ExpandPermissionTreeRequest) Validate() error { } } - if len(m.GetPermission()) > 64 { - return ExpandPermissionTreeRequestValidationError{ - field: "Permission", - reason: "value length must be at most 64 bytes", - } - } - - if !_ExpandPermissionTreeRequest_Permission_Pattern.MatchString(m.GetPermission()) { - return ExpandPermissionTreeRequestValidationError{ - field: "Permission", - reason: "value does not match regex pattern \"^([a-z][a-z0-9_]{2,62}[a-z0-9])?$\"", - } - } + // no validation rules for Permission return nil } @@ -1339,8 +1157,6 @@ var _ interface { ErrorName() string } = ExpandPermissionTreeRequestValidationError{} -var _ExpandPermissionTreeRequest_Permission_Pattern = regexp.MustCompile("^([a-z][a-z0-9_]{2,62}[a-z0-9])?$") - // Validate checks the field values on ExpandPermissionTreeResponse with the // rules defined in the proto definition for this message. If any rules are // violated, an error is returned. @@ -1447,40 +1263,9 @@ func (m *LookupResourcesRequest) Validate() error { } } - if len(m.GetResourceObjectType()) > 128 { - return LookupResourcesRequestValidationError{ - field: "ResourceObjectType", - reason: "value length must be at most 128 bytes", - } - } + // no validation rules for ResourceObjectType - if !_LookupResourcesRequest_ResourceObjectType_Pattern.MatchString(m.GetResourceObjectType()) { - return LookupResourcesRequestValidationError{ - field: "ResourceObjectType", - reason: "value does not match regex pattern \"^([a-z][a-z0-9_]{2,61}[a-z0-9]/)?[a-z][a-z0-9_]{2,62}[a-z0-9]$\"", - } - } - - if len(m.GetPermission()) > 64 { - return LookupResourcesRequestValidationError{ - field: "Permission", - reason: "value length must be at most 64 bytes", - } - } - - if !_LookupResourcesRequest_Permission_Pattern.MatchString(m.GetPermission()) { - return LookupResourcesRequestValidationError{ - field: "Permission", - reason: "value does not match regex pattern \"^[a-z][a-z0-9_]{2,62}[a-z0-9]$\"", - } - } - - if m.GetSubject() == nil { - return LookupResourcesRequestValidationError{ - field: "Subject", - reason: "value is required", - } - } + // no validation rules for Permission if v, ok := interface{}(m.GetSubject()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { @@ -1551,10 +1336,6 @@ var _ interface { ErrorName() string } = LookupResourcesRequestValidationError{} -var _LookupResourcesRequest_ResourceObjectType_Pattern = regexp.MustCompile("^([a-z][a-z0-9_]{2,61}[a-z0-9]/)?[a-z][a-z0-9_]{2,62}[a-z0-9]$") - -var _LookupResourcesRequest_Permission_Pattern = regexp.MustCompile("^[a-z][a-z0-9_]{2,62}[a-z0-9]$") - // Validate checks the field values on LookupResourcesResponse with the rules // defined in the proto definition for this message. If any rules are // violated, an error is returned. @@ -1642,19 +1423,7 @@ func (m *SubjectFilter_RelationFilter) Validate() error { return nil } - if len(m.GetRelation()) > 64 { - return SubjectFilter_RelationFilterValidationError{ - field: "Relation", - reason: "value length must be at most 64 bytes", - } - } - - if !_SubjectFilter_RelationFilter_Relation_Pattern.MatchString(m.GetRelation()) { - return SubjectFilter_RelationFilterValidationError{ - field: "Relation", - reason: "value does not match regex pattern \"^([a-z][a-z0-9_]{2,62}[a-z0-9])?$\"", - } - } + // no validation rules for Relation return nil } @@ -1715,5 +1484,3 @@ var _ interface { Cause() error ErrorName() string } = SubjectFilter_RelationFilterValidationError{} - -var _SubjectFilter_RelationFilter_Relation_Pattern = regexp.MustCompile("^([a-z][a-z0-9_]{2,62}[a-z0-9])?$") diff --git a/proto/authzed/api/v1/schema_service.pb.go b/proto/authzed/api/v1/schema_service.pb.go index 2c23d85..38ccfc2 100644 --- a/proto/authzed/api/v1/schema_service.pb.go +++ b/proto/authzed/api/v1/schema_service.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.27.1 -// protoc v3.19.0 +// protoc v3.19.1 // source: authzed/api/v1/schema_service.proto package v1 diff --git a/proto/authzed/api/v1/schema_service.pb.validate.go b/proto/authzed/api/v1/schema_service.pb.validate.go index a268117..e4d661e 100644 --- a/proto/authzed/api/v1/schema_service.pb.validate.go +++ b/proto/authzed/api/v1/schema_service.pb.validate.go @@ -15,7 +15,7 @@ import ( "time" "unicode/utf8" - "google.golang.org/protobuf/types/known/anypb" + "github.com/golang/protobuf/ptypes" ) // ensure the imports are used @@ -30,7 +30,7 @@ var ( _ = time.Duration(0) _ = (*url.URL)(nil) _ = (*mail.Address)(nil) - _ = anypb.Any{} + _ = ptypes.DynamicAny{} ) // Validate checks the field values on ReadSchemaRequest with the rules defined @@ -177,12 +177,7 @@ func (m *WriteSchemaRequest) Validate() error { return nil } - if len(m.GetSchema()) > 262144 { - return WriteSchemaRequestValidationError{ - field: "Schema", - reason: "value length must be at most 262144 bytes", - } - } + // no validation rules for Schema return nil } diff --git a/proto/authzed/api/v1/watch_service.pb.go b/proto/authzed/api/v1/watch_service.pb.go index 9218338..66c26e0 100644 --- a/proto/authzed/api/v1/watch_service.pb.go +++ b/proto/authzed/api/v1/watch_service.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.27.1 -// protoc v3.19.0 +// protoc v3.19.1 // source: authzed/api/v1/watch_service.proto package v1 @@ -30,7 +30,7 @@ type WatchRequest struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - ObjectTypes []string `protobuf:"bytes,1,rep,name=object_types,json=objectTypes,proto3" json:"object_types,omitempty"` + OptionalObjectTypes []string `protobuf:"bytes,1,rep,name=optional_object_types,json=optionalObjectTypes,proto3" json:"optional_object_types,omitempty"` OptionalStartCursor *ZedToken `protobuf:"bytes,2,opt,name=optional_start_cursor,json=optionalStartCursor,proto3" json:"optional_start_cursor,omitempty"` } @@ -66,9 +66,9 @@ func (*WatchRequest) Descriptor() ([]byte, []int) { return file_authzed_api_v1_watch_service_proto_rawDescGZIP(), []int{0} } -func (x *WatchRequest) GetObjectTypes() []string { +func (x *WatchRequest) GetOptionalObjectTypes() []string { if x != nil { - return x.ObjectTypes + return x.OptionalObjectTypes } return nil } @@ -150,41 +150,42 @@ var file_authzed_api_v1_watch_service_proto_rawDesc = []byte{ 0x74, 0x6f, 0x1a, 0x17, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x19, 0x61, 0x75, 0x74, 0x68, 0x7a, 0x65, 0x64, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x2f, 0x63, 0x6f, 0x72, 0x65, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xd0, 0x01, 0x0a, 0x0c, 0x57, 0x61, 0x74, 0x63, 0x68, - 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x72, 0x0a, 0x0c, 0x6f, 0x62, 0x6a, 0x65, 0x63, - 0x74, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x42, 0x4f, 0xfa, - 0x42, 0x4c, 0x92, 0x01, 0x49, 0x08, 0x01, 0x22, 0x45, 0x72, 0x43, 0x28, 0x80, 0x01, 0x32, 0x3e, - 0x5e, 0x28, 0x5b, 0x61, 0x2d, 0x7a, 0x5d, 0x5b, 0x61, 0x2d, 0x7a, 0x30, 0x2d, 0x39, 0x5f, 0x5d, - 0x7b, 0x32, 0x2c, 0x36, 0x32, 0x7d, 0x5b, 0x61, 0x2d, 0x7a, 0x30, 0x2d, 0x39, 0x5d, 0x2f, 0x29, - 0x3f, 0x5b, 0x61, 0x2d, 0x7a, 0x5d, 0x5b, 0x61, 0x2d, 0x7a, 0x30, 0x2d, 0x39, 0x5f, 0x5d, 0x7b, - 0x32, 0x2c, 0x36, 0x32, 0x7d, 0x5b, 0x61, 0x2d, 0x7a, 0x30, 0x2d, 0x39, 0x5d, 0x24, 0x52, 0x0b, - 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x54, 0x79, 0x70, 0x65, 0x73, 0x12, 0x4c, 0x0a, 0x15, 0x6f, - 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x5f, 0x63, 0x75, - 0x72, 0x73, 0x6f, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x61, 0x75, 0x74, - 0x68, 0x7a, 0x65, 0x64, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x5a, 0x65, 0x64, 0x54, - 0x6f, 0x6b, 0x65, 0x6e, 0x52, 0x13, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x53, 0x74, - 0x61, 0x72, 0x74, 0x43, 0x75, 0x72, 0x73, 0x6f, 0x72, 0x22, 0x90, 0x01, 0x0a, 0x0d, 0x57, 0x61, - 0x74, 0x63, 0x68, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3c, 0x0a, 0x07, 0x75, - 0x70, 0x64, 0x61, 0x74, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x61, - 0x75, 0x74, 0x68, 0x7a, 0x65, 0x64, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x52, 0x65, - 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x68, 0x69, 0x70, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, - 0x52, 0x07, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x73, 0x12, 0x41, 0x0a, 0x0f, 0x63, 0x68, 0x61, - 0x6e, 0x67, 0x65, 0x73, 0x5f, 0x74, 0x68, 0x72, 0x6f, 0x75, 0x67, 0x68, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x7a, 0x65, 0x64, 0x2e, 0x61, 0x70, 0x69, - 0x2e, 0x76, 0x31, 0x2e, 0x5a, 0x65, 0x64, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x52, 0x0e, 0x63, 0x68, - 0x61, 0x6e, 0x67, 0x65, 0x73, 0x54, 0x68, 0x72, 0x6f, 0x75, 0x67, 0x68, 0x32, 0x6c, 0x0a, 0x0c, - 0x57, 0x61, 0x74, 0x63, 0x68, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x5c, 0x0a, 0x05, - 0x57, 0x61, 0x74, 0x63, 0x68, 0x12, 0x1c, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x7a, 0x65, 0x64, 0x2e, - 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x57, 0x61, 0x74, 0x63, 0x68, 0x52, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x1a, 0x1d, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x7a, 0x65, 0x64, 0x2e, 0x61, 0x70, - 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x57, 0x61, 0x74, 0x63, 0x68, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x22, 0x14, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x0e, 0x3a, 0x01, 0x2a, 0x22, 0x09, 0x2f, - 0x76, 0x31, 0x2f, 0x77, 0x61, 0x74, 0x63, 0x68, 0x30, 0x01, 0x42, 0x48, 0x0a, 0x12, 0x63, 0x6f, - 0x6d, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x7a, 0x65, 0x64, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, - 0x5a, 0x32, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x61, 0x75, 0x74, - 0x68, 0x7a, 0x65, 0x64, 0x2f, 0x61, 0x75, 0x74, 0x68, 0x7a, 0x65, 0x64, 0x2d, 0x67, 0x6f, 0x2f, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x61, 0x75, 0x74, 0x68, 0x7a, 0x65, 0x64, 0x2f, 0x61, 0x70, - 0x69, 0x2f, 0x76, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xe2, 0x01, 0x0a, 0x0c, 0x57, 0x61, 0x74, 0x63, 0x68, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x83, 0x01, 0x0a, 0x15, 0x6f, 0x70, 0x74, 0x69, + 0x6f, 0x6e, 0x61, 0x6c, 0x5f, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x74, 0x79, 0x70, 0x65, + 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x42, 0x4f, 0xfa, 0x42, 0x4c, 0x92, 0x01, 0x49, 0x08, + 0x00, 0x22, 0x45, 0x72, 0x43, 0x28, 0x80, 0x01, 0x32, 0x3e, 0x5e, 0x28, 0x5b, 0x61, 0x2d, 0x7a, + 0x5d, 0x5b, 0x61, 0x2d, 0x7a, 0x30, 0x2d, 0x39, 0x5f, 0x5d, 0x7b, 0x32, 0x2c, 0x36, 0x32, 0x7d, + 0x5b, 0x61, 0x2d, 0x7a, 0x30, 0x2d, 0x39, 0x5d, 0x2f, 0x29, 0x3f, 0x5b, 0x61, 0x2d, 0x7a, 0x5d, + 0x5b, 0x61, 0x2d, 0x7a, 0x30, 0x2d, 0x39, 0x5f, 0x5d, 0x7b, 0x32, 0x2c, 0x36, 0x32, 0x7d, 0x5b, + 0x61, 0x2d, 0x7a, 0x30, 0x2d, 0x39, 0x5d, 0x24, 0x52, 0x13, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, + 0x61, 0x6c, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x54, 0x79, 0x70, 0x65, 0x73, 0x12, 0x4c, 0x0a, + 0x15, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x5f, + 0x63, 0x75, 0x72, 0x73, 0x6f, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x61, + 0x75, 0x74, 0x68, 0x7a, 0x65, 0x64, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x5a, 0x65, + 0x64, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x52, 0x13, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, + 0x53, 0x74, 0x61, 0x72, 0x74, 0x43, 0x75, 0x72, 0x73, 0x6f, 0x72, 0x22, 0x90, 0x01, 0x0a, 0x0d, + 0x57, 0x61, 0x74, 0x63, 0x68, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3c, 0x0a, + 0x07, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x22, + 0x2e, 0x61, 0x75, 0x74, 0x68, 0x7a, 0x65, 0x64, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, + 0x52, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x68, 0x69, 0x70, 0x55, 0x70, 0x64, 0x61, + 0x74, 0x65, 0x52, 0x07, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x73, 0x12, 0x41, 0x0a, 0x0f, 0x63, + 0x68, 0x61, 0x6e, 0x67, 0x65, 0x73, 0x5f, 0x74, 0x68, 0x72, 0x6f, 0x75, 0x67, 0x68, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x7a, 0x65, 0x64, 0x2e, 0x61, + 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x5a, 0x65, 0x64, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x52, 0x0e, + 0x63, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x73, 0x54, 0x68, 0x72, 0x6f, 0x75, 0x67, 0x68, 0x32, 0x6c, + 0x0a, 0x0c, 0x57, 0x61, 0x74, 0x63, 0x68, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x5c, + 0x0a, 0x05, 0x57, 0x61, 0x74, 0x63, 0x68, 0x12, 0x1c, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x7a, 0x65, + 0x64, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x57, 0x61, 0x74, 0x63, 0x68, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1d, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x7a, 0x65, 0x64, 0x2e, + 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x57, 0x61, 0x74, 0x63, 0x68, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x14, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x0e, 0x3a, 0x01, 0x2a, 0x22, + 0x09, 0x2f, 0x76, 0x31, 0x2f, 0x77, 0x61, 0x74, 0x63, 0x68, 0x30, 0x01, 0x42, 0x48, 0x0a, 0x12, + 0x63, 0x6f, 0x6d, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x7a, 0x65, 0x64, 0x2e, 0x61, 0x70, 0x69, 0x2e, + 0x76, 0x31, 0x5a, 0x32, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x61, + 0x75, 0x74, 0x68, 0x7a, 0x65, 0x64, 0x2f, 0x61, 0x75, 0x74, 0x68, 0x7a, 0x65, 0x64, 0x2d, 0x67, + 0x6f, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x61, 0x75, 0x74, 0x68, 0x7a, 0x65, 0x64, 0x2f, + 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/proto/authzed/api/v1/watch_service.pb.validate.go b/proto/authzed/api/v1/watch_service.pb.validate.go index a4ca2eb..bcd0c6b 100644 --- a/proto/authzed/api/v1/watch_service.pb.validate.go +++ b/proto/authzed/api/v1/watch_service.pb.validate.go @@ -15,7 +15,7 @@ import ( "time" "unicode/utf8" - "google.golang.org/protobuf/types/known/anypb" + "github.com/golang/protobuf/ptypes" ) // ensure the imports are used @@ -30,7 +30,7 @@ var ( _ = time.Duration(0) _ = (*url.URL)(nil) _ = (*mail.Address)(nil) - _ = anypb.Any{} + _ = ptypes.DynamicAny{} ) // Validate checks the field values on WatchRequest with the rules defined in @@ -41,32 +41,6 @@ func (m *WatchRequest) Validate() error { return nil } - if len(m.GetObjectTypes()) < 1 { - return WatchRequestValidationError{ - field: "ObjectTypes", - reason: "value must contain at least 1 item(s)", - } - } - - for idx, item := range m.GetObjectTypes() { - _, _ = idx, item - - if len(item) > 128 { - return WatchRequestValidationError{ - field: fmt.Sprintf("ObjectTypes[%v]", idx), - reason: "value length must be at most 128 bytes", - } - } - - if !_WatchRequest_ObjectTypes_Pattern.MatchString(item) { - return WatchRequestValidationError{ - field: fmt.Sprintf("ObjectTypes[%v]", idx), - reason: "value does not match regex pattern \"^([a-z][a-z0-9_]{2,62}[a-z0-9]/)?[a-z][a-z0-9_]{2,62}[a-z0-9]$\"", - } - } - - } - if v, ok := interface{}(m.GetOptionalStartCursor()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return WatchRequestValidationError{ @@ -134,8 +108,6 @@ var _ interface { ErrorName() string } = WatchRequestValidationError{} -var _WatchRequest_ObjectTypes_Pattern = regexp.MustCompile("^([a-z][a-z0-9_]{2,62}[a-z0-9]/)?[a-z][a-z0-9_]{2,62}[a-z0-9]$") - // Validate checks the field values on WatchResponse with the rules defined in // the proto definition for this message. If any rules are violated, an error // is returned. diff --git a/proto/authzed/api/v1alpha1/schema.pb.go b/proto/authzed/api/v1alpha1/schema.pb.go index 922a640..2ebc6b4 100644 --- a/proto/authzed/api/v1alpha1/schema.pb.go +++ b/proto/authzed/api/v1alpha1/schema.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.27.1 -// protoc v3.19.0 +// protoc v3.19.1 // source: authzed/api/v1alpha1/schema.proto package v1alpha1 diff --git a/proto/authzed/api/v1alpha1/schema.pb.validate.go b/proto/authzed/api/v1alpha1/schema.pb.validate.go index 84141c3..49b22a4 100644 --- a/proto/authzed/api/v1alpha1/schema.pb.validate.go +++ b/proto/authzed/api/v1alpha1/schema.pb.validate.go @@ -15,7 +15,7 @@ import ( "time" "unicode/utf8" - "google.golang.org/protobuf/types/known/anypb" + "github.com/golang/protobuf/ptypes" ) // ensure the imports are used @@ -30,7 +30,7 @@ var ( _ = time.Duration(0) _ = (*url.URL)(nil) _ = (*mail.Address)(nil) - _ = anypb.Any{} + _ = ptypes.DynamicAny{} ) // Validate checks the field values on ReadSchemaRequest with the rules defined @@ -41,25 +41,6 @@ func (m *ReadSchemaRequest) Validate() error { return nil } - for idx, item := range m.GetObjectDefinitionsNames() { - _, _ = idx, item - - if len(item) > 128 { - return ReadSchemaRequestValidationError{ - field: fmt.Sprintf("ObjectDefinitionsNames[%v]", idx), - reason: "value length must be at most 128 bytes", - } - } - - if !_ReadSchemaRequest_ObjectDefinitionsNames_Pattern.MatchString(item) { - return ReadSchemaRequestValidationError{ - field: fmt.Sprintf("ObjectDefinitionsNames[%v]", idx), - reason: "value does not match regex pattern \"^([a-z][a-z0-9_]{2,62}[a-z0-9]/)?[a-z][a-z0-9_]{2,62}[a-z0-9]$\"", - } - } - - } - return nil } @@ -119,8 +100,6 @@ var _ interface { ErrorName() string } = ReadSchemaRequestValidationError{} -var _ReadSchemaRequest_ObjectDefinitionsNames_Pattern = regexp.MustCompile("^([a-z][a-z0-9_]{2,62}[a-z0-9]/)?[a-z][a-z0-9_]{2,62}[a-z0-9]$") - // Validate checks the field values on ReadSchemaResponse with the rules // defined in the proto definition for this message. If any rules are // violated, an error is returned. @@ -196,12 +175,7 @@ func (m *WriteSchemaRequest) Validate() error { return nil } - if len(m.GetSchema()) > 262144 { - return WriteSchemaRequestValidationError{ - field: "Schema", - reason: "value length must be at most 262144 bytes", - } - } + // no validation rules for Schema return nil }