Uploaded image for project: 'Hibernate Validator'
  1. Hibernate Validator
  2. HV-819

Add an API/SPI which allows to make the process of value retrieval customizable

    Details

    • Type: New Feature
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 5.1.0.Alpha1
    • Fix Version/s: 5.1.0.Beta1
    • Component/s: engine
    • Labels:
      None
    • Last commented by a user?:
      true

      Description

      I have an object like:

      UIInput<String> name
      

      The value is retrieved by calling String value = name.getValue();, however, my intention is to use the BV annotations:

      @Size(min=3, max=10)
      UIInput<String> name
      

      The problem is that an javax.validation.UnexpectedTypeExceptionHV000030: No validator could be found for type: org.jboss.forge.addon.ui.input.UIInput<java.lang.String> is thrown. This is correct according to the spec, since I don't intend to
      validate UIInput, but the value itself.

      This is also useful in JavaFX, where you have StringProperty instead of plain Strings etc

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

              Hide
              gunnar.morling Gunnar Morling added a comment - - edited

              Hi George, I can confirm that this is a bug within HV. Currently, registered value unwrappers are only invoked for Validator#validate() and the methods for executable validation but not for validateProperty() and validateValue() (which you are using). I've created HV-860 for fixing this.

              Btw. HV 5.x needs an EL implementation on the classpath; So I tried to add one as test dependency to bean-validation-tests/pom.xml but when running the test the class still was missing. Is there anything special to consider when adding dependencies here?

              Show
              gunnar.morling Gunnar Morling added a comment - - edited Hi George, I can confirm that this is a bug within HV. Currently, registered value unwrappers are only invoked for Validator#validate() and the methods for executable validation but not for validateProperty() and validateValue() (which you are using). I've created HV-860 for fixing this. Btw. HV 5.x needs an EL implementation on the classpath; So I tried to add one as test dependency to bean-validation-tests/pom.xml but when running the test the class still was missing. Is there anything special to consider when adding dependencies here?
              Hide
              gastaldi George Gastaldi added a comment -

              You need to add the dependency to the bean-validation/addon/pom.xml or add
              in the ForgeArchive in the Arquillian test

              Show
              gastaldi George Gastaldi added a comment - You need to add the dependency to the bean-validation/addon/pom.xml or add in the ForgeArchive in the Arquillian test
              Hide
              gunnar.morling Gunnar Morling added a comment -

              Hey George, I've submitted a PR for HV-860; Either you build HV yourself based on that branch or you wait until the issue has been merged and the snapshot has been deployed to Nexus. validateValue() applies now unwrappers as expected.

              Show
              gunnar.morling Gunnar Morling added a comment - Hey George, I've submitted a PR for HV-860 ; Either you build HV yourself based on that branch or you wait until the issue has been merged and the snapshot has been deployed to Nexus. validateValue() applies now unwrappers as expected.
              Hide
              gastaldi George Gastaldi added a comment -

              Awesome! Will try with the latest snapshot when it's available. When is the next release coming up?
              Thanks!

              Show
              gastaldi George Gastaldi added a comment - Awesome! Will try with the latest snapshot when it's available. When is the next release coming up? Thanks!
              Hide
              hardy.ferentschik Hardy Ferentschik added a comment -

              Will try with the latest snapshot when it's available.

              Should be there now

              When is the next release coming up?

              Max a couple of weeks. We want to get 5.1.0.Final out of the door asap.

              Show
              hardy.ferentschik Hardy Ferentschik added a comment - Will try with the latest snapshot when it's available. Should be there now When is the next release coming up? Max a couple of weeks. We want to get 5.1.0.Final out of the door asap.

                People

                • Votes:
                  0 Vote for this issue
                  Watchers:
                  3 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved:

                    Development