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

HAPI Integration Refactor #127

Merged
merged 14 commits into from
Sep 9, 2016
Merged

HAPI Integration Refactor #127

merged 14 commits into from
Sep 9, 2016

Conversation

nnance
Copy link
Contributor

@nnance nnance commented Sep 8, 2016

This is a significant refactor of the HAPI integration to make the plugins more flexible and idiomatic. This should resolve the outstanding issues related to the HAPI integration. Specifically ( #97 and #123 )

WARNING: This refactor does result in breaking changes to the API.

TODO:

  • Update CHANGELOG.md with your change (include reference to issue & this PR)
  • Make sure all of the significant new logic is covered by tests
  • Rebase your changes on master so that they can be merged easily
  • Make sure all tests and linter rules pass

@nnance nnance changed the title (WIP) HAPI Integration Refactor HAPI Integration Refactor Sep 8, 2016
@nnance
Copy link
Contributor Author

nnance commented Sep 8, 2016

@helfer The reason for a drop in code coverage is because I resolved one of the todo items which is to handle JSON parse errors in variables. As a result there isn't a test for that case. I have a set of changes that includes a test and fixes in all other integrations that increases the code coverage. Do you want me to include the changes in the PR or create a new one?

@dahjelle
Copy link
Contributor

dahjelle commented Sep 8, 2016

Does options still accept a Promise?

@nnance
Copy link
Contributor Author

nnance commented Sep 8, 2016

@dahjelle no it doesn't. I just realized that my example in the readme is wrong. If you look at the integration test you can get an idea of how it is used but now options include { path, route, apolloOptions } where apolloOptions can still be a promise. I will fix the example now.

@dahjelle
Copy link
Contributor

dahjelle commented Sep 8, 2016

I can confirm that it appears to address the issue in #123. Hooray! :-D

apolloOptions can still be a promise

Good enough for me!


function createErr(code: number, message: string) {
const err = Boom.create(code);
err.output.payload.message = message;
Copy link

@SimonDegraeve SimonDegraeve Sep 8, 2016

Choose a reason for hiding this comment

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

Why do we need this? The err.output.payload.message is derived from err.message

Boom.create(code, message)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

so I struggled with this for a while. When I use Boom.create(500, 'Something went wrong') the payload returned simply says Internal server error. I had to do this to change the message of the payload. Thoughts?

Choose a reason for hiding this comment

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

I just double check and you are right. For an error 500, the message is overwritten.
See https://github.com/hapijs/boom/blob/master/lib/index.js#L136-L138

@SimonDegraeve
Copy link

I like the use of the route prerequisites, it looks really clean.

Still I have a question, why using HAPI (uppercase) everywhere? It is not an acronym. On the project's website they always use lowercase.

@nnance
Copy link
Contributor Author

nnance commented Sep 8, 2016

@SimonDegraeve as I was using the all uppercase version I wondered which one was right. I agree I will lowercase hapi in my next commit.

@helfer
Copy link
Contributor

helfer commented Sep 9, 2016

This is awesome! As far as I'm concerned, we can merge this as soon as we have a corresponding PR on the docs, which shouldn't take more than 10 minutes of work.

🎉

@nnance nnance added this to the 0.3 milestone Sep 9, 2016
@nnance nnance self-assigned this Sep 9, 2016
@nnance
Copy link
Contributor Author

nnance commented Sep 9, 2016

@SimonDegraeve @helfer I have decided to handle the renaming of Hapi #129 and code coverage in separate pull requests. There are a couple of other changes that are tagged for the 0.3 release that I will be working on today as well. I will update the docs once all the 0.3 are complete.

@nnance nnance merged commit 40e8b55 into master Sep 9, 2016
@helfer helfer deleted the apollo-hapi branch September 20, 2016 03:46
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 23, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants