apollo-kotlin
apollo-kotlin copied to clipboard
Generated test builders calls resolve without enum list
Summary
When generating test builders the generated code is invalid as it calls MapBuilder#resolve that requires a list of enum values. The generated code looks like this:
Example 1:
public override fun build(): Map<String, Any?> = mapOf(
"myType" to resolve("myType",
MyType.type.notNull().list().notNull(), { myType() }),
)
Example 2:
public override fun build(): Map<String, Any?> = mapOf(
"myTypeField" to resolve("myTypeField", CompiledStringType),
)
Version
3.5.0 and main. Havent checked earlier versions
Steps to reproduce the behavior
- Generate test builders for your schema
Let me know if you need more info. I tried fixing it, but gradle is difficult to make work properly so this report will suffice :)
Thanks for sending this 🙏 . We're currently hard at work reworking these builders as they have a few shortcomings as you just found out. The work is tracked in https://github.com/apollographql/apollo-kotlin/issues/4016. If you feel like it, the latest SNAPSHOTs have a preliminary version of the new APIs that you can enable with generateDataBuilders:
apollo {
generateDataBuilders.set(true)
}
Documentation is not written yet but feel free to follow up in that thread and we'll be happy to guide you through the new API.
Closing for now as the schema based data builders have been available. Don't hesitate to re-open if needed!