lolopinto / ent

MIT License
51 stars 6 forks source link

Couple minor errors with pattern generation #1792

Closed Swahvay closed 6 months ago

Swahvay commented 7 months ago

Two minor things.

1) The mixin interface doesn't default to the Viewer specified in ent.yml:

export interface ISomePattern<TViewer extends Viewer = Viewer>
  extends ISomePatternBase<TViewer>

should be

export interface ISomePattern<TViewer extends MyCustomViewer = MyCustomViewer>
  extends ISomePatternBase<TViewer>

(The base should also be ISomePatternBase<TViewer extends MyCustomViewer = MyCustomViewer>.)

2) Field edges and foreign keys loaders do not get defined on pattern interfaces. Edges defined on the pattern generate queryFoo interfaces correctly, but fieldEdges or foreignKeys defined on a field in a pattern do not generate the loadFoo or queryFoo method definitions on the interface.

lolopinto commented 7 months ago

for 2, looks like i decided to go from the other direction since it would have been a 1/1 mapping in the case of the fieldEdge and foreignKey?

probably because i didn't think it was worth it, not sure?

lolopinto commented 7 months ago

for 1/, fixed in https://github.com/lolopinto/ent/pull/1800

non-base classes would have to be fixed manually.

lolopinto commented 7 months ago

I just realized I completely misunderstood #2. 🤦🏿‍♂️

Swahvay commented 7 months ago

for 1/, fixed in https://github.com/lolopinto/ent/pull/1800

non-base classes would have to be fixed manually.

No problem! Thanks for getting to this. 🙂