Migration v1.0 – Compilation error: Type does not conform to protocol 'SelectionSet'

I’m trying to migrate from 0.43.0 to 1.0.5, but I’m facing some issues.

I’ve gone through the migration guide using SPM, the Install CLI approach, and defined a custom apollo-codegen-config.json using the embeddedInTarget option (and other app specific settings), generated the code and imported all files to the target.

The issue (at least one of them) is that I get this compilation error inside the generated files:

Type ‘Schema.MaterialFields’ does not conform to protocol ‘SelectionSet’

The suggested fix is to provide a type alias for Schema.

What’s going wrong here? I’ve looked through the docs and searched for similar issues but no results.

Thank you for any help :pray:

Hi @rudsberg - :wave:

It’s difficult to pinpoint without seeing more of your configuration options. What are you using for schema-name?

It looks like your schema-name is actually just Schema, which might be causing a compilation error since the SelectionSet protocol has a typealias Schema. This it probably confusing the compiler here.

@rudsberg can you try changing your schema name to something else like MyProjectSchema to see if that fixes it?

If that’s the case, then we need to either add additional validation to indicate that “Schema” is not a valid name, or fix the API to allow this to compile.

1 Like