question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error: Type abc was defined more than once.

See original GitHub issue

Hi,

I am facing some strange issue when running linter on multiple graphql schema. I have multiple schema in my directory. I can have same type/enum there when we consider two schema files. If one schema has “abc” type then second schema can also have same type.

This is my configuration to run linter:

  "lint-staged": {
    "modules/*/graphql-schema/consolidate.gql": [
      "graphql-schema-linter"
    ]
  },
  "graphql-schema-linter": {
    "rules": [
      "defined-types-are-used"
    ]
  } 

In case of, for example type abc exists in two schema files then I am getting an error when running linting. Can we avoid this by defining any rules ?

Error: Type "abc" was defined more than once.
at buildASTSchema (C:\Users\ajaysaini\AppData\Local\Yarn\config\global
ode_modules\graphql\utilities\buildASTSchema.js:111:17)
at validateSchemaDefinition (C:\Users\ajaysaini\AppData\Local\Yarn\config\global
ode_modules\graphql-schema-linter\lib\validator.js:18:51)
at run (C:\Users\ajaysaini\AppData\Local\Yarn\config\global
ode_modules\graphql-schema-linter\lib\runner.js:51:54)
at Object.<anonymous> (C:\Users\ajaysaini\AppData\Local\Yarn\config\global
ode_modules\graphql-schema-linter\lib\cli.js:15:32)
at Module._compile (module.js:573:30)
at Object.Module._extensions..js (module.js:584:10)
at Module.load (module.js:507:32)
at tryModuleLoad (module.js:470:12)
at Function.Module._load (module.js:462:3)
× graphql-schema-linter found some errors. Please fix them and try committing again.
at Function.Module.runMain (module.js:609:10)

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
cjoudreycommented, Feb 11, 2018

I added some clarity around lint-staged to the README in https://github.com/cjoudrey/graphql-schema-linter/commit/a23434eef7a56e100911809a875daac33df7520c to cover the above issue.

I’m going to close this issue for now. Feel free to re-open if you think this is still a problem.

1reaction
cjoudreycommented, Feb 8, 2018

Before adding a new option flag to support multiple schemas to graphql-schema-linter I’d like to make sure this is a common use-case as it will add complexity.

In the meantime a workaround could be to define them each individually in lint-staged:

  "lint-staged": {
    "modules/schema_1/graphql-schema/consolidate.gql": [
      "graphql-schema-linter"
    ],
    "modules/schema_2/graphql-schema/consolidate.gql": [
      "graphql-schema-linter"
    ]
  },
Read more comments on GitHub >

github_iconTop Results From Across the Web

How to fix Error: Type "Extra" was defined more than once in ...
SOLUTION. Problem corrected using the concept of interfaces and defining types in the same file. const resolvers = require('.
Read more >
SML/NJ Error Messages
This error occurs when type constructors with incompatible equality properties are equated by sharing constraints. When this happens, the signature is not ...
Read more >
Statistics: What are Type 1 and Type 2 Errors? - AB Tasty
Type 1 errors – often assimilated with false positives – happen in hypothesis testing when the null hypothesis is true but rejected.
Read more >
Resolve the "Parameter validation failed" error in AWS ...
When I create or update my AWS CloudFormation stack, I get the following error: "Parameter validation failed: parameter value 'abc' for ...
Read more >
Common issues and solutions - mypy 0.991 documentation
Redefinitions with incompatible types​​ Each name within a function only has a single 'declared' type. You can reuse for loop indices etc., but...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found