Re: [yang-doctors] List key model definition order and results w/ pyang/yanglint

Ebben Aries <exa@juniper.net> Tue, 30 January 2018 01:12 UTC

Return-Path: <exa@juniper.net>
X-Original-To: yang-doctors@ietfa.amsl.com
Delivered-To: yang-doctors@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 97583131985 for <yang-doctors@ietfa.amsl.com>; Mon, 29 Jan 2018 17:12:46 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.7
X-Spam-Level:
X-Spam-Status: No, score=-2.7 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (2048-bit key) header.d=juniper.net
Received: from mail.ietf.org ([4.31.198.44]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id XOSO5gV1bxFT for <yang-doctors@ietfa.amsl.com>; Mon, 29 Jan 2018 17:12:44 -0800 (PST)
Received: from mx0b-00273201.pphosted.com (mx0b-00273201.pphosted.com [67.231.152.164]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id E012B131994 for <yang-doctors@ietf.org>; Mon, 29 Jan 2018 17:12:33 -0800 (PST)
Received: from pps.filterd (m0108160.ppops.net [127.0.0.1]) by mx0b-00273201.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w0U18p7n031818; Mon, 29 Jan 2018 17:12:32 -0800
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=juniper.net; h=date : from : to : cc : subject : message-id : references : mime-version : content-type : in-reply-to; s=PPS1017; bh=jAc0iFV9GvagGCaazjXHU6erpYUwVlK0SmLECkj3/YY=; b=OnrIZbRLrwgiFgivf4Z7NcVFqynfkW38yM+yPRJFBjS7dTgBgc51emJE5wEmEDt3BkcP GEDPs/Qcl85EYkvNrXbog5K61tYypPvllVkGgzv2X5ZHOKnT253DTPyko0sFYg08gzGQ hhQ678BSoIXZyUg4wmVyZEVsbt2knid0Ovdb5T+whrKcOQ0+P0S2BmVo5HJNTlqqQrOg L02K7c2czKoa1MudzDBpY1QInWaqGhZWmAt0fKSPjPmiT+XvZAg4wLyeeds6WtbvQa1N rpvdy1fo4O4OyU979YkCIVGYxfHda7itkprUHcbCJv8d32oe1VEhBonEcStmZq9CfR5C JA==
Received: from nam01-by2-obe.outbound.protection.outlook.com (mail-by2nam01lp0178.outbound.protection.outlook.com [216.32.181.178]) by mx0b-00273201.pphosted.com with ESMTP id 2ftdgdg5df-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Mon, 29 Jan 2018 17:12:31 -0800
Received: from CO2PR05CA0082.namprd05.prod.outlook.com (10.166.88.178) by BY2PR0501MB2069.namprd05.prod.outlook.com (10.163.197.151) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.464.6; Tue, 30 Jan 2018 01:12:30 +0000
Received: from DM3NAM05FT013.eop-nam05.prod.protection.outlook.com (2a01:111:f400:7e51::202) by CO2PR05CA0082.outlook.office365.com (2603:10b6:102:2::50) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.464.6 via Frontend Transport; Tue, 30 Jan 2018 01:12:29 +0000
Received-SPF: SoftFail (protection.outlook.com: domain of transitioning juniper.net discourages use of 66.129.239.15 as permitted sender)
Received: from P-EMFE01C-SAC.jnpr.net (66.129.239.15) by DM3NAM05FT013.mail.protection.outlook.com (10.152.98.122) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P384) id 15.20.464.8 via Frontend Transport; Tue, 30 Jan 2018 01:12:28 +0000
Received: from smtp.juniper.net (10.163.2.159) by P-EMFE01C-SAC.jnpr.net (172.24.192.21) with Microsoft SMTP Server (TLS) id 14.3.123.3; Mon, 29 Jan 2018 17:12:08 -0800
Date: Mon, 29 Jan 2018 18:12:05 -0700
From: Ebben Aries <exa@juniper.net>
To: Martin Bjorklund <mbj@tail-f.com>
CC: yang-doctors@ietf.org
Message-ID: <20180130011205.rr4aacdpo4tnovx2@smtp.juniper.net>
References: <20180125031650.jzdswdgpspontven@smtp.juniper.net> <20180125.083058.1067336366755903306.mbj@tail-f.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Disposition: inline
In-Reply-To: <20180125.083058.1067336366755903306.mbj@tail-f.com>
X-EOPAttributedMessage: 0
X-MS-Office365-Filtering-HT: Tenant
X-Forefront-Antispam-Report: CIP:66.129.239.15; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10019020)(396003)(346002)(39380400002)(376002)(39860400002)(2980300002)(189003)(199004)(59450400001)(8936002)(50466002)(316002)(53936002)(68736007)(53416004)(8676002)(81156014)(97756001)(104016004)(16586007)(966005)(77096007)(6306002)(105596002)(336011)(356003)(26005)(6346003)(6246003)(55016002)(81166006)(229853002)(5660300001)(478600001)(6916009)(97736004)(76176011)(106466001)(69596002)(2950100002)(6666003)(1076002)(186003)(7696005)(575784001)(86362001)(23726003)(2906002)(46406003)(47776003)(305945005)(4326008)(42262002); DIR:OUT; SFP:1102; SCL:1; SRVR:BY2PR0501MB2069; H:P-EMFE01C-SAC.jnpr.net; FPR:; SPF:SoftFail; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en;
X-Microsoft-Exchange-Diagnostics: 1; DM3NAM05FT013; 1:/25+1v7npn56MY3LU7Ex0P7QTpZyJpbELd1f5leIE9FUF5wGRLWeQC1h9Z9Uq0cNt7VGngrNj+TOFJoc/v8AE3u14P96S7dBLPtYQp9LwiAY89pB9qjCL9Jpb0cpgsP5
X-MS-PublicTrafficType: Email
X-MS-Office365-Filtering-Correlation-Id: e67c6f23-d73b-4039-d756-08d5677e881f
X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(4534165)(4627221)(201703031133081)(201702281549075)(5600026)(4604075)(2017052603307)(7153060); SRVR:BY2PR0501MB2069;
X-Microsoft-Exchange-Diagnostics: 1; BY2PR0501MB2069; 3:S2VJqABoYNH1kuGFtBsWIQyp1NQnSmkMuV5/uPTi+JvIWmqUIvBtYG3AnZFRHUla22ca1UENE6IzE9HT7Fsywi8VXBc5bWaHCX95hqTVUzbtUu/YVVCC1QJb19W5Wt7lS69OhqHxu/ZgJtatgE6kTf4NuINfnmVqlZx3agr+oRLsniOKTJUecYa7Bl0eYcnQjKQh/1vjIEkwaV9RCXXDApG4t5ngSCnaO9bfkohyBmtGeKhA1E/XtmhwnSAPGE9goFlvQO1rXnpkhqTC0riLwi4GHUYyTxT7i2LbDh9JiyyB++dtvn3zzmoLgfuYBPSa1F/ZSQlCp6xL6J6HJU5HXs3U/exbV4WwifpRv2Ajne4=; 25:WizFP7sYAqLU+kdEJxzZWO2WoOvc5wUyqxTWXKk+Yicjxx2e4oiOV6CVPmgdEtQ1hVUQpgVnzBENwEkKzitjvumlkP378sJfCN/ASU9eMroSi+PiEaBDCtxw5NijlaAery4A1CODPQThBf7tgLH8sL0pz6YdN9ONwO+6g1MMHt1Bu2ynZ71HmLdtZEONLPzHKBnoaLI899sVKOIGT5FwdvqpQ0HbSOWjRMBTlja0VoJJA91sA5WT9k8Cpwed3leoAloHpLT9oHqOuYRRMEy8F9gne3egZOzv2UdRo7dwcYkCJnLyYzY2Ab9ZU73+Hh/qQn1rr/j2DorzZUiN8o9ZZQ==
X-MS-TrafficTypeDiagnostic: BY2PR0501MB2069:
X-Microsoft-Exchange-Diagnostics: 1; BY2PR0501MB2069; 31:oxbM9lL//Wr9yVM2Ux47xKvYUbkDwiYGdis0SgHRNL61x/8+TNlAgnJ9JsSkS2nH2RT4igMSySs7AHs4Dehe0nNazKa6PflwKw7+DHSFXx5pBB8LThfRhh4U+X8jicQVJqrvSUN4j9N7MdumvvrPgvKt+9h5yb1WcMIw0YGJMCLNtbU8NsyyWFKd/OycXdAWfwStaaqvShrBNNnpbUOlUCA5nMiWTJ3abJJV9vmxXIg=; 20:vBbf7vm3dm2LTn/ohzy3/syqn9p6uMu97FvHjCk/jXc9O6OdHksbphm4JlWM9RKjMB1I4x+kGhIC22cUZA4EKYnGyueOQB3e8JJzhedoUpUN5GiGB+TjcmLD7Ti+K7TkU64rXG2SIHL8E2TBWF8vvEuTlTZfrP3XQ1ilYm2Y0f4ut+JQTvL+uTYk0JoII7o3PMpnOhV6sc3jbd9N5Q7xJsh/wszBiAdcHAdK/wwFF4Ouo1y+WE66K+gXRYUR0Yj6cZ8jBPUsS1bB30J3QimoqWMN+Y0kpyu5Fysc7PjDHEXcXDQcIonpxZPFoRp//BpEZBAKcSq6ozPytITT+JA0ZyiNWCKs1/P7EbUIEl/P5/1QtC+i2Oo92oi+kC8r1VoWt9zid2ILCrDKgp0IQYFdM0H3JQcTk6TFOZ9PAN9j60ZnaLQd/X1aIT0bbBFAZsdQdj3OFR9CCBZdK25q0v7oHjQaicA4azPsA8ug2lTQjwJMHKY54EuWY7fldP7t5gMc
X-Microsoft-Antispam-PRVS: <BY2PR0501MB2069DED84AF5D286501D5A09A8E40@BY2PR0501MB2069.namprd05.prod.outlook.com>
X-Exchange-Antispam-Report-Test: UriScan:(10436049006162)(166708455590820)(131327999870524)(138986009662008);
X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040501)(2401047)(5005006)(8121501046)(10201501046)(3002001)(93006095)(93001095)(3231101)(944501161)(6055026)(6041288)(20161123558120)(20161123562045)(20161123560045)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011); SRVR:BY2PR0501MB2069; BCL:0; PCL:0; RULEID:; SRVR:BY2PR0501MB2069;
X-Microsoft-Exchange-Diagnostics: 1; BY2PR0501MB2069; 4:DkQ9AKRIv2BofQ7rgZHSIf/kpFH45tqvUQnimRqAlrI0lamGWvuGM7bLBQjKbyCDlOXc6gf2mN68eyvg89r+s9eiK40JFHmzunLaRRMEXENjcJpUgQ3jFm0kKLMKUCQOdUXBrqq3HIZT0x3nTv0UP0fYmMSCPjhtBa9utfSVhFyfvcQlaNMRw2SS68/tGtl9EMyBz6qR+n1FoJ4x3wRwEpz6rJhbVdksONq0OiFyi9j7SCi8lPSIHfMJtRin1MHM/2VIU7Js7mLhL8fQIrZiFdTPYXZfB2SzLRI/A5sExAAIxZMTgr45Z6SWMdbbsZzeIkVHIEtPskDvT2Go9Ej3zrjXTqGAy5uR+9araR+NAM40VK1pndpCfcvjvi6QFQ9MGVqPki3gJN5YzCPFUagJSx3NQ57hT84fnslyHuY2KNk=
X-Forefront-PRVS: 0568F32D91
X-Microsoft-Exchange-Diagnostics: 1; BY2PR0501MB2069; 23:J+TGuOr1KReDVbIVvAyI3q1oYSEm3yQynbHwvfljEoXogfN7eg304znB5473tUGGw44wjGqfGXGfqpb3XNJwIlCe37EeBsQ5YCuQIP+IsQiU7tkIQXnLO79LC2cKPFwwfTQQUxUZpHrRrYp2O7Y1k/zK6QQGnufPtUPeqz5Wf3qff5JbdQ1E0ldSrZA/Bb3GDYmQkxvDzMpEawvJHZ6RJAxVjn1hys3vq2rRt7va+mLPIRbwlv/CM7SugYrXHnyDZ7FcaJUVEfYARItVpBUy1DYsbnJjeyQNheyBPYudULwTDu1okiuwmGTqkHCsdDq20iUeJ6TInhHfLrPWLgpky4hP5083FynSF7AUjXcRG527EgPfcf5orJ82oDJSq1tmpOskbl1QZ2RqMmzOY6FpoT/AoTqzXnKlaPksp2H/PL5TMozooREpWyiWAhHX4ldGLfvLqcfq83n3nYwBfOY0yh0kc8WpKYXxE6H+R+5+GNSjO6GZx/l3tIUFKiAlLq0LtMYlOkG1O/eSbMtTNODuWLkAexAxPNgtb/Ib+SxgLwP2eDdJYawG6dBLNE0muuGJmRLRI3Ds9kpChYCjMurW30MFTCeN+kt71CSTu2Tb6lrSUhK450Dmwe7aO6+Dus9vRi9ez9A2HfLfbJVWS4BSPDUP74kbB9Khf2/sTZqBh3GdwBersWFzWcEduMa3sYJ0jWGhzHHbMDw1Hp193f8zdW4JTi/qwLXSpXpFNIc9PysPTnF9cHRMAEHJS1oIB1vmpyyp6zVA3o0bb9yHmNzhEzhTNEMLvwGMBACRtZTpXoD1+WyrgsgZ05IJSmG06W7R12yXP1p3He/vgpRk3jfnRu/92bw7xhxtWvjX+N2U0oeHx9wE3qlVWtqaKtTL3fQLhnsu3MDQqM5qQn4dVoFn8GnTr6dk3hnoNWbADgcNlFYeyF/+817BQEH9yON5W9G+agKet/+t0kas9IjcLhD57oIsn6lqpZKMupHx3uIvr3ozTXWpmtSO7A/jiLLml2MHrIE074odUj6gtYo9Nprek1wCqPloo0jSKyfrrnCTyq7K0caSqXvQ0E37huZtQwVGw05plEygRo5LaSBRgdUhKS9Ea3mJ/ymq/aKqvQGPiX1heTnRl5+pJi0HL6NysalkL33LUDRSGGMHDz42ziyEOYYXuzGEhq4ZzzrfZqPLog5nt7UIxQqI+wHpBxrBxwBOJhYVuszkpTRiJeGWJbrufw==
X-Microsoft-Exchange-Diagnostics: 1; BY2PR0501MB2069; 6:23Kq+uLHGZDkeQDsYVG9NGcczAF6qs7RRZPJbQfZon4iKURTZ2XSk3WZJIDYng1fXDVRcP9rv4e3DfQCQHXhLCRmKw2UbeUDmVJiXfyUEh9//+zaAEP1oYFhRbt/KhocVL2QuSo1IBnxhq8Ry1yAwksp5BviwOW5/XLtp9KvBO7QRu4/OGFu3/qys8569J0hu8Mj6P6quteFaulpeqtDTNQQWdj8qn2CHngoe8OKbDUTmqIzrDUdMztcA4IF/7HZx2aA7t8BbI8xIREKfCB3/riVIlEAqbiA96oUpb9mbqAOuPub1HMj4htJA3iFP8f5eMpk6aAG9xBBmGKOsIq37bS75eHEiyqEugJsANXxhuk=; 5:svVjpt8sNDx8RGFdAHmz1tBVW95mflHyj7fYUaXlKO8sLjKX+rr3TLlEqiG0HdHmZbGSShR71tNAxx2meCHn0URaywd2wOPCWEA8RogkyoWfBpiSK0PsTLDQBbFpLZbfTSkzOJ/kcxUMC5LnsH8Z2PvPKEZU0jDEKMz95U3WwNo=; 24:Yd/WW3MiWY6doOF+xXZIxIEaAOwwmLZqUnVtsiB7LLlb4VacG19czofWHQQrIEtah0XwKx+kunC1bT+Exmt+zaRerJ1+HdIYPX9nGrJD7Ro=; 7:Hg5h519CCScywdgsXeuKG3/7/keG9zIzMhbwl6lAYdqv9Of9epwF2jdBl0fAKRinnSUFXY7M9EoFXh7IdHm6VnaoEHamodpaQdk95Mt+OLn97BzGBIQAqN8w0Z+KSTpFv4hqrqa8a4d5m99aqE9LtXP2I82O1CYcry2AVHadqTB5Og+C+y/gQsyfl98SCq2fbJC7r0AHDfcyx9LdWq6nBR/EDuThwQ1id44HFOEz4qiDCytLl/1+B1c29ACBRnwX
SpamDiagnosticOutput: 1:99
SpamDiagnosticMetadata: NSPM
X-OriginatorOrg: juniper.net
X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Jan 2018 01:12:28.6527 (UTC)
X-MS-Exchange-CrossTenant-Network-Message-Id: e67c6f23-d73b-4039-d756-08d5677e881f
X-MS-Exchange-CrossTenant-Id: bea78b3c-4cdb-4130-854a-1d193232e5f4
X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=bea78b3c-4cdb-4130-854a-1d193232e5f4; Ip=[66.129.239.15]; Helo=[P-EMFE01C-SAC.jnpr.net]
X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem
X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY2PR0501MB2069
X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2018-01-30_01:, , signatures=0
X-Proofpoint-Spam-Details: rule=outbound_spam_notspam policy=outbound_spam score=0 priorityscore=1501 malwarescore=0 suspectscore=1 phishscore=0 bulkscore=0 spamscore=0 clxscore=1011 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1711220000 definitions=main-1801300012
Archived-At: <https://mailarchive.ietf.org/arch/msg/yang-doctors/xwKmiN_O6KITqYCGj9BLoKcuw98>
Subject: Re: [yang-doctors] List key model definition order and results w/ pyang/yanglint
X-BeenThere: yang-doctors@ietf.org
X-Mailman-Version: 2.1.22
Precedence: list
List-Id: Email list of the yang-doctors directorate <yang-doctors.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/yang-doctors>, <mailto:yang-doctors-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/yang-doctors/>
List-Post: <mailto:yang-doctors@ietf.org>
List-Help: <mailto:yang-doctors-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/yang-doctors>, <mailto:yang-doctors-request@ietf.org?subject=subscribe>
X-List-Received-Date: Tue, 30 Jan 2018 01:12:47 -0000

inline...

On Jan 25 08:30 AM, Martin Bjorklund wrote:
> Hi,
> 
> Ebben Aries <exa@juniper.net> wrote:
> > Possibly bringing up a subject that may have been discussed before but
> > could not find anything on it so sending to the group.
> > 
> > RFC 6020 and 7950 both have the same wording on the subject around list
> > keys per
> > 
> > https://urldefense.proofpoint.com/v2/url?u=https-3A__tools.ietf.org_html_rfc6020-23section-2D7.8.2&d=DwICAg&c=HAkYuh63rsuhr6Scbfh0UjBXeMK-ndb3voDTXcWzoCI&r=GIehbDpQlo31lSi6WbnEkA&m=aIc-CQ8w2Asg5EZaRCunbRr33N3KJwrY_LQRZg_ED0A&s=s0ueqUyec_0t88MK81g6lUGSHXLivei_aFPMFmdUATQ&e=
> > https://urldefense.proofpoint.com/v2/url?u=https-3A__tools.ietf.org_html_rfc7950-23section-2D7.8.2&d=DwICAg&c=HAkYuh63rsuhr6Scbfh0UjBXeMK-ndb3voDTXcWzoCI&r=GIehbDpQlo31lSi6WbnEkA&m=aIc-CQ8w2Asg5EZaRCunbRr33N3KJwrY_LQRZg_ED0A&s=tnRmYIIjLA3KSnysiPYAaVjjLJ7GLK-No5AFu9bJ1hg&e=
> > 
> > From a model definition standpoint, there is nothing mandatory
> > surrounding that list keys be the first leaf definitions underneath.
> > 
> > From a content encoding standpoint, the following XML Mapping Rules in
> > https://urldefense.proofpoint.com/v2/url?u=https-3A__tools.ietf.org_html_rfc6020-23section-2D7.8.5&d=DwICAg&c=HAkYuh63rsuhr6Scbfh0UjBXeMK-ndb3voDTXcWzoCI&r=GIehbDpQlo31lSi6WbnEkA&m=aIc-CQ8w2Asg5EZaRCunbRr33N3KJwrY_LQRZg_ED0A&s=El_GT294heczTOGSYxV-s0MdzjwhB-vEBEVCQNYEdzs&e= do dictate an order
> > that the keys be defined before other subelements.  JSON obviously does
> > not utilize the same encoding technique.
> > 
> >    The list's key nodes are encoded as subelements to the list's
> >    identifier element, in the same order as they are defined within the
> >    "key" statement.
> > 
> >    The rest of the list's child nodes are encoded as subelements to the
> >    list element, after the keys.  If the list defines RPC input or
> >    output parameters, the subelements are encoded in the same order as
> >    they are defined within the "list" statement.  Otherwise, the
> >    subelements are encoded in any order.
> > 
> > Given the following simple example:
> > 
> > module test {
> >     namespace "https://urldefense.proofpoint.com/v2/url?u=http-3A__test&d=DwICAg&c=HAkYuh63rsuhr6Scbfh0UjBXeMK-ndb3voDTXcWzoCI&r=GIehbDpQlo31lSi6WbnEkA&m=aIc-CQ8w2Asg5EZaRCunbRr33N3KJwrY_LQRZg_ED0A&s=DtGK_MVelzL9TNkronbZ5Jb77kpX3cG2aR0Sthda_Z4&e=";
> >     prefix test;
> > 
> >     container foo {
> >         leaf bar {
> >             type string;
> >         }
> >         list car {
> >             key "far mar";
> > 
> >             leaf par {
> >                 type string;
> >             }
> >             leaf far {
> >                 type string;
> >             }
> >             leaf mar {
> >                 type string;
> >             }
> >             leaf nar {
> >                 type string;
> >             }
> >         }
> >     }
> > }
> > 
> > leaf 'par' here is defined before the 'far' and 'mar' keys, however if
> > we render out a sample-xml-skeleton with pyang, we do not take into
> > account the XML encoding rules defined in Section 7.8.5 and merely keep
> > the order as defined in the model.
> > 
> > $ pyang test.yang --strict -f sample-xml-skeleton
> > <?xml version='1.0' encoding='UTF-8'?>
> > <data xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
> >   <foo xmlns="https://urldefense.proofpoint.com/v2/url?u=http-3A__test&d=DwICAg&c=HAkYuh63rsuhr6Scbfh0UjBXeMK-ndb3voDTXcWzoCI&r=GIehbDpQlo31lSi6WbnEkA&m=aIc-CQ8w2Asg5EZaRCunbRr33N3KJwrY_LQRZg_ED0A&s=DtGK_MVelzL9TNkronbZ5Jb77kpX3cG2aR0Sthda_Z4&e=">
> >     <bar />
> >     <car>
> >       <par />
> >       <far />
> >       <mar />
> >       <nar />
> >     </car>
> >   </foo>
> > </data>
> > 
> > With yanglint, given the following XML document
> > 
> > $ cat test.xml
> > <foo xmlns="https://urldefense.proofpoint.com/v2/url?u=http-3A__test&d=DwICAg&c=HAkYuh63rsuhr6Scbfh0UjBXeMK-ndb3voDTXcWzoCI&r=GIehbDpQlo31lSi6WbnEkA&m=aIc-CQ8w2Asg5EZaRCunbRr33N3KJwrY_LQRZg_ED0A&s=DtGK_MVelzL9TNkronbZ5Jb77kpX3cG2aR0Sthda_Z4&e=">
> >     <bar>BAR</bar>
> >     <car>
> >         <par>PAR</par>
> >         <far>FAR</far>
> >         <mar>MAR</mar>
> >         <nar>NAR</nar>
> >     </car>
> > </foo>
> > 
> > The rendered XML output will actually reorder the list keys to be first
> > 
> > $ yanglint -f xml test.yang test.xml
> > <foo xmlns="https://urldefense.proofpoint.com/v2/url?u=http-3A__test&d=DwICAg&c=HAkYuh63rsuhr6Scbfh0UjBXeMK-ndb3voDTXcWzoCI&r=GIehbDpQlo31lSi6WbnEkA&m=aIc-CQ8w2Asg5EZaRCunbRr33N3KJwrY_LQRZg_ED0A&s=DtGK_MVelzL9TNkronbZ5Jb77kpX3cG2aR0Sthda_Z4&e=">
> >   <bar>BAR</bar>
> >   <car>
> >     <far>FAR</far>
> >     <mar>MAR</mar>
> >     <par>PAR</par>
> >     <nar>NAR</nar>
> >   </car>
> > </foo>
> > 
> > Personally, from a BCP standpoint, defining list keys first eases
> > readability and want to solicit others thoughts on this (rather than
> > nested down in the list or via a grouping reference further down).
> 
> I agree.
> 

Should we add text to rfc6087bis to suggest such?  Any reason not to?

> > Generation to yin does not rearrange in either pyang or yanglint which
> > means any processing of yin would need to undergo some reordering
> > possibly depending on how it is absorbed.
> 
> I don't understand what you mean.  Yin follows the same rules as basic
> YANG syntax; it is the "key" statement that defines the XML element
> order.
> 

Just merely pointing out that the same handling that would be done for
XML encoding rules would need to be done for potential processing of YIN
if the consumer of said data needs to process ordered elements
in whatever application.

Understood this is lossless and a direct mapping

> > For the JSON encoding case, there may be no strict ordering but
> > following a BCP where folks *should* send list keys before other
> > elements can ease implementation efforts in many cases.
> 
> I disagree.  Implementations MUST handle object members in any order
> (std JSON), so they can never use a simpler implementation that is
> built on the presumption that keys always are sent first.
> 

Agreed

> (However, a clever implemention could check if the keys are sent
> first, then it can parse more efficiently; it wouldn't have to buffer
> data.  But this is the opposite of a simple implemention.)
> 

This was precisely my point but agree, the assumption can never be made
due to this

A BCP could very well be put into code for --ietf, -f yang (and other
flags) that *could* enforce this ordering within the model itself.  If
we do add text to rfc6087bis, this should come along w/ imo.

> > It is also
> > likely that payloads will generally be constructed in the order in which
> > they are defined in the model.
> 
> Yes.
> 
> > So either I see making the definition of such either mandatory or at a
> > bare minimum pyang sample-xml-skeleton output to take into account
> > ordering list key leafs prior to other subelements.
> 
> I think the bug in pyang should be fixed!
> 

Have the fix in a local branch - pull request now at:

https://github.com/mbj4668/pyang/pull/359

/ebben