kafkas / typesync Goto Github PK
View Code? Open in Web Editor NEWAutogenerate Firestore model types for all platforms
Home Page: https://docs.typesync.org
License: GNU Affero General Public License v3.0
Autogenerate Firestore model types for all platforms
Home Page: https://docs.typesync.org
License: GNU Affero General Public License v3.0
We'll allow generating Zod schemas for a given definition.
The following definition doesn't produce an error when it should. Instead, the generator produces a simple union.
Pet:
model: alias
type:
type: union
discriminant: type
variants:
- type: object
fields:
type:
type:
type: literal
value: dog
breed:
type: string
- type: map
of: string
We'll be injecting validator functions into the specified firestore.rules
file.
Something like --custom-pydantic-base=x.y.MyModel
that would produce:
import x.y.MyModel
class TypesyncModel(x.y.MyModel):
...
class Example(TypesyncModel):
...
The additionalFields
config on object
types currently does not have an effect on Swift output.
Hi - thanks for creating this project, was looking for something to help with this exact use case as have a mixed Python BE and TS FE using Firestore with both.
Have a few feature ideas that I hope help make the library more useful (some of which already have open "Issues" so are hopefully planned):
map
as an Alias
, and then use that to a Document
- would be great to specify on the Document
directly (dup of #87?)Unknown
, or Any
type would be really useful for more freeform schemas (dup of #57?)Any
type) properties on a document, atm I am collecting them in a nested map but this makes the code more complexSome nice to haves in the future,
Pydantic
parent class or Config
SERVER_TIMESTAMP
Thanks!
This will let users create enums from object keys. May also provide a way to create enums from discriminant literals (tbd).
For Python, we're creating classes on the fly. We need to properly handle name clashes. E.g. if we're supposed to create UserCredentials
that already exists, we'll need to do something like UserCredentials2
We should allow documents to be modeled as a discriminated union.
For now, we should just do --outFile
Need to add this to the top of the file:
# yaml-language-server: $schema=https://json.schemastore.org/babelrc
Something like additionalFields: true
that will let the user add arbitrary keys to the objects.
Allow generating type aliases like
type ProjectsById = Record<string, Project>;
We already had this but I had to remove it when I was implementing the Python generator. Will need to reimplement.
Need to make sure definition/schema.ts
is consistent with definition/types.ts
. Can be done with tsd tests.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.