Skip to content

Colliding type names are not handled correctly #1307

Open
@axos88

Description

@axos88
  struct Mutation {
    sub: submodule::Mutation
  }

  #[grapql_object()]
  impl Mutation {
    fn sub(&self) -> &submodule::Mutation { &self.sub }
  }

  mod submodule {
    struct Mutation;
  
    #[grapql_object()]
    impl Mutation {
      fn foo() -> String { String::new() }
    }
  }

Currently translates Mutation and submodule::Mutation to the same graphql type named Mutation, the resulting schema being:

type Mutation {
  sub: Mutation!
}

My expected behavior would be to either error out in this case, or have the ability to either always, or on collision include the module names in the auto-generated type names.

Note that including the module path only is not bulletproof either, my current setup has the Mutation and the [Sub]Mutation defined in different crates, in the top module, so including the crate name may be required too - but the error currently occurs with submodules within a single crate too.

Metadata

Metadata

Assignees

Labels

k::apiRelated to API (application interface)k::designRelated to overall design and/or architecturesupport

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions