For the following JDL descrpition:
The JDL String pattern(/^[^@\s]+@[^@\s]+\.[^@\s]+$/) throws liquid base error when loading fake data.
Reason: liquibase.exception.UnexpectedLiquibaseException: CSV file config/liquibase/fake-data/centro_de_actividad.csv Line 2 has 7 values defined, Header has 5. Numbers MUST be equal (check for unquoted string with embedded commas)
The attached centro_de_actividad.txt CSV of fake data is produced, which gives the error, I believe because a ; is generated in the email field:
This is the first row of the centro_de_actividad.csv
id;nombre;telefono;nombre_de_contacto;email_de_contacto
1;New York tangible Mississippi;Frozen bus;hard drive Robust Networked;7`fPr4Ps]-8c:1DV<UDz_a>dCnD>HTw">f58Aaw(X'Xbna;J2)15v_z%AIu8d=lA%{W/R}hsJm7cP@F=?#_dVFX=tt$Ncc1+2}{*,_n|WfRcyHrI?zRPHa.Dc0JC8/c9V\DE?oeO}a}>UY
I wanted to validate email, and found that regular expression on the web.
Import the following JDL
entity CentroDeActividad {
nombre String required,
telefono String,
nombreDeContacto String,
emailDeContacto String pattern(/^[^@\s]+@[^@\s]+\.[^@\s]+$/)
}
v6.2.0
Use the JDL from above
entityName.json files generated in the .jhipster directoryUse the JDL from above
Windows 10 / WSL
I moved the issue to the generator repository as the bug and fix will be here.
The issue is that the regex pattern generation in the fake-data/table.csv.ejs template can generate semicolons double quotes if the regex pattern allows. Double quotes are used around the generated regex string so it thinks there should be more columns. Solution is to escape the quotes.
@poolebu Until this is fixed, a simple workaround is to exclude semicolons from the email address regex.
Update: The semicolon issue is fixed in v6.3.0 but there's a different issue now.
Got it! Thank You @ruddell , I did that and it works wonders.
Most helpful comment
I moved the issue to the generator repository as the bug and fix will be here.
The issue is that the regex pattern generation in the fake-data/table.csv.ejs template can generate
semicolonsdouble quotes if the regex pattern allows. Double quotes are used around the generated regex string so it thinks there should be more columns. Solution is to escape the quotes.@poolebu Until this is fixed, a simple workaround is to exclude semicolons from the email address regex.
Update: The semicolon issue is fixed in v6.3.0 but there's a different issue now.