Closed rhengles closed 3 years ago
Describe the bug I created a .jdl file and used the "pattern()" validator in some entities properties, example:
acronym String minlength(2) maxlength(3) pattern(/^[a-z]+$/)
When running the project I get this error:
[Nest] 1213 - 04/03/2021, 12:39:12 PM [ExceptionsHandler] Invalid flags supplied to RegExp constructor '^[a-z]+$' +16ms
This is the issue and this is the pull request about this issue.
To Reproduce Steps to reproduce the behavior:
Expected behavior No error and validate the property value correctly against the pattern and modifier if present
Screenshots If applicable, add screenshots to help explain your problem.
Desktop (please complete the following information):
NHipster configuration
ddsoft@0.0.1-SNAPSHOT /mnt/d/dev/ddsoft/jh-sistema-online ├─┬ generator-jhipster-nodejs@1.5.0 │ └── generator-jhipster@6.8.0 deduped └── generator-jhipster@6.8.0
##### **Environment and Tools** openjdk version "11.0.10" 2021-01-19 OpenJDK Runtime Environment (build 11.0.10+9-Ubuntu-0ubuntu1.20.04) OpenJDK 64-Bit Server VM (build 11.0.10+9-Ubuntu-0ubuntu1.20.04, mixed mode, sharing) git version 2.25.1 node: v14.16.0 npm: 7.7.5 Docker version 20.10.5, build 55c4c88 docker-compose version 1.28.5, build c4eb3a1f INFO! Congratulations, JHipster execution is complete!
{ "generator-jhipster": { "authenticationType": "jwt", "cacheProvider": "ehcache", "clientFramework": "react", "serverPort": "8080", "serviceDiscoveryType": false, "skipUserManagement": false, "baseName": "ddsoft", "buildTool": "maven", "databaseType": "sql", "devDatabaseType": "h2Disk", "enableHibernateCache": true, "enableSwaggerCodegen": false, "enableTranslation": true, "jhiPrefix": "jhi", "languages": ["en", "fr"], "messageBroker": false, "nativeLanguage": "en", "prodDatabaseType": "mysql", "searchEngine": false, "skipClient": false, "testFrameworks": ["protractor"], "websocket": false, "applicationType": "monolith", "packageName": "com.ddsoft", "packageFolder": "com/ddsoft", "jhipsterVersion": "6.8.0", "creationTimestamp": 1617226440079, "skipServer": true, "clientPackageManager": "npm", "clientTheme": "none", "clientThemeVariant": "", "useSass": true, "jwtSecretKey": "bXktc2VjcmV0LXRva2VuLXRvLWNoYW5nZS1pbi1wcm9kdWN0aW9uLWFuZC10by1rZWVwLWluLWEtc2VjdXJlLXBsYWNl", "embeddableLaunchScript": false, "entitySuffix": "", "dtoSuffix": "DTO", "otherModules": [ { "name": "generator-jhipster-nodejs", "version": "1.5.0" } ], "blueprints": [ { "name": "generator-jhipster-nodejs", "version": "1.5.0" } ] }, "entities": [ "Observacao", "UnidadeMedida", "NomeTipo", "Genero", "DocumentoPessoa", "DocumentoEmpresa", "DadoContato", "Local", "Condominio", "EntidadeLocais", "RegistroConselho", "PessoaRegistroConselho", "Pessoa", "Empresa", "Funcionario", "PessoaRelacao", "Publicidade", "Cliente", "Praga", "ProdutoPesticida", "ProdutoUso", "Material", "MaterialUso", "Equipamento", "EquipamentoUso", "ServicoAcao", "Servico" ] }
entity Observacao { texto TextBlob required } entity UnidadeMedida { nome String required maxlength(32), abrev String maxlength(8), tipo TipoUnidade } entity NomeTipo { nome String required maxlength(64), validoDe LocalDate, validoAte LocalDate, tipo TipoNome required } entity Genero { nome String required maxlength(64) } entity DocumentoPessoa { numero String required maxlength(32), tipo TipoDocumentoPessoa required } entity DocumentoEmpresa { numero String required maxlength(32), tipo TipoDocumentoEmpresa required } entity DadoContato { contato String required maxlength(128), tipo TipoDadoContato } entity Local { tipo TipoLocal required, sigla String minlength(2) maxlength(3) pattern(/^[a-z]+$/), nome String required maxlength(64), contato String maxlength(32), codigoPostal String maxlength(12) } entity Condominio { nome String required maxlength(48) } entity EntidadeLocais { validoDe LocalDate, validoAte LocalDate, identificacao String maxlength(32), cobranca Boolean, servico Boolean } entity RegistroConselho { sigla String required maxlength(8) } entity PessoaRegistroConselho { registro String required maxlength(16), complemento String maxlength(32) } entity Pessoa { nascimento LocalDate, sexo Sexo } entity Empresa entity Funcionario { admissao LocalDate, demissao LocalDate, cargo String maxlength(32), tipo TipoFuncionario } entity PessoaRelacao { tipo TipoRelacao } entity Publicidade { nome String required maxlength(64) } entity Cliente { sequencia Integer required unique } entity Praga { nome String required maxlength(32), nomeCientifico String maxlength(64) } entity ProdutoPesticida { nomeComercial String required maxlength(32), nomeTecnico String maxlength(64), grupoQuimico String maxlength(32), toxicidade String maxlength(32), acaoToxica String maxlength(32), antidoto String maxlength(32), numRegistro String maxlength(24) } entity ProdutoUso { quantidade Float, variacao Boolean, obrigatorio Boolean } entity Material { nome String required maxlength(32) } entity MaterialUso { quantidade Float, variacao Boolean, obrigatorio Boolean } entity Equipamento { nome String required maxlength(64) } entity EquipamentoUso { obrigatorio Boolean } entity ServicoAcao { variacao Boolean, obrigatorio Boolean } entity Servico { nome String required maxlength(64), garantiaTempo Integer, garantiaUnidade UnidadePeriodo, precoPadrao Integer } enum TipoUnidade { VOLUME, PESO, COMPRIMENTO, UNIDADE, EMBALAGEM } enum TipoNome { NOME_COMPLETO, NOME_COMUM, NOME_SOCIAL, APELIDO, NOME_FANTASIA, RAZAO_SOCIAL } enum TipoDocumentoPessoa { CPF, RG, CNH, TITULO_ELEITOR, SERVICO_MILITAR, PASSAPORTE, OUTRO } enum TipoDocumentoEmpresa { CNPJ, INSCRICAO_ESTADUAL, INSCRICAO_MUNICIPAL, NIRE, ALVARA, LICENSA_ANVISA, OUTRO } enum TipoDadoContato { TELEFONE, EMAIL, LINK, FAX } enum TipoLocal { CONTINENTE, PAIS, PAIS_REGIAO, ESTADO, ESTADO_MESO, ESTADO_MICRO, MUNICIPIO, DISTRITO, BAIRRO, LOGRADOURO, LOGRADOURO_NUMERO, COMPLEMENTO } enum Sexo { MASCULINO, FEMININO } enum TipoFuncionario { SOCIO_DIRETOR, SOCIO, RESPONSAVEL_TECNICO, FUNCIONARIO } enum TipoRelacao { MARIDO, ESPOSA, NAMORADO, NAMORADA, PAI, MAE, PADRASTO, MADRASTA, FILHO, FILHA, AFILHADO, AFILHADA, AVO_M, AVO_F, NETO, NETA, TIO, TIA, PRIMO, PRIMA, SOBRINHO, SOBRINHA, SOGRO, SOGRA, NORA, GENRO, CUNHADO, CUNHADA, RESPONSAVEL_LEGAL, PARENTE_OUTRO, AMIGO, COLEGA_TRABALHO, COLEGA_ESCOLA, CONHECIDO } enum UnidadePeriodo { ANOS, MESES, SEMANAS, DIAS, HORAS, MINUTOS } relationship OneToOne { DocumentoPessoa{obs} to Observacao, DocumentoEmpresa{obs} to Observacao, DadoContato{obs} to Observacao, Local{obs} to Observacao, Condominio{obs} to Observacao, Condominio{local} to Local, EntidadeLocais{local} to Local, RegistroConselho{empresa} to Empresa{registroConselho}, PessoaRegistroConselho{registroConselho} to RegistroConselho{pessoaRegistroConselho}, Pessoa{obs} to Observacao, Empresa{obs} to Observacao, Funcionario{obs} to Observacao, Funcionario{pessoa} to Pessoa{funcionario}, PessoaRelacao{obs} to Observacao, Publicidade{obs} to Observacao, Cliente{obs} to Observacao, Cliente{pessoa} to Pessoa{cliente}, Cliente{empresa} to Empresa{cliente}, ProdutoPesticida{obs} to Observacao, ProdutoPesticida{fabricante} to Empresa, ProdutoUso{instrucoes} to Observacao, ProdutoUso{obs} to Observacao, Material{obs} to Observacao, MaterialUso{instrucoes} to Observacao, MaterialUso{obs} to Observacao, Equipamento{obs} to Observacao, EquipamentoUso{instrucoes} to Observacao, EquipamentoUso{obs} to Observacao, ServicoAcao{instrucoes} to Observacao, ServicoAcao{obs} to Observacao } relationship OneToMany { Pessoa{nomeTipo} to NomeTipo{pessoa}, Empresa{nomeTipo} to NomeTipo{empresa}, Pessoa{documentoPessoa} to DocumentoPessoa{pessoa}, Empresa{documentoEmpresa} to DocumentoEmpresa{empresa}, Pessoa{dadoContato} to DadoContato{pessoa}, Empresa{dadoContato} to DadoContato{empresa}, Pessoa{entidadeLocais} to EntidadeLocais{pessoa}, Empresa{entidadeLocais} to EntidadeLocais{empresa}, Pessoa{pessoaRegistroConselho} to PessoaRegistroConselho{pessoa}, Empresa{funcionario} to Funcionario{empresa}, ProdutoPesticida{praga} to Praga{produtoPesticida} } relationship ManyToOne { Local{dentroDe(nome)} to Local, Pessoa{genero} to Genero, PessoaRelacao{pessoaDe} to Pessoa, PessoaRelacao{pessoaPara} to Pessoa, Cliente{publicidade} to Publicidade, ProdutoPesticida{unidade} to UnidadeMedida, ProdutoUso{produto} to ProdutoPesticida, ProdutoUso{servicoAcao} to ServicoAcao, Material{medida} to UnidadeMedida, MaterialUso{material} to Material, MaterialUso{servicoAcao} to ServicoAcao, EquipamentoUso{equipamento} to Equipamento, EquipamentoUso{servicoAcao} to ServicoAcao, ServicoAcao{servico} to Servico }
INFO! Using JHipster version installed locally in current project's node_modules INFO! No custom sharedOptions found within blueprint: generator-jhipster-nodejs at /mnt/d/dev/ddsoft/jh-sistema-online/node_modules/generator-jhipster-nodejs INFO! Executing jhipster:info INFO! Options: from-cli: true (node:1417) Warning: Accessing non-existent property 'cat' of module exports inside circular dependency (Use `node --trace-warnings ...` to show where the warning was created) (node:1417) Warning: Accessing non-existent property 'cd' of module exports inside circular dependency (node:1417) Warning: Accessing non-existent property 'chmod' of module exports inside circular dependency (node:1417) Warning: Accessing non-existent property 'cp' of module exports inside circular dependency (node:1417) Warning: Accessing non-existent property 'dirs' of module exports inside circular dependency (node:1417) Warning: Accessing non-existent property 'pushd' of module exports inside circular dependency (node:1417) Warning: Accessing non-existent property 'popd' of module exports inside circular dependency (node:1417) Warning: Accessing non-existent property 'echo' of module exports inside circular dependency (node:1417) Warning: Accessing non-existent property 'tempdir' of module exports inside circular dependency (node:1417) Warning: Accessing non-existent property 'pwd' of module exports inside circular dependency (node:1417) Warning: Accessing non-existent property 'exec' of module exports inside circular dependency (node:1417) Warning: Accessing non-existent property 'ls' of module exports inside circular dependency (node:1417) Warning: Accessing non-existent property 'find' of module exports inside circular dependency (node:1417) Warning: Accessing non-existent property 'grep' of module exports inside circular dependency (node:1417) Warning: Accessing non-existent property 'head' of module exports inside circular dependency (node:1417) Warning: Accessing non-existent property 'ln' of module exports inside circular dependency (node:1417) Warning: Accessing non-existent property 'mkdir' of module exports inside circular dependency (node:1417) Warning: Accessing non-existent property 'rm' of module exports inside circular dependency (node:1417) Warning: Accessing non-existent property 'mv' of module exports inside circular dependency (node:1417) Warning: Accessing non-existent property 'sed' of module exports inside circular dependency (node:1417) Warning: Accessing non-existent property 'set' of module exports inside circular dependency (node:1417) Warning: Accessing non-existent property 'sort' of module exports inside circular dependency (node:1417) Warning: Accessing non-existent property 'tail' of module exports inside circular dependency (node:1417) Warning: Accessing non-existent property 'test' of module exports inside circular dependency (node:1417) Warning: Accessing non-existent property 'to' of module exports inside circular dependency (node:1417) Warning: Accessing non-existent property 'toEnd' of module exports inside circular dependency (node:1417) Warning: Accessing non-existent property 'touch' of module exports inside circular dependency (node:1417) Warning: Accessing non-existent property 'uniq' of module exports inside circular dependency (node:1417) Warning: Accessing non-existent property 'which' of module exports inside circular dependency Welcome to the JHipster Information Sub-Generator
Additional context Add any other context about the problem here.
@rhengles thanks for the feedback. I have fixed it and updated the test integration jdl model according the field pattern.
Describe the bug I created a .jdl file and used the "pattern()" validator in some entities properties, example:
When running the project I get this error:
This is the issue and this is the pull request about this issue.
To Reproduce Steps to reproduce the behavior:
Expected behavior No error and validate the property value correctly against the pattern and modifier if present
Screenshots If applicable, add screenshots to help explain your problem.
Desktop (please complete the following information):
NHipster configuration
JHipster Version(s)
.yo-rc.json file
JDL entity definitions
Extra logs from `jhipster info`
Additional context Add any other context about the problem here.