Replies: 1 comment 2 replies
-
The alternative is to have a |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Background and Motivation
Now in most client bindings, the codegen have 2 modes for selecting the output path:
.edgeql
file gets an individual generated file sitting side-by-side.--file
to get a single generated file for all.edgeql
files inside the project directory. Some bindings allow specifying a path.The default mode is not always the most suitable approach [1], the alternative single-file mode doesn't fulfill users' needs in particularly the Python binding ([2], [3]). The EdgeDB team is also discussing where to put the file by default [4].
Considering about the relative consistency of DX among client bindings, it might make sense to enhance the single-file mode to something more flexible.
Proposal
The idea is to merge the 2 modes, and use stub files to customize the codegen behavior. By default, we still generate separate files next to each
.edgeql
files, unless stub files are found under the project directory.Stub files have a fixed file name
.edgedb-codegen
, can be placed multiple times in any sub-directory inside the project directory. The content of a stub file is a path to a file where generated code will be written. The path is relative to the stub file itself. The codegen will recursively use all.edgeql
files under the directory enclosing the stub file to generate code. All.edgeql
files will be included in at least 1 generated file - if no stub file is found in any parent folders, a separate file will be generated next to the.edgeql
file - this is just the default mode.Examples
(Borrowing @abbazs's sample from geldata/gel-python#411.)
movies
is not using a sub file:Potentially the stub file could also include other modifier instructions (like prefix), but I think we should start simple, especially when the upcoming type descriptor annotation may give codegen more information.
Beta Was this translation helpful? Give feedback.
All reactions