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

API Option Handling #5516

Merged
merged 1 commit into from
Jul 20, 2015
Merged

API Option Handling #5516

merged 1 commit into from
Jul 20, 2015

Conversation

ErisDS
Copy link
Member

@ErisDS ErisDS commented Jul 4, 2015

This PR adds basic filtering of options so that only the permitted ones get passed through to the next function.

It does not yet add checking if the values of the options are valid and it also does not throw an error if an invalid option is passed in. This additional structure unblocks adding and changing the options in a more testable way (e.g. adding a fields parameter, whereas adding value checks will take more time.

I'm not sure about the need to return an error if the passed options aren't allowed?

refs #2758

  • add a set of default options to utils
  • update validation function to only pass through permitted options
  • pass permitted options into validate where necessary

@halfdan
Copy link
Contributor

halfdan commented Jul 4, 2015

Looks good! 👍

@ErisDS ErisDS force-pushed the issue-2758-api-opts branch 3 times, most recently from a4e8003 to e044136 Compare July 14, 2015 17:19
refs TryGhost#2758

- add a set of default options to utils
- update validation function to only pass through permitted options
- pass permitted options into validate where necessary
- setup basic validation for each known option, and generic validation for the remainder
- change slug to treat 'name' as data, rather than an option
@ErisDS ErisDS changed the title API Option Handling [WIP] API Option Handling Jul 15, 2015
@ErisDS
Copy link
Member Author

ErisDS commented Jul 15, 2015

I think I need to factor out the custom validation function for user edit & add a few extra integration tests for good measure... brb...

@ErisDS ErisDS changed the title [WIP] API Option Handling API Option Handling Jul 16, 2015
@ErisDS
Copy link
Member Author

ErisDS commented Jul 16, 2015

I'm losing it, custom validation functions are removed already. Double checked what's getting integration tested in the API, it's weirdly split between the integration and route tests, but I'm happy with the coverage and that's not something to fix in this PR.

I'll add better coverage of tags & pagination in general in the integration tests when I fix #5551, or as a separate commit to clear up and clarify what should be tested in the route vs integration tests.

I believe that this is ready.

sebgie added a commit that referenced this pull request Jul 20, 2015
@sebgie sebgie merged commit 4a89c6a into TryGhost:master Jul 20, 2015
@ErisDS ErisDS deleted the issue-2758-api-opts branch July 22, 2015 20:38
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.

3 participants