Skip to content

Regular expression property attribute regexp not working #799

Closed

Description

@gramian

ArcadeDB Version: v23.1.1 (build aa687e4/1673895089679/main)

JDK Version: openjdk 11.0.17 2022-10-18

OS: MacOS 12.6

The regexp property seems to not work (at least via studio or console). This may just be a formatting issue of the regex string, which is not documented yet.

Expected behavior

succesful insert.

Actual behavior

ERROR: The property 'url' does not match the regular expression 'regexp'. Field value is: a, document: @doc[url=a]

Steps to reproduce

CREATE DOCUMENT TYPE doc;
CREATE PROPERTY doc.str STRING (regexp '.*');
INSERT INTO doc SET str = 'a';

Activity

  1. gramian commented on Jan 27, 2023

    @gramian
    CollaboratorAuthor

    @lvca Could you provide an example of a string property with regexp constraint which should work, to rule out a simple formatting issue on my side and as a test case? Thank you

  2. lvca commented on Jan 27, 2023

    @lvca
    Member

    I found this in our test cases:

      @Test
      public void testRegExpValidation() {
        final DocumentType clazz = database.getSchema().createDocumentType("Validation");
        clazz.createProperty("string", Type.STRING).setRegexp("[^Z]*");
    
        final MutableDocument d = database.newDocument(clazz.getName());
        d.set("string", "yeah");
        d.validate();
    
        checkFieldValue(d, "string", "yaZah"); // <-- VALIDATION EXCEPTION EXPECTED
      }
  3. gramian commented on Jan 27, 2023

    @gramian
    CollaboratorAuthor

    Yeah found that too, but it did not work for me via studio or console if I remember correctly.

  4. lvca commented on Jan 27, 2023

    @lvca
    Member

    Maybe there is something from SQL. I'm writing a new test case for it.

  5. gramian commented on Jan 27, 2023

    @gramian
    CollaboratorAuthor

    Thank you!

  6. lvca commented on Jan 27, 2023

    @lvca
    Member

    Reproduced with CREATE PROPERTY. Checking the issue and a quick fix.

  7. lvca commented on Jan 27, 2023

    @lvca
    Member

    Fixed. Also I found setting the regexp and other attributes were missing from the ALTER PROPERTY command.

  8. added this to the 23.1.2 milestone on Jan 27, 2023
  9. self-assigned this
    on Jan 27, 2023
  10. gramian commented on Jan 27, 2023

    @gramian
    CollaboratorAuthor

    My initial tests works now with the expected syntax. Great! Thanks @lvca

  11. lvca commented on Jan 28, 2023

    @lvca
    Member

    Great! Thanks for the report

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions