Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

string length validation doesn't work for the entry "" in case it has default value specified #563

Open
EvgeniiVR opened this issue Oct 3, 2024 · 1 comment

Comments

@EvgeniiVR
Copy link
Contributor

EvgeniiVR commented Oct 3, 2024

Hello team,
I've noticed that validate of the string length doesn't work for the entry "" in case leaf has default value.
let's say we have simple yang

  container c1 {
    leaf l1 {
      type string {
        length "1..127";
      }
      default "somestring";
    }
  }
> set c1 l1 ""
> show configuration
<c1 xmlns="urn:com:example:yang:test">
   <l1/>
</c1>
> show configuration default report-all
<c1 xmlns="urn:com:example:yang:test">
   <l1/>
</c1>

Null string overrides the default value but validate/commit doesn't respond with error caused by string length.
Is it expected behavior or not?
As in this case xml_body returns null. So we can't rely on yang and need to double-check element value just not to face with segfault or smth like that under certain circumstances.

@olofhagsand olofhagsand added the bug label Oct 4, 2024
olofhagsand added a commit that referenced this issue Nov 1, 2024
@olofhagsand
Copy link
Member

Fixed in validate.
Please verify

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

No branches or pull requests

2 participants