Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AuthorizeDirective does not deserialize roles property correctly if it is passed as a single string #624

Closed
eduleite opened this issue Mar 11, 2019 · 1 comment · Fixed by #782
Assignees
Milestone

Comments

@eduleite
Copy link
Contributor

In the following schema, the roles will not deserialize correctly and will always be empty:

type Query {
	queryOne: String! 
	queryTwo: String! @authorize(roles: "ROLE1")
	queryThree: String! @authorize(roles: "ROLE3")
}

They will only deserialize properly if declared this way:

type Query {
	queryOne: String! 
	queryTwo: String! @authorize(roles: ["ROLE1"])
	queryThree: String! @authorize(roles: ["ROLE3"])
}
eduleite added a commit to eduleite/hotchocolate that referenced this issue Mar 11, 2019
eduleite added a commit to eduleite/hotchocolate that referenced this issue Mar 11, 2019
@michaelstaib michaelstaib self-assigned this Mar 11, 2019
@michaelstaib michaelstaib added this to the 9.0.0 milestone Mar 11, 2019
@michaelstaib
Copy link
Member

The issue here is that we do not honor input coercion rules on directive arguments. I will write some tests so that we can track this issue.

The directive itself should not have to deal with these rules so we have to have the inputs already correctly coerced when we pass the to the directive.

I think we will create a fix with 9.0.0-preview.2 or 9.0.0-preview.3 at the end of this week.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants