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

Interfaces implemented by schema root are not generated #2756

Closed
litso opened this issue Jan 6, 2023 · 2 comments · Fixed by #2816
Closed

Interfaces implemented by schema root are not generated #2756

litso opened this issue Jan 6, 2023 · 2 comments · Fixed by #2816
Assignees
Labels
bug Generally incorrect behavior codegen Issues related to or arising from code generation planned-next Slated to be included in the next release

Comments

@litso
Copy link

litso commented Jan 6, 2023

Summary

Interfaces that are implemented on the root note of a schema are not generated. Code generation does not produce any errors or warning but the generated code will not compile due to the missing interface.
I tried to produce a minimal schema and example query to illustrate the problem below.

The previous (non-swift) code generation tool did not have this issue.

Version

1.0.5

Steps to reproduce the behavior

Consider the following schema

interface MissingInterface {
  missingInterfaceString: String!
}

type Query implements MissingInterface {
  missingInterfaceString: String!
}

We have a one simple query defined in our project:

query fetchMyString {
  missingInterfaceString
}

After building and running the code generation tool for release 1.0.5 the generated query looks correct but in our Query type we are referencing an interface that was never generated causing a compilation error:

// @generated
// This file was automatically generated and should not be edited.

import ApolloAPI

public extension Objects {
  static let Query = Object(
    typename: "Query",
    implementedInterfaces: [Interfaces.MissingInterface.self] // <--- Compilation error since MissingInterface not generated
  )
}
@litso litso added bug Generally incorrect behavior needs investigation labels Jan 6, 2023
@AnthonyMDev
Copy link
Contributor

Hahah, what a cool bug! This should be an easy fix. Thanks for reporting it!

This is likely due some bug causing the JS frontend not collecting interfaces implemented by root types into the referencedTypes!

@calvincestari calvincestari added codegen Issues related to or arising from code generation and removed needs investigation labels Jan 6, 2023
@calvincestari calvincestari added this to the Patch Releases (1.0.x) milestone Jan 6, 2023
@calvincestari calvincestari added the planned-next Slated to be included in the next release label Feb 3, 2023
@calvincestari calvincestari self-assigned this Feb 3, 2023
@calvincestari
Copy link
Member

Hi @litso - this is fixed and will go out in the next patch release, 1.0.7.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Generally incorrect behavior codegen Issues related to or arising from code generation planned-next Slated to be included in the next release
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants