Skip to content
This repository has been archived by the owner on Feb 24, 2024. It is now read-only.

No validation in generators #870

Closed
kamilgregorczyk opened this issue Jan 22, 2018 · 7 comments
Closed

No validation in generators #870

kamilgregorczyk opened this issue Jan 22, 2018 · 7 comments
Assignees
Labels
enhancement New feature or request help wanted Feel free to contribute!

Comments

@kamilgregorczyk
Copy link

I just did
buffalo g r name,body and it generated wrong files, it would be good to have 1. Validation 2. A confirm check if we really want to create/roll back it it there were some errors.

@kamilgregorczyk
Copy link
Author

The same for buffalo g r name body

@kamilgregorczyk
Copy link
Author

Here's a pastebin https://pastebin.com/E2rk93DS

@markbates markbates added help wanted Feel free to contribute! Feature Request labels Feb 1, 2018
@hubyhuby
Copy link

hubyhuby commented Mar 10, 2018

A BIG +1 for this feature
From a beginner stand point, you end up doing a lot of what I call "frankenstein apps" to boot with:)
I did maybe 20 buffalo apps just to understand what is working and not working. Basically copying a line of "buffalo g" again and again looking at the resulting app.

What I read is that by default Buffalo passes everything he doesn t understand to the underlying database (it is a documented behavior, feature not a bug :) )
The net result of the conjunction of : not having warnings + passing everything to the database, is "frankenstein apps"

Then you start to make your own rules of thumbs, it seems that uint doesn t work, that putting some uppercase letter doesn t work sometimes, that sometimes having "_" doesn t work ... (which I am sure all have good reasons)

I see two things that could work (as @kamilgregorczyk proposed):

  • Validation with Warnings
  • If a warning arise a question: "Do you feel lucky ?!"
    (- A last option would be not to pass to the underlying BDD things and have an)

This is a usefull feature for

  • freshers that may spend 1-2 days doing frankensteins
  • People wanting to add resources to an existing project and don t want to brake it

@forrest321
Copy link
Contributor

@kamilgregorczyk From the pastebin, line 15 references two files:

models/name,body.go models/name,body_test.go

Do those files exist as named? The commas in the filenames are causing the errors that begin on line 16.

@kamilgregorczyk
Copy link
Author

Yes, these we created by buffalo g r name body

@forrest321
Copy link
Contributor

forrest321 commented Mar 23, 2018

I would suggest deleting those files and any references to them. While it looks like the filesystems involved are ok with the name, filenames containing commas are against common conventions and will cause untold problems for you going forward.

After a little digging, it looks like an update of your buffalo code will solve the issue. Pastebin of my test run here: https://pastebin.com/tbAiPmWJ Note the version number on line 11: v4.2.2, where your pastebin is using v3.51.1 , also line 11.

Delete those files containing commas in the name. Update buffalo with the following:

go get -u github.com/gobuffalo/buffalo/...

And try your generates again. There have been several fixes and improvements in the code since the version you are using.

@stanislas-m
Copy link
Member

Should be fixed since gobuffalo/pop#231

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request help wanted Feel free to contribute!
Projects
None yet
Development

No branches or pull requests

5 participants