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

key :is_type_of not found on Interface #1077

Closed
maennchen opened this issue Jun 2, 2021 · 1 comment
Closed

key :is_type_of not found on Interface #1077

maennchen opened this issue Jun 2, 2021 · 1 comment

Comments

@maennchen
Copy link
Contributor

If submitting a bug, please provide the following:

Environment

  • Elixir version (elixir -v):
Erlang/OTP 24 [erts-12.0] [source] [64-bit] [smp:6:6] [ds:6:6:10] [async-threads:1] [jit]

Elixir 1.12.0 (compiled with Erlang/OTP 22)
  • Absinthe version (mix deps | grep absinthe):
* absinthe 1.6.4 (Hex package) (mix)
  locked at 1.6.4 (absinthe) 6e9c1cf3
* absinthe_error_payload 1.0.1 (Hex package) (mix)
  locked at 1.0.1 (absinthe_error_payload) 03b30013
* absinthe_phoenix 2.0.1 (Hex package) (mix)
  locked at 2.0.1 (absinthe_phoenix) e773adc8
* absinthe_plug 1.5.8 (Hex package) (mix)
  locked at 1.5.8 (absinthe_plug) bbb04176
* absinthe_relay 1.5.1 (Hex package) (mix)
  locked at 1.5.1 (absinthe_relay) 1fd2a355
  • Client Framework and version (Relay, Apollo, etc): None yet

Expected behavior

When defining interface root / * interface* intermediate / object child and defining a is_type_of on the object, everything should work fine.

Actual behavior

     ** (KeyError) key :is_type_of not found in: %Absinthe.Type.Interface{__private__: [__absinthe_referenced__: true], __reference__: %{location: %{file: "/home/maennchen/Development/sustema/components/company-api/apps/sustema_company_api/lib/sustema_company_api/schema/company/alias.ex", line: 6}, module: Sustema.CompanyApi.Schema.Company.Alias}, definition: Sustema.CompanyApi.Schema.Company.Alias, description: nil, fields: %{__typename: %Absinthe.Type.Field{__private__: [], __reference__: %{location: %{file: "/home/maennchen/Development/sustema/components/company-api/deps/absinthe/lib/absinthe/phase/schema/introspection.ex", line: 74}, module: Absinthe.Phase.Schema.Introspection}, args: %{}, complexity: 0, config: 0, default_value: nil, definition: Absinthe.Phase.Schema.Introspection, deprecation: nil, description: "The name of the object type currently being queried.", identifier: :__typename, middleware: [{{Absinthe.Middleware, :shim}, {:company_alias, :__typename, [{:ref, Absinthe.Phase.Schema.Introspection, :typename}]}}], name: "__typename", triggers: %{}, type: :string}, company: %Absinthe.Type.Field{__private__: [], __reference__: %{location: %{file: "/home/maennchen/Development/sustema/components/company-api/apps/sustema_company_api/lib/sustema_company_api/schema/company/alias.ex", line: 11}, module: Sustema.CompanyApi.Schema.Company.Alias}, args: %{}, complexity: {:ref, Sustema.CompanyApi.Schema.Company.Alias, {Absinthe.Blueprint.Schema.FieldDefinition, {:company_alias, :company}}}, config: {:ref, Sustema.CompanyApi.Schema.Company.Alias, {Absinthe.Blueprint.Schema.FieldDefinition, {:company_alias, :company}}}, default_value: nil, definition: Sustema.CompanyApi.Schema.Company.Alias, deprecation: nil, description: nil, identifier: :company, middleware: [{{Absinthe.Middleware, :shim}, {:company_alias, :company, [{:ref, Sustema.CompanyApi.Schema.Company.Alias, {Absinthe.Blueprint.Schema.FieldDefinition, {:company_alias, :company}}}]}}], name: "company", triggers: {:ref, Sustema.CompanyApi.Schema.Company.Alias, {Absinthe.Blueprint.Schema.FieldDefinition, {:company_alias, :company}}}, type: %Absinthe.Type.NonNull{of_type: :company}}, id: %Absinthe.Type.Field{__private__: [], __reference__: %{location: %{file: "/home/maennchen/Development/sustema/components/company-api/apps/sustema_company_api/lib/sustema_company_api/schema/company/alias.ex", line: 7}, module: Sustema.CompanyApi.Schema.Company.Alias}, args: %{}, complexity: {:ref, Sustema.CompanyApi.Schema.Company.Alias, {Absinthe.Blueprint.Schema.FieldDefinition, {:company_alias, :id}}}, config: {:ref, Sustema.CompanyApi.Schema.Company.Alias, {Absinthe.Blueprint.Schema.FieldDefinition, {:company_alias, :id}}}, default_value: nil, definition: Sustema.CompanyApi.Schema.Company.Alias, deprecation: nil, description: nil, identifier: :id, middleware: [{{Absinthe.Middleware, :shim}, {:company_alias, :id, [{:ref, Sustema.CompanyApi.Schema.Company.Alias, {Absinthe.Blueprint.Schema.FieldDefinition, {:company_alias, :id}}}]}}], name: "id", triggers: {:ref, Sustema.CompanyApi.Schema.Company.Alias, {Absinthe.Blueprint.Schema.FieldDefinition, {:company_alias, :id}}}, type: %Absinthe.Type.NonNull{of_type: :id}}, inserted_at: %Absinthe.Type.Field{__private__: [], __reference__: %{location: %{file: "/home/maennchen/Development/sustema/components/company-api/apps/sustema_company_api/lib/sustema_company_api/schema/company/alias.ex", line: 10}, module: Sustema.CompanyApi.Schema.Company.Alias}, args: %{}, complexity: {:ref, Sustema.CompanyApi.Schema.Company.Alias, {Absinthe.Blueprint.Schema.FieldDefinition, {:company_alias, :inserted_at}}}, config: {:ref, Sustema.CompanyApi.Schema.Company.Alias, {Absinthe.Blueprint.Schema.FieldDefinition, {:company_alias, :inserted_at}}}, default_value: nil, definition: Sustema.CompanyApi.Schema.Company.Alias, deprecation: nil, description: nil, identifier: :inserted_at, middleware: [{{Absinthe.Middleware, :shim}, {:company_alias, :inserted_at, [{:ref, Sustema.CompanyApi.Schema.Company.Alias, {Absinthe.Blueprint.Schema.FieldDefinition, {:company_alias, :inserted_at}}}]}}], name: "inserted_at", triggers: {:ref, Sustema.CompanyApi.Schema.Company.Alias, {Absinthe.Blueprint.Schema.FieldDefinition, {:company_alias, :inserted_at}}}, type: %Absinthe.Type.NonNull{of_type: :datetime}}, name: %Absinthe.Type.Field{__private__: [], __reference__: %{location: %{file: "/home/maennchen/Development/sustema/components/company-api/apps/sustema_company_api/lib/sustema_company_api/schema/company/alias.ex", line: 8}, module: Sustema.CompanyApi.Schema.Company.Alias}, args: %{}, complexity: {:ref, Sustema.CompanyApi.Schema.Company.Alias, {Absinthe.Blueprint.Schema.FieldDefinition, {:company_alias, :name}}}, config: {:ref, Sustema.CompanyApi.Schema.Company.Alias, {Absinthe.Blueprint.Schema.FieldDefinition, {:company_alias, :name}}}, default_value: nil, definition: Sustema.CompanyApi.Schema.Company.Alias, deprecation: nil, description: nil, identifier: :name, middleware: [{{Absinthe.Middleware, :shim}, {:company_alias, :name, [{:ref, Sustema.CompanyApi.Schema.Company.Alias, {Absinthe.Blueprint.Schema.FieldDefinition, {:company_alias, :name}}}]}}], name: "name", triggers: {:ref, Sustema.CompanyApi.Schema.Company.Alias, {Absinthe.Blueprint.Schema.FieldDefinition, {:company_alias, :name}}}, type: %Absinthe.Type.NonNull{of_type: :string}}, updated_at: %Absinthe.Type.Field{__private__: [], __reference__: %{location: %{file: "/home/maennchen/Development/sustema/components/company-api/apps/sustema_company_api/lib/sustema_company_api/schema/company/alias.ex", line: 9}, module: Sustema.CompanyApi.Schema.Company.Alias}, args: %{}, complexity: {:ref, Sustema.CompanyApi.Schema.Company.Alias, {Absinthe.Blueprint.Schema.FieldDefinition, {:company_alias, :updated_at}}}, config: {:ref, Sustema.CompanyApi.Schema.Company.Alias, {Absinthe.Blueprint.Schema.FieldDefinition, {:company_alias, :updated_at}}}, default_value: nil, definition: Sustema.CompanyApi.Schema.Company.Alias, deprecation: nil, description: nil, identifier: :updated_at, middleware: [{{Absinthe.Middleware, :shim}, {:company_alias, :updated_at, [{:ref, Sustema.CompanyApi.Schema.Company.Alias, {Absinthe.Blueprint.Schema.FieldDefinition, {:company_alias, :updated_at}}}]}}], name: "updated_at", triggers: {:ref, Sustema.CompanyApi.Schema.Company.Alias, {Absinthe.Blueprint.Schema.FieldDefinition, {:company_alias, :updated_at}}}, type: %Absinthe.Type.NonNull{of_type: :datetime}}, versions: %Absinthe.Type.Field{__private__: [absinthe_relay: [{{:paginate, :both}, {:fill, Absinthe.Relay.Connection.Notation}}]], __reference__: %{location: %{file: "/home/maennchen/Development/sustema/components/company-api/apps/sustema_company_api/lib/sustema_company_api/schema/company/alias.ex", line: 13}, module: Sustema.CompanyApi.Schema.Company.Alias}, args: %{after: %Absinthe.Type.Argument{__reference__: nil, default_value: nil, definition: nil, deprecation: nil, description: nil, identifier: :after, name: "after", type: :string}, before: %Absinthe.Type.Argument{__reference__: nil, default_value: nil, definition: nil, deprecation: nil, description: nil, identifier: :before, name: "before", type: :string}, first: %Absinthe.Type.Argument{__reference__: nil, default_value: nil, definition: nil, deprecation: nil, description: nil, identifier: :first, name: "first", type: :integer}, last: %Absinthe.Type.Argument{__reference__: nil, default_value: nil, definition: nil, deprecation: nil, description: nil, identifier: :last, name: "last", type: :integer}}, complexity: {:ref, Sustema.CompanyApi.Schema.Company.Alias, {Absinthe.Blueprint.Schema.FieldDefinition, {:company_alias, :versions}}}, config: {:ref, Sustema.CompanyApi.Schema.Company.Alias, {Absinthe.Blueprint.Schema.FieldDefinition, {:company_alias, :versions}}}, default_value: nil, definition: Sustema.CompanyApi.Schema.Company.Alias, deprecation: nil, description: nil, identifier: :versions, middleware: [{{Absinthe.Middleware, :shim}, {:company_alias, :versions, [{:ref, Sustema.CompanyApi.Schema.Company.Alias, {Absinthe.Blueprint.Schema.FieldDefinition, {:company_alias, :versions}}}]}}], name: "versions", triggers: {:ref, Sustema.CompanyApi.Schema.Company.Alias, {Absinthe.Blueprint.Schema.FieldDefinition, {:company_alias, :versions}}}, type: :version_connection}}, identifier: :company_alias, interfaces: [:resource, :versioned_resource, :node], name: "CompanyAlias", resolve_type: {:ref, Sustema.CompanyApi.Schema.Company.Alias, {Absinthe.Blueprint.Schema.InterfaceTypeDefinition, :company_alias}}}

Relevant Schema/Middleware Code

copied together from various schemas, using absinthe_relay

node interface do
end

interface :resource do
  field :id, non_null(:id)
  field :inserted_at, non_null(:datetime)
  field :updated_at, non_null(:datetime)

  interface :node
end

interface :company_alias do
  field :id, non_null(:id)
  field :name, non_null(:string)
  field :updated_at, non_null(:datetime)
  field :inserted_at, non_null(:datetime)
  field :company, non_null(:company)

  connection field :versions, node_type: :version do
  end

  interface :node
  interface :versioned_resource
  interface :resource
end

connection(node_type: :company_alias)

node object(:company_alias_global) do
  field :name, non_null(:string)
  field :updated_at, non_null(:datetime)
  field :inserted_at, non_null(:datetime)
  field :company, non_null(:company)

  connection field :versions, node_type: :version do
  end

  interface :versioned_resource
  interface :resource
  interface :company_alias

  is_type_of &match?(%Sustema.Company.CompanyContext.Alias{visibility: :global}, &1)
end

connection(node_type: :company_alias_global)

node object(:company_alias_tenant) do
  field :name, non_null(:string)
  field :tenant, non_null(:string)
  field :updated_at, non_null(:datetime)
  field :inserted_at, non_null(:datetime)
  field :company, non_null(:company)

  connection field :versions, node_type: :version do
  end

  interface :versioned_resource
  interface :resource
  interface :company_alias

  is_type_of &match?(%Sustema.Company.CompanyContext.Alias{visibility: :tenant}, &1)
end

connection(node_type: :company_alias_tenant)
@maartenvanvliet
Copy link
Contributor

@tlvenn this issue can be closed I think with the merger of #1078

@tlvenn tlvenn closed this as completed Jan 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants