Migrating to a new ORM is not an easy process, and the transition cost can be prohibitive to many organizations. As much as we developers are enamoured by "Shiny New Things", the truth is that we rarely get a chance to work on a truly "green-field" project. Most of our careers, we operate in contexts where many technical and business constraints (a.k.a legacy systems) dictate and limit our options for moving forward. Developers of new technologies that want to succeed must offer interoperability capability and integration paths to help organizations seamlessly transition to a new way of solving an existing problem.
To help lower the cost of transitioning to Ent (or simply experimenting with it), we have started the
"Schema Import Initiative" to help support many use cases for generating Ent schemas from external resources.
The centrepiece of this effort is the
schemast package (source code,
docs) which enables developers to easily write programs that generate
and manipulate Ent schemas. Using this package, developers can program in a high-level API, relieving them from worrying
about code parsing and AST manipulations.
The first project to use this new API, is
protoc plugin to generate Ent schemas from
files (docs). Organizations that have existing
schemas defined in Protobuf can use this tool to generate Ent code automatically. For example, taking a simple
And setting the
ent.schema.gen option to true:
Developers can invoke the standard
protoc (protobuf compiler) command to use this plugin:
To generate Ent schemas from these definitions:
To start using
protoc-gen-ent today, and read about all of the different configuration options, head over to
Do you have schemas defined elsewhere that you would like to automatically import in to Ent? With the
package, it is easier than ever to write the tool that you need to do that. Not sure how to start? Want to collaborate
with the community in planning and building out your idea? Reach out to our great community via our
Slack channel or start a discussion on GitHub!