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

Default values not work for notNull fields #274

Closed
jantajov opened this issue Apr 23, 2018 · 8 comments
Closed

Default values not work for notNull fields #274

jantajov opened this issue Apr 23, 2018 · 8 comments
Milestone

Comments

@jantajov
Copy link

Field with type 'notNull' ignores default value and throws error:

"Argument "paging" has invalid value {pageSize: 2}. In field "page": Expected "Int!", found null."

// PagingType.php

$config = [
	'fields' => function () {
		return [
			'page' => [
				'type' => Type::nonNull(Type::int()),
				'defaultValue' => 1,
			],
			'pageSize' => Type::nonNull(Type::int()),
		];
	},
];

With nullable types default value works as expected but then client can pass null value into page field...

@vladar
Copy link
Member

vladar commented Apr 24, 2018

This is an issue in spec and reference implementation. See graphql/graphql-js#1274 We will likely use the same solution eventually.

@mdio
Copy link

mdio commented Jun 11, 2018

Since the PR on graphql-js has been merged, will the behaviour be ported to this library?

@vladar
Copy link
Member

vladar commented Jun 11, 2018

Yes, but this will be likely a part of 0.13 release

@mdio
Copy link

mdio commented Jun 11, 2018

Thank you for the quick reply.
Is there any ETA on 0.13?

@vladar
Copy link
Member

vladar commented Jun 11, 2018

Unfortunately no, we've just released 0.12. But chances are high that it will take much less time than 0.12 %)

@mdio
Copy link

mdio commented Jun 12, 2018

Hehe, okay. Thanks!

@enumag
Copy link
Contributor

enumag commented Nov 3, 2018

@vladar So will this be in 0.13 then? I noticed in another thread that you want to release it soon.

@vladar
Copy link
Member

vladar commented Nov 3, 2018

I did plan to include it in 0.13 but have little time now. And we already delayed the release for a while. Also in the reference implementation, it is a part of the 14.0.0 release.

We could include it in our 0.13 if someone ported these changes in the next couple of days. I'll try to find time but can't promise it.

@vladar vladar added this to the 14.0 milestone Jun 19, 2019
@vladar vladar closed this as completed in bf4e7d4 Aug 14, 2019
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

No branches or pull requests

4 participants