Hello! I'm struggling to figure out how
# spicedb
g
Hello! I'm struggling to figure out how to use the API to create a relationship that has a "#" in the subject. I'm using the HTTP API. I have a schema that looks something like:
Copy code
definition ns/organization {}
definition ns/project{}

definition ns/resource {
    relation shared_with: ns/organization#project | ns/project | ns/project:*
}
And the following all work as expected in the playground:
Copy code
ns/resource:TestResourceID#shared_with@ns/project:*
ns/resource:TestResourceID#shared_with@ns/project:AcmeCorp_Coyote
ns/resource:TestResourceID#shared_with@ns/organization:ParkerIndustries#project
However, when a request creating a resource where the subject's object ID is
ParkerIndustries#project
, I get an error back saying the ID doesn't match the expected regex.
Copy code
{\"code\":3,\"message\":\"invalid WriteRelationshipsRequest.Updates[0]: embedded message failed validation | caused by: invalid RelationshipUpdate.Relationship: embedded message failed validation | caused by: invalid Relationship.Subject: embedded message failed validation | caused by: invalid SubjectReference.Object: embedded message failed validation | caused by: invalid ObjectReference.ObjectId: value does not match regex pattern \\\"^(([a-zA-Z0-9/_|\\\\\\\\-=+]{1,})|\\\\\\\\*)$\\\"\",\"details\":[]}
Any advice 🙏
colleage helped me figure it out. Setting the OptionalRelation on the subject in the request does this.
5 Views