{"action":"created","issue":{"url":"https://api.github.com/repos/mbj4668/pyang/issues/260","repository_url":"https://api.github.com/repos/mbj4668/pyang","labels_url":"https://api.github.com/repos/mbj4668/pyang/issues/260/labels{/name}","comments_url":"https://api.github.com/repos/mbj4668/pyang/issues/260/comments","events_url":"https://api.github.com/repos/mbj4668/pyang/issues/260/events","html_url":"https://github.com/mbj4668/pyang/issues/260","id":174021296,"node_id":"MDU6SXNzdWUxNzQwMjEyOTY=","number":260,"title":"Unique statement not checked for nodes inside choice","user":{"login":"szabolcsszekely","id":7726783,"node_id":"MDQ6VXNlcjc3MjY3ODM=","avatar_url":"https://avatars3.githubusercontent.com/u/7726783?v=4","gravatar_id":"","url":"https://api.github.com/users/szabolcsszekely","html_url":"https://github.com/szabolcsszekely","followers_url":"https://api.github.com/users/szabolcsszekely/followers","following_url":"https://api.github.com/users/szabolcsszekely/following{/other_user}","gists_url":"https://api.github.com/users/szabolcsszekely/gists{/gist_id}","starred_url":"https://api.github.com/users/szabolcsszekely/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/szabolcsszekely/subscriptions","organizations_url":"https://api.github.com/users/szabolcsszekely/orgs","repos_url":"https://api.github.com/users/szabolcsszekely/repos","events_url":"https://api.github.com/users/szabolcsszekely/events{/privacy}","received_events_url":"https://api.github.com/users/szabolcsszekely/received_events","type":"User","site_admin":false},"labels":[{"id":187848343,"node_id":"MDU6TGFiZWwxODc4NDgzNDM=","url":"https://api.github.com/repos/mbj4668/pyang/labels/Priority-Medium","name":"Priority-Medium","color":"ededed","default":false},{"id":187848342,"node_id":"MDU6TGFiZWwxODc4NDgzNDI=","url":"https://api.github.com/repos/mbj4668/pyang/labels/Type-Defect","name":"Type-Defect","color":"ededed","default":false},{"id":187848335,"node_id":"MDU6TGFiZWwxODc4NDgzMzU=","url":"https://api.github.com/repos/mbj4668/pyang/labels/bug","name":"bug","color":"fc2929","default":true}],"state":"open","locked":false,"assignee":{"login":"llhotka","id":381993,"node_id":"MDQ6VXNlcjM4MTk5Mw==","avatar_url":"https://avatars1.githubusercontent.com/u/381993?v=4","gravatar_id":"","url":"https://api.github.com/users/llhotka","html_url":"https://github.com/llhotka","followers_url":"https://api.github.com/users/llhotka/followers","following_url":"https://api.github.com/users/llhotka/following{/other_user}","gists_url":"https://api.github.com/users/llhotka/gists{/gist_id}","starred_url":"https://api.github.com/users/llhotka/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/llhotka/subscriptions","organizations_url":"https://api.github.com/users/llhotka/orgs","repos_url":"https://api.github.com/users/llhotka/repos","events_url":"https://api.github.com/users/llhotka/events{/privacy}","received_events_url":"https://api.github.com/users/llhotka/received_events","type":"User","site_admin":false},"assignees":[{"login":"llhotka","id":381993,"node_id":"MDQ6VXNlcjM4MTk5Mw==","avatar_url":"https://avatars1.githubusercontent.com/u/381993?v=4","gravatar_id":"","url":"https://api.github.com/users/llhotka","html_url":"https://github.com/llhotka","followers_url":"https://api.github.com/users/llhotka/followers","following_url":"https://api.github.com/users/llhotka/following{/other_user}","gists_url":"https://api.github.com/users/llhotka/gists{/gist_id}","starred_url":"https://api.github.com/users/llhotka/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/llhotka/subscriptions","organizations_url":"https://api.github.com/users/llhotka/orgs","repos_url":"https://api.github.com/users/llhotka/repos","events_url":"https://api.github.com/users/llhotka/events{/privacy}","received_events_url":"https://api.github.com/users/llhotka/received_events","type":"User","site_admin":false}],"milestone":null,"comments":3,"created_at":"2016-08-30T13:38:00Z","updated_at":"2018-11-06T11:09:59Z","closed_at":null,"author_association":"NONE","body":"If I add a unique statement for a node inside a choice statement, the generated schema contains wrong path.\n\n```\n$ cat main.yang \nmodule main {\n    yang-version 1;\n    namespace \"http://example.com/main\";\n    prefix main;\n\n    container my-container {\n        list my-list {\n            key name;\n            unique \"unique-test/a/parameter-1\";\n            leaf name {\n                type string;\n            }\n            choice unique-test {\n                case a {\n                    leaf parameter-1 {\n                        type string;\n                    }\n                }\n                case b {\n                    leaf parameter-2 {\n                        type string;\n                    }\n                }\n            }\n        }\n    }\n}\n$ cat test.xml \n<?xml version='1.0' encoding='UTF-8'?>\n<config xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\">\n    <my-container xmlns=\"http://example.com/main\">\n        <my-list>\n            <name>elem-1</name>\n            <parameter-1>para-1</parameter-1>\n        </my-list>\n        <my-list>\n            <name>elem-2</name>\n            <parameter-1>para-1</parameter-1>\n        </my-list>\n        <my-list>\n            <name>elem-3</name>\n            <parameter-2>para-1</parameter-2>\n        </my-list>\n    </my-container>\n</config>\n$ yang2dsdl -t config -v test.xml main.yang \n== Generating RELAX NG schema './main-config.rng'\nDone.\n\n== Generating Schematron schema './main-config.sch'\nDone.\n\n== Generating DSRL schema './main-config.dsrl'\nDone.\n\n== Validating grammar and datatypes ...\ntest.xml validates.\n\n== Adding default values... done.\n\n== Validating semantic constraints ...\nNo errors found.\n```\n\nThe error-message should be this:\nViolated uniqueness for \"main:unique-test/main:a/main:parameter-1\"\n\nI think the problem is that the generated main-config.sch file contains this rule:\n`<sch:report test=\"preceding-sibling::main:my-list[main:unique-test/main:a/main:parameter-1=current()/main:unique-test/main:a/main:parameter-1]\">Violated uniqueness for &quot;main:unique-test/main:a/main:parameter-1&quot;</sch:report>`\ninstead of this:\n`<sch:report test=\"preceding-sibling::main:my-list[main:parameter-1=current()/main:parameter-1]\">Violated uniqueness for &quot;main:unique-test/main:a/main:parameter-1&quot;</sch:report>`\n\nIf I change the rule to the second one the uniqueness of parameter-1 is checked.\n\npyang version: pyang 1.7 (on commit 0528aa8 - Martin Björklund, 4 days ago : Fixes #259 - multiple bases in identity)\n"},"comment":{"url":"https://api.github.com/repos/mbj4668/pyang/issues/comments/436216550","html_url":"https://github.com/mbj4668/pyang/issues/260#issuecomment-436216550","issue_url":"https://api.github.com/repos/mbj4668/pyang/issues/260","id":436216550,"node_id":"MDEyOklzc3VlQ29tbWVudDQzNjIxNjU1MA==","user":{"login":"szabolcsszekely","id":7726783,"node_id":"MDQ6VXNlcjc3MjY3ODM=","avatar_url":"https://avatars3.githubusercontent.com/u/7726783?v=4","gravatar_id":"","url":"https://api.github.com/users/szabolcsszekely","html_url":"https://github.com/szabolcsszekely","followers_url":"https://api.github.com/users/szabolcsszekely/followers","following_url":"https://api.github.com/users/szabolcsszekely/following{/other_user}","gists_url":"https://api.github.com/users/szabolcsszekely/gists{/gist_id}","starred_url":"https://api.github.com/users/szabolcsszekely/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/szabolcsszekely/subscriptions","organizations_url":"https://api.github.com/users/szabolcsszekely/orgs","repos_url":"https://api.github.com/users/szabolcsszekely/repos","events_url":"https://api.github.com/users/szabolcsszekely/events{/privacy}","received_events_url":"https://api.github.com/users/szabolcsszekely/received_events","type":"User","site_admin":false},"created_at":"2018-11-06T11:09:59Z","updated_at":"2018-11-06T11:09:59Z","author_association":"NONE","body":"Hi,\r\nCan you check this proposed correction? https://github.com/mbj4668/pyang/pull/434\r\nthanks,\r\nSzabolcs"}}
{"actor":{"display_login":"szabolcsszekely"}}