-
Notifications
You must be signed in to change notification settings - Fork 9
Open
Labels
Milestone
Description
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
- If type collision happens AND the two types have the same exact fields, only output the type once
- If type collision happens AND the two types are different, rename one of the types
- Allow both of the above solutions to scale to any number of colliding types