[YANGTOOLS-1097] Boolean/String union parsing results in wrong type Created: 17/Apr/20 Updated: 12/Jan/21 Resolved: 17/Apr/20 |
|
| Status: | Resolved |
| Project: | yangtools |
| Component/s: | codecs |
| Affects Version/s: | None |
| Fix Version/s: | 5.0.0 |
| Type: | Bug | Priority: | Medium |
| Reporter: | Robert Varga | Assignee: | Robert Varga |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||
| Description |
|
When we are presented with the following model:
module foo {
leaf foo {
type union {
type boolean;
type string;
}
}
}
we end up interpreting input string "TRUE" as a valid boolean and hence normalize it to the wrong value – and really end up transforming the value when transmitting it to wire, as we turn it into "true". |
| Comments |
| Comment by Robert Varga [ 17/Apr/20 ] |
|
The problem is that we are violating RFC7950 section 9.5.1: 9.5.1. Lexical Representation The lexical representation of a boolean value is a string with a value of "true" or "false". These values MUST be in lowercase. hence we end up accepting "TRUE" as a valid value and do not skip over to string. |