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

--graphql type name collision #73

Open
thomasdfischer opened this issue Jun 2, 2018 · 0 comments
Open

--graphql type name collision #73

thomasdfischer opened this issue Jun 2, 2018 · 0 comments
Labels
bug Something isn't working urgent
Milestone

Comments

@thomasdfischer
Copy link
Member

thomasdfischer commented Jun 2, 2018

Infer this JSON (to pretty-print it, pipe it into jq or schema translate or python -m json.tool) with --graphql:

{"templates":[{"name":"data","filePath":"data.csv","schema":{"filePath":""}},{"name":"config","filePath":"config.toml","schema":{"filePath":""}}],"instances":[{"filePath":"data-2000.csv","templateName":["data"],"schema":{"filePath":""}},{"filePath":"data-2001.csv","templateName":["data"],"schema":{"filePath":""}},{"filePath":"data-2002.csv","templateName":["data"],"schema":{"filePath":""}},{"filePath":"config_dev.toml","templateName":["config","data"],"schema":{"filePath":""}},{"filePath":"mysingletoner","templateName":["config"],"schema":{"filePath":""}}],"singletons":[{"filePath":".gitignore"}],"noGit":false}

schema infer --graphql yields this output:

type Schema {
    filePath: String!
}

type Templates {
    name: String!
    filePath: String!
    schema: Schema!
}

type Schema {
    filePath: String!
}

type Instances {
    templateName: [String!]!
    schema: Schema!
    filePath: String!
}

type Singletons {
    filePath: String!
}

type Object {
    templates: [Templates!]!
    instances: [Instances!]!
    singletons: [Singletons!]!
    noGit: Boolean!
}

which has two definitions of the Schema type.

To fix this bug, we need to

  1. If type collision happens AND the two types have the same exact fields, only output the type once
  2. If type collision happens AND the two types are different, rename one of the types
  3. Allow both of the above solutions to scale to any number of colliding types
@thomasdfischer thomasdfischer added bug Something isn't working urgent labels Jun 2, 2018
@thomasdfischer thomasdfischer added this to the MVP milestone Sep 8, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working urgent
Projects
None yet
Development

No branches or pull requests

1 participant