Skip to content

Commit

Permalink
Merge pull request #42 from josephschorr/update-api-wildcard
Browse files Browse the repository at this point in the history
Update api for wildcard support
  • Loading branch information
jzelinskie committed Dec 9, 2021
2 parents 85fcdfe + 975b955 commit 6dfdd04
Show file tree
Hide file tree
Showing 14 changed files with 917 additions and 375 deletions.
2 changes: 1 addition & 1 deletion buf.gen.yaml
@@ -1,4 +1,4 @@
#!/usr/bin/env -S buf generate buf.build/authzed/api:262837a8e7451bfd9cac0518972ceaef1d0b9963 --template
#!/usr/bin/env -S buf generate buf.build/authzed/api:13e8ee73802a1a7825fcfa66a3ff9b13c43e2d8e --template
---
version: "v1"
plugins:
Expand Down
19 changes: 18 additions & 1 deletion proto/apidocs.swagger.json
Expand Up @@ -377,6 +377,9 @@
}
},
"definitions": {
"AllowedRelationPublicWildcard": {
"type": "object"
},
"CheckPermissionResponsePermissionship": {
"type": "string",
"enum": [
Expand Down Expand Up @@ -615,6 +618,20 @@
}
}
},
"v0AllowedRelation": {
"type": "object",
"properties": {
"namespace": {
"type": "string"
},
"relation": {
"type": "string"
},
"publicWildcard": {
"$ref": "#/definitions/AllowedRelationPublicWildcard"
}
}
},
"v0CheckResponse": {
"type": "object",
"properties": {
Expand Down Expand Up @@ -1050,7 +1067,7 @@
"allowedDirectRelations": {
"type": "array",
"items": {
"$ref": "#/definitions/v0RelationReference"
"$ref": "#/definitions/v0AllowedRelation"
}
}
}
Expand Down
47 changes: 47 additions & 0 deletions proto/authzed/api/v0/02_handwritten_validation.go
@@ -0,0 +1,47 @@
// The contents of this file are hand-written to add HandwrittenValidate to select message types

package v0

func (m *CheckRequest) HandwrittenValidate() error {
if m.GetTestUserset() != nil && m.GetTestUserset().GetObjectId() == "*" {
return ObjectAndRelationValidationError{
field: "ObjectId",
reason: "alphanumeric value is required",
}
}

return nil
}

func (m *ContentChangeCheckRequest) HandwrittenValidate() error {
if m.GetTestUserset() != nil && m.GetTestUserset().GetObjectId() == "*" {
return ObjectAndRelationValidationError{
field: "ObjectId",
reason: "alphanumeric value is required",
}
}

return nil
}

func (m *ExpandRequest) HandwrittenValidate() error {
if m.GetUserset() != nil && m.GetUserset().GetObjectId() == "*" {
return ObjectAndRelationValidationError{
field: "ObjectId",
reason: "alphanumeric value is required",
}
}

return nil
}

func (m *LookupRequest) HandwrittenValidate() error {
if m.GetUser() != nil && m.GetUser().GetObjectId() == "*" {
return ObjectAndRelationValidationError{
field: "ObjectId",
reason: "alphanumeric value is required",
}
}

return nil
}
119 changes: 60 additions & 59 deletions proto/authzed/api/v0/acl_service.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 14 additions & 0 deletions proto/authzed/api/v0/acl_service.pb.validate.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 6dfdd04

Please sign in to comment.