[MDSAL-292] Pattern attribute ignored for leaf-list/leaf Created: 22/Sep/17  Updated: 22/Mar/18  Resolved: 22/Mar/18

Status: Resolved
Project: mdsal
Component/s: Binding codegen, Binding V2 codegen
Affects Version/s: None
Fix Version/s: None

Type: Bug
Reporter: Jie Han Assignee: Jie Han
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Operating System: All
Platform: All


Issue Links:
Duplicate
is duplicated by MDSAL-319 Binding V1 ignores leaf-restrcited types Resolved
External issue ID: 9198

 Description   

leaf/leaf-list should support string type with pattern.



 Comments   
Comment by Deepthi V V [ 22/Sep/17 ]

(In reply to Jie Han from comment #0)
> leaf/leaf-list should support string type with pattern.

Leaf supports it. Code is missing only for leaf-list.

Comment by Jie Han [ 22/Sep/17 ]

(In reply to Deepthi V V from comment #1)
> (In reply to Jie Han from comment #0)
> > leaf/leaf-list should support string type with pattern.
>
> Leaf supports it. Code is missing only for leaf-list.

Both v1 and v2, for yang snippet :
container apple {
leaf apple {
type string

{ pattern "[0-9]*"; }

}
}

and finally I get:
public AppleBuilder setApple(final java.lang.String value) {
if (value != null)

{ check_appleLength(value); }

this._apple = value;
return this;
}

so is there any difference ? could you please paste your yang?

Comment by Deepthi V V [ 22/Sep/17 ]

Jie, as I mentioned before leaf works fine. Try with leaf-list.

Comment by Robert Varga [ 22/Sep/17 ]

Looks like TypeProviderImpl is doing the wrong thing – it is not generating a restricted type to hold the leaf value. I would suggest looking around CompatUtils.compatLeafType() call sites.

Comment by Jie Han [ 06/Feb/18 ]

https://git.opendaylight.org/gerrit/67851
https://git.opendaylight.org/gerrit/67709
https://git.opendaylight.org/gerrit/67765

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