jhipster / jhipster-core

JHipster Domain Language, used by JHipster UML and JDL-Studio to generate entities
Apache License 2.0
346 stars 116 forks source link

jhipster Pattern does not work properly #471

Closed lucke-01 closed 4 years ago

lucke-01 commented 4 years ago

jhipster pattern does not work properly.

I think this should work the same way you code pattern in java this way you should not have to modify your pattern.

I have this:

entity A {
  webUrl String pattern(/^(https?|ftp|file)://[-a-zA-Z0-9+&@#/%?=~_|!:,.;]*[-a-zA-Z0-9+&@#/%=~_|]/),
}

And in my import-jdl i get this:

Error during import-jdl: unexpected character: ->/<- at offset: 814, skipped 2 c
haracters.
MathieuAA commented 4 years ago

@lucke-01 hello there.

I think this should work the same way you code pattern in java this way you should not have to modify your pattern. There are two issues here with this opinion:

  • JHipster (and the JDL parsing part) is written in JS, which has a different regexp system than the Java one, so the behaviors will likely never be the same
  • There are more than one backend, not just Java: node, .net, etc.

Here's the fixed JDL:

entity A {
  webUrl String pattern(/^(https?|ftp|file):\/\/[-a-zA-Z0-9+&@#/%?=~_|!:,.;]*[-a-zA-Z0-9+&@#/%=~_|]/),
}