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

Schema override parameter in ppx argument #82

Closed
wants to merge 3 commits into from
Closed

Schema override parameter in ppx argument #82

wants to merge 3 commits into from

Conversation

arnarthor
Copy link

@arnarthor arnarthor commented Jun 5, 2019

This adds an additional optional parameter to the ppx usage where you can locally override the desired schema to validate the query against.

This is fully backwards compatible with the old API and only extends it to allow for usage such as this

Reason

module MyQuery = [%graphql
  {|
    query pokemon($id: String, $name: String) {
      pokemon(name: $name, id: $id) {
        id
        name
      }
    }
  |};
  "pokedex_schema.json"
];

OCaml

module MyQuery = [%graphql
  {|
    query pokemon($id: String, $name: String) {
      pokemon(name: $name, id: $id) {
        id
        name
      }
    }
  |};;
  "pokedex_schema.json"
];

By adding this extra parameter, the PPX now supports having multiple different GraphQL APIs in a single project without the need for yarn workspaces or similar solutions.

If the parameter is skipped, it falls back to the default schema from the config (graphql_schema.json)

@idkjs
Copy link

idkjs commented Aug 28, 2019

@arnarthor how are you installing this in your projects?

I'm trying yarn add https://github.com/sothebys/graphql_ppx.git#schema-override-parameter-in-ppx-argument but not getting any luck.

@arnarthor
Copy link
Author

arnarthor commented Aug 28, 2019

@idkjs Yeah because it needs built artifacts you can't install it directly from this git repo (it has some pre publish builds on npm).

Use this commit https://github.com/sothebys/graphql_ppx.git#7f5b43ae0e79ee80474110f104fba1a3ac371be1

You can see it here (https://github.com/sothebys/graphql_ppx/commits/merged-remote) where we've pushed the built artifacts to git.

@idkjs
Copy link

idkjs commented Aug 28, 2019

Thank you, sir.
Second link is a dead link. Does that mean its been pushed or is the link wrong?

@idkjs
Copy link

idkjs commented Nov 23, 2019

@arnarthor any plans to move this to bsplatform 6.2.1?

@arnarthor
Copy link
Author

Yes, we have it on our roadmap at work to upgrade to 6.x in desember

@arnarthor
Copy link
Author

This implementation has been moved to the maintained graphql_ppx here

@arnarthor arnarthor closed this Aug 18, 2020
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

2 participants