GithubHelp home page GithubHelp logo

Relationships (ie ID) about graphql-faker HOT 3 OPEN

graphql-kit avatar graphql-kit commented on May 15, 2024 1
Relationships (ie ID)

from graphql-faker.

Comments (3)

IvanGoncharov avatar IvanGoncharov commented on May 15, 2024

@jamesc892 It's very hard to generate "sane" data in a tool that doesn't know your application logic.
I can suggest two approaches:

  • you can restrict possible IDs by adding @examples(values: [22, 23]) to ID field
  • you can write a minimal GraphQL server with object having only id fields and use Faker in extend mode to add the rest: https://github.com/APIs-guru/graphql-faker#tldr

from graphql-faker.

jamesc892 avatar jamesc892 commented on May 15, 2024

Yeah I agree that sane data in its entirety would be out of scope. But for one off relationships, maybe not so much?

For context, we are trying to have on the fly introspection of our schema, and dynamically render faked data to avoid the need for engineers to do much from a configuration sense. Thinking thru the manual approach of restricting IDs and writing a minimal server to help were both scenarios we thought of, however they became a little too manual. We were hoping there was a flag that we could generate on our introspected schema to not rely on much static definition as we have a pretty robust API. We hoped something like a decorator @relationship(alias) that takes an alias that would link two ids together could be feasible. I think we've reached limitations of this and other tools we've tried.

We'll reconvene here, and possibly throw you a PR if we think thru an aliased relationship approach, if that sounds interesting to you.

from graphql-faker.

IvanGoncharov avatar IvanGoncharov commented on May 15, 2024

@jamesc892 If you can suggest some general mechanism that would be useful to other users then I have no problem merging your PR or implementing it myself.

At the moment it hard for me to understand your proposal so can you please describe your setup step by step:

  1. You are using --extend mode or fake entire schema?
  2. Can you please write simplified IDL/SDL?
  3. Please provide two queries (you mentioned in the initial comment) against faked API with conflicting IDs.

from graphql-faker.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.