[NETCONF-737] ApiDoc generator fails to parse string types with pattern containing {isBasicLatin} Created: 28/Oct/20  Updated: 05/Nov/20  Resolved: 05/Nov/20

Status: Resolved
Project: netconf
Component/s: None
Affects Version/s: None
Fix Version/s: 1.13.0, Magnesium SR3, Aluminium SR2, Sodium SR4.1

Type: Bug Priority: High
Reporter: Michal Cmarada Assignee: Michal Cmarada
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

example typedef with failing pattern:

    typedef DisplayString {
        type string {
            length "0..255";
            pattern "((\p{IsBasicLatin}{0,255}))";
        }
    }

parsing this type fails with IllegalArgumentException and stops further processing of api docs.



 Comments   
Comment by Robert Varga [ 28/Oct/20 ]

Hmm, so it's Generex not grokking the pattern. Is this because it does not really support java.lang.Pattern (i.e. it has a similar, but different RegEx language) or because it is buggy?

Comment by Michal Cmarada [ 29/Oct/20 ]

even with replacing basic sets with propper replacement character sets like "((\\u0370-\\u03FF{5,255})$)" for "((
p{IsGreek}

{5,255}

)$) generex still fails to generate propper example. seems it cannot handle these types of unicode characters. however java regex pattern matching works so this seems to be a problem of generex implementation. I tried also rgxgen to generate example strings but it fails on unicode characters as well.

Comment by Robert Varga [ 29/Oct/20 ]

Right, so let's just catch the exception of it failing, log it and emit APIDOC without an example. That is better tna failing completely.

Comment by Michal Cmarada [ 29/Oct/20 ]

ok, actually its the Automaton (https://www.brics.dk/automaton/) that is failing inside Generex. it can handle only basic character ranges like [a-f] nothing more complex not even basic latin works [0x00-0x7f]. internaly it translates into its own RegExp and cannot determine correct range. The internal regex looks something like this "((((\x|\0)|[\0-\x])|\7)|\F)" which is completely useless for our case.

Generated at Wed Feb 07 20:15:46 UTC 2024 using Jira 8.20.10#820010-sha1:ace47f9899e9ee25d7157d59aa17ab06aee30d3d.