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

TS: Add edges to Patterns #506

Merged
merged 10 commits into from
Sep 21, 2021
Merged

TS: Add edges to Patterns #506

merged 10 commits into from
Sep 21, 2021

Conversation

lolopinto
Copy link
Owner

@lolopinto lolopinto commented Sep 20, 2021

TypeScript API to allow edges in Patterns.
Allows for reusable functionality e.g. feedback with likes and comments

This will be paired with corresponding change in golang

Included:

  • refactors src/scripts/read_schema.ts into src/parse_schema/parse.ts which can be independently tested
  • change AssocEdgeQueryBase to take a factory method which given the nodeType returns the correct load options which will be used to load the ent. Needed to support polymorphic edges where id2 can be different types
  • breaking change by making name in Pattern required
  • adds edgeConstName to AssocEdge and InverseAssocEdge so that the developer can specify what the generated edge should be called
  • changes read_schema script to output patterns and schemas which is a broken change because the go parsing code was only expecting patterns. need stronger dependencies btw tsent and @snowtop/ent versions

this breaking change needs to be tied to a new tsent version. don't have that yet but need to include that
@lolopinto lolopinto merged commit 1a704e4 into main Sep 21, 2021
@lolopinto lolopinto deleted the edges-in-patterns-ts branch September 21, 2021 06:56
This was referenced Sep 21, 2021
lolopinto added a commit that referenced this pull request Jan 25, 2022
fixes #694

* ParseSchema() in input.go was changed in #506 to support multiple ways to parse the schema because of a breaking change. that ended up masking issues if there was an error json marshalling. considering that was a while ago, simplify by no longer supporting the old way
* when nullable: false is passed, the following error is shown
```
  json: cannot unmarshal bool into Go struct field Action.schemas.actions.actionOnlyFields of type input.NullableItem
```
this is because JS version of the code supports multiple types but go doesn't. update the JS schema parsing to handle when nullable: false is passed. also fix a potential other scenario this could happen with polymorphic: false
* the way imports work in base file is wonky and since enum types have other imports that are needed, that wasn't being passed along
created #703 to fix the issue long term. did a workaround in the code generation to import the type
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant