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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

ogent / ent - type generation problems #2477

Closed
thmeitz opened this issue Apr 15, 2022 · 3 comments
Closed

ogent / ent - type generation problems #2477

thmeitz opened this issue Apr 15, 2022 · 3 comments

Comments

@thmeitz
Copy link
Contributor

thmeitz commented Apr 15, 2022

  • [ x ] The issue is present in the latest release.
  • [ x ] I have searched the issues of this repository and believe that this is not a duplicate.

Current Behavior 馃槸

  1. ogent generates wrong type
    schema.go definition field.Uint32("id").StorageKey("client_id"),
    ogent generates int32 type
  • see: one of the 600 errors in the example repo
  1. ent generation problem if table contains table column
  1. ent generation problem if table name is client
    renamed schema to customer in example repo. rename it back to client and you'll get a go generate error
  2. ogent req.TmpData.Get undefined (type []byte has no field or method Get)
  1. Follow-up error in openapi.json - generates also int32 type

Expected Behavior 馃

  1. expecting type uint32
  2. expecting thats using a pre- or suffix? dont have an idea how we should fix this
  3. expecting thats working (see 2.)
  4. NewOptByteSlice should be generated
  5. expecting uint32 in openapi.json

Steps to Reproduce 馃暪

Steps:

  1. checkout the repo ispent

Your Environment 馃寧

Tech Version
Go 1.18
Ent v0.10.2-0.20220321093754-edd968490ea2
@a8m
Copy link
Member

a8m commented Apr 15, 2022

Thanks for reporting this issue @thmeitz 馃檹

One of us will give it a look next week.

@masseelch
Copy link
Collaborator

Hey @thmeitz,

  1. OpenAPI does not allow unsigned integers. However, for unsigned int we should add a min value of 0 and fix the bug you detected.
  2. The llinked PR now skips generation of the Table predicate
  3. Some keywords are used internally, Client being one of them. I extended the documentation to mention this as well.
  4. Fixed in the linked PR
  5. See 1

@masseelch
Copy link
Collaborator

@thmeitz The lates master of each (ent, contrib, ogent) have now all the issues resolved. I saw your issue in entimport and will make sure we address that one soon as well :-)

If you need anything more, don't hesitate to ask.

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

No branches or pull requests

3 participants