-
Notifications
You must be signed in to change notification settings - Fork 348
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
Refactor odata handler #2473
Refactor odata handler #2473
Conversation
|
d518ad2
to
4f2928f
Compare
@habbes Could you rebase the conflicts then I can merge this :) |
4b3d5c5
to
8e8006d
Compare
39e5048
to
7ef75ea
Compare
faf42fd
to
a1c915a
Compare
c3c0b9e
to
696f9c7
Compare
72ed5cd
to
fbf068b
Compare
b78fdb4
to
a1bfc49
Compare
Sorry for the late response! |
🚨 IMPORTANT: Please do not create a Pull Request without creating an issue first.
Any change needs to be discussed before proceeding. Failure to do so may result in the rejection of the pull request.
Description
Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change.
This PR does not introduce any changes in functionality or bug fixes. It does a bit of refactoring in the OData handler to make the code easier to navigate and make changes to. The motivation for this PR is that there are a couple of bug fixes and changes that I would like to contribute but have heard a hard time navigating the code since it's all in one large file.
I've split the code into separate files, the main ones being:
index.ts
: still contains theODataHandler
class, but imports a lot of functionality from the other modulesrequest-processing.ts
: helper functions for processing requests/responses from the OData serviceschema-builder.ts
: contains aGraphQLSchemaBuilder
class that encasulates the GraphQL schema generation logic. The original code has also been split into separate methods that each handle generation of a specific schema element.There's still room for improvement, but I think this is sufficient to work with, and further improvements can be made gradually when necessary when adding features/fixes.
Fixes #2466
Type of change
Please delete options that are not relevant.
Screenshots/Sandbox (if appropriate/relevant):
Adding links to sandbox or providing screenshots can help us understand more about this PR and take action on it as appropriate
How Has This Been Tested?
Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration
yarn test odata
Test Environment:
@graphql-mesh/odata
: 0.11.8Checklist:
There's a snapshot test case in
examples/odata-trippin
that fails on my machine. This test was failing before I made changes to the repo. I am not sure why it fails, when I console.log the object being tested and manually compare it to the snapshot it's being compared to, it seems to match. I'm running the test using the following command:yarn test odata
Further comments
If this is a relatively large or complex change, kick off the discussion by explaining why you chose the solution you did and what alternatives you considered, etc...