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

Javascript client code generator #1

Open
pierremrtn opened this issue Oct 3, 2024 · 2 comments
Open

Javascript client code generator #1

pierremrtn opened this issue Oct 3, 2024 · 2 comments

Comments

@pierremrtn
Copy link
Owner

Add support for generating Javascript client

@MrAlek
Copy link

MrAlek commented Nov 12, 2024

Or rather Typescript. A simple Interface would suffice and would be way easier compared to the current Dart implementation.

Example:

export interface User {
  firstName: string
  lastName: string
  email?: string
}

Caveats are with types for set/update where there for instance is FieldValue.serverTimestamp() and FieldValue.arrayUnion() which would force to have a separate interface input interfaces.

Example:

export interface UserInput {
  firstName: string
  lastName: string
  email?: string
  friends: FieldValue
  lastUpdatedAt: FieldValue
}

export interface User extends UserInput {
  friends: DocumentReference<User>[]
  lastUpdatedAt: Timestamp
}

@pierremrtn
Copy link
Owner Author

Ideally I would like to support both.
It's been years since I've almost didn't write any JS beyond simple functions, so I'll need a refresher before working on this. I'll align as much as possible on real-world clients code available publicly or other generators if any.
I've heard some people are using the Zod parser, which might be an interesting option.

Right now I'm finalizing #6, which involves heavy underlying data structure changes. I'll get back to working on generators once it's done.

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

2 participants