-
Notifications
You must be signed in to change notification settings - Fork 8
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
fix: validate project config #1955
Conversation
213a13d
to
fbe94b9
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to update the root ftl-project.toml
for FTL as well?
I'm torn by the need to give the project a name when using ftl init
but I guess it's inline with other tools like npm init
.
@@ -61,7 +61,7 @@ func tempConfigPath(t *testing.T, existingPath string, prefix string) string { | |||
var existing []byte | |||
var err error | |||
if existingPath == "" { | |||
existing = []byte{} | |||
existing = []byte("name = \"generated\"") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: You might be able to use backticks here:
`name = "generated"`
@@ -47,6 +47,26 @@ func (c Config) Root() string { | |||
return filepath.Dir(c.Path) | |||
} | |||
|
|||
// Validate checks that the configuration is valid. | |||
func (c Config) Validate() error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need a test for this one, or is it covered by other tests that use Create
?
This was done in a previous PR: #1952 👍 |
b5db7a2
to
0b15159
Compare
Validates project config files.
This breaks previous cases where
ftl config set
and similar would be able to create the project toml if it wasn't already created. Now that a project's name is required, an invalid project config would have been created.It is now a requirement to go through
ftl init <name> <dir>