Closed AdCsoft closed 6 years ago
Can you reproduce this error and share an example where it isn’t working as expected? The code treats patterns as an array and ensures that every pattern is satisfied during validation. You can take a look at the code block for “string” typedef in src/lang/typedefs.coffee
Maybe the issue I saw was just related to: "[corenova/yang-js] wrong regexp generated in string pattern (typedef) (#67)" I'll close this one! :-)
when multiple patterns are associated to a string type in a typedef the last pattern overwrites the others... this is not RFC 6020 compliant: :-) ciao Andrea
RFC 6020 YANG October 2010
9.4.6. The pattern Statement
The "pattern" statement, which is an optional substatement to the "type" statement, takes as an argument a regular expression string, as defined in [XSD-TYPES]. It is used to restrict the built-in type "string", or types derived from "string", to values that match the pattern.
If the type has multiple "pattern" statements, the expressions are ANDed together, i.e., all such expressions have to match.
If a pattern restriction is applied to an already pattern-restricted type, values must match all patterns in the base type, in addition to the new patterns.