Closed ryankauk closed 4 years ago
Was this intentional?
Nope! Am taking a look now in addition to #22.
Can you also explain why it's using a forked version of @graphql-codegen/near-operation-file-preset?
What are your thoughts on a more programmatic approach for the templates? Instead of using handlebars possibly using something like DeclarationBlock from @graphql-codegen/visitor-plugin-common.
I built printers for most of dart, (ie. class, constructor, function, enum and property), I think it would be easier to follow the code that way.
new ClassPrinter('ToJson').withFlag('abstract')
.addClassMethod(new FunctionPrinter('toJson', {}).withType('Map<String, dynamic>'));
and possibly utilize the graphql visit function https://graphql-code-generator.com/docs/custom-codegen/using-visitor
I find it hard to figure out where the properties are coming from in the handlebars template.
1.11.0
gql_code_gen
is mature enough to where if I were to do that large of a refactor, I'd probably look into just porting everything into a pure dart generatorso, I've fixed the compilation issue you're running into, but discovered that inline fragments are actually totally broken right now. The example compiles, hero
only has the shared name
field. Also, idk how to make json serializable will handle the union to/from json logic
Great thank you I'll check it out, Also can you explain what you mean by "pure dart generator"?
I'd probably look into just porting everything into a pure dart generator
So, if we had a generator implemented in dart using gql_code_gen
or artemis
, then it could be integrated into dart's regular code generation pipeline and not depend on npm/node, which would be nice.
1.1.5-beta
fixes this specific issue - made #24 to track the harder issues
Hey I'm having issues with a union type, the operation class is using addAll that does not exist in the schema type's class which does not appear in the union template. Was this intentional? If you could explain some direction I can do the fix if needed. As well there's a syntax error when not constructor inputs exists you get
Looking at the example it seems to work with the union since there's an interface they're both implementing, maybe it doesn't work when the union doesn't have an interface.
You can reproduce the error with the example with gql: