Skip to content

Cryptic warning when generating an input with not fields #223

@rgraff

Description

@rgraff

Describe the bug
When you have an input resource with no fields, you get a cryptic warning:

warning: Embedded type MyApp.SomeUnionType.SomeSubType does not have an input type defined, but is accepted as input in at least one location.
  (ash_graphql 1.3.2) lib/resource/resource.ex:4296: AshGraphql.Resource.do_field_type/5
  (ash_graphql 1.3.2) lib/resource/resource.ex:3293: anonymous fn/4 in AshGraphql.Resource.union_type_definitions/6
  (elixir 1.17.2) lib/enum.ex:1703: Enum."-map/2-lists^map/1-1-"/2
  (ash_graphql 1.3.2) lib/resource/resource.ex:3287: AshGraphql.Resource.union_type_definitions/6
  (elixir 1.17.2) lib/enum.ex:4353: Enum.flat_map_list/2
  (elixir 1.17.2) lib/enum.ex:4354: Enum.flat_map_list/2

To Reproduce
In my particular instance, I was scaffolding out a new UnionType and its various SubTypes but I hadn't defined any attributes yet and had an empty accepts

Expected behavior
A warning that says it can't define an input type without at least one input attribute.

** Runtime

  • Elixir version
  • Erlang version
  • OS
  • Ash version
  • any related extension versions

Additional context
Add any other context about the problem here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions