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

Implement "default_max_page_size" #752

Merged
merged 6 commits into from
Jun 1, 2017

Conversation

esjee
Copy link
Contributor

@esjee esjee commented May 31, 2017

#751

Usage:

MySchema = GraphQL::Schema.define do
  # ...
  default_max_page_size 100
  # ...
end

For any relation where max_page_size is not defined, or if it is nil, the default_max_page_size will be used instead.

Also, partially for my own benefit, here's the complete list of bases in order:

Name Cursor
Yavin MQ==
Echo Base Mg==
Secret Hideout Mw==
Death Star NA==
Shield Generator NQ==
Headquarters Ng==

(Yavin being the first base, Headquarters being the last).

@Willianvdv
Copy link
Contributor

Willianvdv commented May 31, 2017

@esjee would it be valuable to add it to the security section of the docs? And the change log?

@esjee
Copy link
Contributor Author

esjee commented May 31, 2017

I think that makes sense! Would it also be helpful to have a sane default value here instead of nil?

@Willianvdv
Copy link
Contributor

@esjee that will be a breaking change plus I'm not sure what a sane value would be.

@rmosolgo
Copy link
Owner

rmosolgo commented Jun 1, 2017

👍 for keeping a default of nil, I'd rather keep the existing behavior as default, at least so we don't surprise anyone!

BTW, regarding cursors, I often debug with Chrome console, in case this trick helps:

image

Copy link
Owner

@rmosolgo rmosolgo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 great implementation and thanks for the solid tests!

I just have a couple of questions about those renamed variables.

@@ -187,14 +187,74 @@ def get_page_info(result)
assert_equal(["Yavin", "Echo Base"], get_names(result))
assert_equal(false, get_page_info(result)["hasPreviousPage"], "hasPreviousPage is false when last is not specified")

third_cursor = "Mw=="
fourth_cursor = "Mw=="
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On the table you posted in the description, "Mw==" is the third row. Are you sure we should rename this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nope! This is a rename gone badly. I was a bit too eager with the find-and-replace. Sorry!

@@ -206,23 +206,82 @@ def get_last_cursor(result)

it "applies to queries by `last`" do
second_to_last_two_names = ["Death Star", "Shield Generator"]
first_and_second_names = ["Yavin", "Echo Base"]
first_second_and_third_names = ["Yavin", "Echo Base"]
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are only two items in this array, why should it be renamed to have and_third in the variable name?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above, this is a find-and-replace error. Sorry!

@rmosolgo rmosolgo modified the milestone: 1.6.2 Jun 1, 2017
@rmosolgo
Copy link
Owner

rmosolgo commented Jun 1, 2017

Makes sense, thanks for following up!

@rmosolgo rmosolgo merged commit 81aee3a into rmosolgo:master Jun 1, 2017
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 this pull request may close these issues.

None yet

3 participants