graphql
graphql copied to clipboard
Relationship types are not being escaped using backticks
Hey @tbwiss I think I just figured it out I did this
type PipingCon @exclude(operations: [UPDATE, DELETE]) @node(label: "PipingConnection") {
conn_point_id: ID!
sourceItem: PipingTargetItem! @relationship(type: "\`PipingConnection.TargetItem\`", direction: OUT)
}
type PipingTargetItem @exclude(operations: [UPDATE, DELETE]) {
lineId: ID!
targetItem: PipingCon! @relationship(type: "\`PipingConnection.TargetItem\`", direction: IN)
}
and it worked !
Originally posted by @TilakMaddy in https://github.com/neo4j/graphql/issues/1606#issuecomment-1161341959
Much like we do with labels, it shouldn't be on our users to escape relationship types.
We've been able to confirm this bug using the steps to reproduce that you provided - many thanks @darrellwarde! :pray: We will now prioritise the bug and address it appropriately.
Recently I encountered a similar problem when defining roles in authentication. We currently define the roles as string values, but that's not really a good thing. This can lead to typos and many files have to be adjusted when renaming.
Recently I encountered a similar problem when defining roles in authentication. We currently define the roles as string values, but that's not really a good thing. This can lead to typos and many files have to be adjusted when renaming.
Hey @AccsoSG, can you give an example (or raise a bug report) of what you mean by this? Will be helpful for us to understand and fix! 🙂
@darrellwarde Sorry for the late reply.
For example, I declared a type with the following auth rules:
extend type FormatFamily
@auth(
rules: [
{ roles: ["ReadOnlyUser"], operations: [READ] }
{ roles: ["Planner"], operations: [READ, CONNECT, DISCONNECT] }
{ roles: ["PowerUser"], operations: [READ, CREATE, UPDATE, DELETE, CONNECT, DISCONNECT] }
{
roles: ["TechnicalAdmin"]
operations: [READ, CREATE, UPDATE, DELETE, CONNECT, DISCONNECT]
}
]
)
In addition, I have declared many more types with the @auth directive and the same roles. The roles are passed as strings. At this point it would be easier to use an enum to avoid typos. So in the example instead of the string "Planner" an enum Role.Planner.
This particular escaping issue is now resolved in 4.0.0.
On your issue above @AccsoSG, maybe try the new @authorization
directive and defining your @jwt
type with the roles
field as an enum? I have a feeling that might actually work! Otherwise, feel free to raise a feature request.