diff --git a/metaschema/parser/main.go b/metaschema/parser/main.go index 6dddde3..b1e8528 100644 --- a/metaschema/parser/main.go +++ b/metaschema/parser/main.go @@ -290,6 +290,20 @@ func (a *Assembly) IndexBy() string { return strcase.ToCamel(a.Def.JsonKey.FlagName) } +func (a *Assembly) XmlGroupping() string { + if a.GroupAs == nil { + return "" + } + if a.GroupAs.InXml == "UNGROUPED" || a.GroupAs.InXml == "" { + return "" + } + if a.GroupAs.InXml == "GROUPED" { + return a.GroupAs.Name + ">" + } + panic("Not implemented group-as/@in-xml=" + a.GroupAs.InXml) + return "" +} + type Field struct { Required string `xml:"required,attr"` @@ -418,6 +432,7 @@ type Choice struct { type GroupAs struct { Name string `xml:"name,attr"` InJson string `xml:"in-json,attr"` + InXml string `xml:"in-xml,attr"` } func (ga *GroupAs) SingletonOrArray() bool { diff --git a/metaschema/templates/generated_models.tmpl b/metaschema/templates/generated_models.tmpl index 1ecaf3a..2ccaf5d 100644 --- a/metaschema/templates/generated_models.tmpl +++ b/metaschema/templates/generated_models.tmpl @@ -23,7 +23,7 @@ type {{.GoTypeName}} struct { {{- range .Model.Assembly}} // {{ .GoComment }} - {{.GoName}} {{.GoMemLayout}}{{.GoTypeNameMultiplexed}} `xml:"{{.XmlName}},omitempty" json:"{{.JsonName}},omitempty"` + {{.GoName}} {{.GoMemLayout}}{{.GoTypeNameMultiplexed}} `xml:"{{.XmlGroupping}}{{.XmlName}},omitempty" json:"{{.JsonName}},omitempty"` {{- end}} {{- range .Model.Choice}} diff --git a/metaschema/templates/pkged.go b/metaschema/templates/pkged.go index 8802eaf..329ae15 100644 --- a/metaschema/templates/pkged.go +++ b/metaschema/templates/pkged.go @@ -9,4 +9,4 @@ import ( "github.com/markbates/pkger/pkging/mem" ) -var _ = pkger.Apply(mem.UnmarshalEmbed([]byte(`1f8b08000000000000ffec3beb73a2cab3ffcaaff87a3de1a168b0ea7e10b322c6b81b8cf2d83ab535c008c4e1719841c553fbbfdf9a41118d79ecd973ef979b0fc6e99ea6a7df83dd95bfb92859a598ebffcdd1cf5d94737d8e0fd318f218156b80a3f51fabb6c4fb80003e877e08081f44840f0b970f522f8d3354f23124007b218c01d7e2f4384b73f20d9090eb735c8b9b8118727dee8ce62ef5aacd27900790546b234d0fab0740bc90eb2705422d6e4e00825c7f05108607c88000a74945aba5a308417ca4ae4eafc13b98d5eb2788c90535455d3cf190fa053def6feea0421091b0706fbc347e45e10710255c9fe4056cfd1bf6d3d287d4ff2d267c90dec4a9cf782d618e23662bf1466c733f7ffe6c71abca047fbfa35abfc992c038438040cc0730813920d0ff11a73e44f886c419a2dc6820d16f1f121021764052f9fefa232d0e477bc8f545a5d36e717487eb77da5db6fc4122f6a42448c21f82f28778fb248a7da9d7efc837524f6a2bb76257f92f41ea0b02d7e222fcc3a7863fc4082ed9e17770c3f5bb9d5e4f6c717a9272fd9e7cabb46fc516374351b2e6fa22f336e4faedb624745adc22f2b9be2808428bd34e4bebc78f0cf802d7175a9ce1539e428b9b372457d1ba52a423285d0aa6de1a73fddb163720514c2599438feb8b5d41e8884a47925adc0c534c4feedd2a4aa7a3fc6c710f2f482551eaca47d25ae79f2d6ef87152ebc78f222930f4b9fe77a125b4843f59008430ff3792fd6a7c5c5680b763ec351687a2d144bd55337e2be10ed5e63b77c3fd59979b2a9dcfab0da6d07f7c98c1c4878957f6fff371e53290639837ebd5f75abb9b20a527d785e83be79695ce30cfd39c2e5631e15abf60cbfab8c62331c8d72e4be16c1d549b29bf4af31850de51ca476941229a97293d320324e469a9a00b9aac248f9280ee10b823b5b7a8e45595fdceb9c52a4ab9562d3e15318718f32b46d94004fb286370424094c09c4711260704dcb1555e6624ad173ca8385680176521d3e000fbcd4d1f831300bd73d0976459545e20f82821304f00e2a1bf05b98f2fc9108a321279274c188306543f9e83c43f58f1720b172e41f0b411fbf209a0cf3520afd3009a0ae0108867902477cf6059941af0c5910435ecb49305e51ce2b375b4a3619778a91f254163c9039c884dd80518763b6798280179d9c484b0c98d7fa669d480331837c15d8cde0979b758ad004af910e6f0b7d32102899722188384c724f70086efa6cbab9b5724baa4a8c32006197e9b345b0795f1dfa5e131f159b206290f580235533a481b8aa77c9633192a007b20498e0049d7907a2604383c7cf15eeeb56924d572d3a4062868a2bcac6882ab98e034274d540209c981079bb814331f3751598a5013be7c24872b043d82227286c6511220b84251109e9d8a4bec018478b8831e4c36d7b68a84457a8d2710139432edd28b6a58a1e3aa0ad22fde8d82d392e0e3fa90c3317d75a9bef8b84024ca00330a43fc55a404facc15c065a9994052fde54342b2c692fd395aaf461e253ee068b5ccf294554a0a17795dc053cc0c7028e5572afac1aa6c15c05d562f785c260450fbe445422a750e2bde0bd20654db0f903466e5f1c5cec1702ff0f42dadc51d02866660ca3c75ba6670997887af13fb83ffea5b08b8db3caaa2fafc5aba80ab4ca0d84a9d22893cfaee57aff882acc4ee397ccb400c56946e03133fcdf9204520096ed23ce077fcf13a0a81170249f8185596a2526c0bf23bd4ec8b26dd47e98e25fa2de222dfc0e3d5f6065db8f6576f53bcbcd5de207e47631ab77e82e927861883e03576679911142cf3dea5cbf27457be4328f16106bcf51b54919f8057b671890f95f0da2e8b420cbd2287bc1bf9515ebc6aad2a607390605ac2df223ac62865f811ba84f2fbf3f32770f513f85010a97eebe023ea1d7e8dfccaefe19f2d8e8acaf5b969791b3c4acada99ab8963cac88b4782633e0676b20ec0d810bcf143775a2a09b08cd437f5c296143215fccda3a4104fdbc9534944be36dadb52885cf34b4fff627cd3bfc8df964375647c418b6990f560696c6d7396dba68f9ee21171e683eeb7f9a03024e5f1024f569670ef69a367208d1267aef6603958d7f0420e5d7311509a61427a8eb414e6a6b875db13c12b07c5113fd184e0ebb3104ca38a1f6c93d236e5c4a1676acb1898327ab4667bc71423778c94d5631ae8c3db8d3e263d7d288f5d61b6714d11b9c9233bcb1fa36d258b3c764543f6b4e557db14d1ca1202af6d94be3913f431bed7876a0f4a28d687f2dcb1d4d2b166c84d8cfd225636fe9725761a3cf5a16a3f2d768c8f3e0e893b94abb5a6765c73dbd5e350f0c7036afb67af3d799ec672e6b51f0b4752a4a924efa792b2b7a5119eeebf140f4366a7a2b2a1aaace67a0092d9c67d4ea3e97c120ca34100db98e8dab270c6a2426d349dab279bc4bbd069cfdeb503d38fda40a07e582aaba34d0423f4b591002d95d9c4a6fadca5116ce3c2d444cce4b24465aa8d047fac635712335f5b126f6cc87aa4fee5494af1359a505ef7747da25708b00ce45aaa00a91e95dcc88d8d4ad631e901d30ea66b71e3684b5cc93860787d3c09ddd847fa509eb99281dca1ac01738999fed12060746fea5ad1501d0c49a9fd7d80678e293ed816daf896a1ac2cd29baefdcd92c6c9a2b64d003511577a0d4e7660fed96d5c13098e296efdf13ad2b56cef4a9dae4ef55bd3b57c3cefdc56f1a0d6af618726aef6e993a9ac1d735bbc8c73a6d7665a56316348ca9d2b89c43165416fda665ce974f4450d9b4bf2a48d64b7bd145696f822279eac25f635b475b565c7318d0b3bc8b66beeaeebf62b71c064a4f20b8163ca6b96f7c7187fe9f73ba029992d2deb98398f7d845ccdf88dd81791bbd885d054447f2c2a87f858d05ca86d77cc69ea5f1412f7cb91c7efc4c1bbfaab5e7b865c7382a155f995d67ad8c601f523addfaeb92cfca17ab2cb3ff0f7dbf9def4dba92651ba395dafafdbc11ea45762fc5cdfaad61eea5990b19a56db22213d2f1e158eb408a66b0339312a9c859339e6eef0ec1bf1cfee8f2dbb3f5c6d59e8435973b551e295c7bb84d65114eb9a2fe84303eb7783604aed9b509b2c82abfe1fcf042f593efb43b577c54f15fff63ff791a18d04db623e7933df6ccb10bce837638eda7c58d9e274af507bc81b7f38288c8a6f6593e865fda4f72530e5a4ce8968f70cb451e9501d7e2b4632a5be1fc63374ca5921a8ee08b47f324725682fb7fa503cd8b3f659705ebfd93b46f06daece6c6b92fb5633df767b56c33ff0fc51d76bf72f8dd54a8eac19c73d58aacd77952da5734cf91998cb7d159f6fc4d99d709405f95fcedecbaebc6bd17b48be96cff47d09b931ab7bffcd7e98e73021a717d2d32b277b5bfddd310deb4120b883f92f0e6b5e3c588f6c6441797764233f89ddbe20f43bcacd6d4f9415a5d793fec9c8a6d795fec5910d93fc174636ed76a72376eb914d5be808b79ddbceb5918dd8bbed74942369adf3b591cd25694756945b41fa1cd97c8e6c3e47369f239bcf91cde7c8e67364f339b2f91cd97c8e6c3e47369f239bcf91cdffd6c8e6c54fdcffcbc14dba9996eacc377702b054ec5821f29287c0b62648d750e168a874cc99a06b55f3dd2bd5c231976b2a83132ba53e9e212f46a1aba1ae6d19992b7528dddeb126996dee32188f04602ac530badde8da687f684405b629afab81881a037387bc525d03d3891d4b0f5c73241c9ec770ae666ea40a405b665ea4eefdf144b4db86e8c58b8235f1c66a684b2474a4aab1a1dfa50a6bec8a17f86313a6344845d33934f48e745583e705bfaa6193b996baf192c7e07e38416e3cdb38d436a5c29ad97ab4be68468aa23b36324fdb21a82dcb63d3efad0193295e69b2b7279923a1c23677c7e668ec9bf2b33e0c09e33d1cfc75ad41743f57976e2c865e324b6d7377bf1094aff79a4ecf88a065a0fbb98abc64b2f1a2aa51791c825c34d20e8d3931f4ce86298c4eb22d3d00a6bc07a6819eccd156d7c4d01b11ea9fcc8d7dff855c0ba504a69fb9f1880d7086f3133f7a9e634d4ae6972a3e8aa52913db9aec8136c2f79a8ef5a193b9c92c73b4e5ccb606d9d792eaa007fa9310b831c2d560ae29e3e9e3c54bc1b726854e7d11a4677bf560e5f8393685cd51eecc43d77a39f4f9e6c52801a61cba6351990e07dbe950c58ed9499bf6b89faf2ff83ad4def974a84a4ccf636358438527a1b5b310436f78e98fc6676c17a7662941f0d00804dbf43afd50c574dfb654d65cbcd7b6581fdbd9305837780ae7328e2f1babd765f1e35149edf481987d4db6bd2f21c19682c046786bcddfd05b9b859eb408266d9c7c0d5ee3d7d4c109699d00a69cb8da52a0b5e6bd587c97e750cd9ca88a371a1bac791dc98d1cdba676b40d26c98cc63e762c63e346eb1e8bb768107e9bab0530b7017cd557bf1eb7d775ff902e57e2e24cee577938da32b6ad25f6efd27fcf66f1f69772f9bade13e48f97a55b9df711d994d7e2ed3266cf1afae7cfa4f7b1c806a0f7f381a26bdbfb5764a2bebf6767b2c6ff69b8f55ed3bdeab8c2cf7f89f9fff072f9f37f000000ffff010000ffff063de4fe05350000`))) +var _ = pkger.Apply(mem.UnmarshalEmbed([]byte(`1f8b08000000000000ffec5b5b73e2bab2fe2bbbfc7a5863d96088a9da0f40823121cc0412df56ad9a926d613b962fcb92b964d5fcf75392c118422eb367ce79d97920a8a576abfb5377cb7457fe11a2749511a1ff8fc03ed75121f40531cc1224125cc69044f11fabb62cfa9042b1407e08a91844540c4b570c322f4b72bc13134421f1429440a125e8499e15f41ba4a1d017849630870912fac209cf75e6558b0fb00810adc68b2cdb8fee20f542a19f9618b78425851809fd15c404eda90582244b2b5e2d1b4718910377b57b4d5ea3bc1e3f2042cfb8d9d4d91377995fb2fdfe11f62604110d4bf78b9725af187c07a354e8d3a244addf819f96dd65fe2f091183ec4b92f95c96810a1271aca42f525bf8f1e3474b585510fcf38e69fda6488a921c438a8818a014159022ff7b92f908932f34c93193c61c897dfb88c208f30dd2eaec2f3fd21248f48c84bea476414b602b42bfd3eef2e1771af1276520833f80fa872c3d48725fb9ea77c01705a8571da5d3e9fd0f90fb00082d2122df7d06fcde47c88e6f7e8dd642bfdbe9f5a496a0a799d0ef29576afb4a6a09731ca5b1d097f86923a1df6ecba0d3121e235fe84b008096a01d87d6f7ef39f481d0072d61e13399a0252c1b9a0f715c19d2016a9791991713a17fd51206344a98264be4097da90b40f74a51d55e4b981336d3557a40ee5e75ba3f5ac2dd2556191c586b9b7fb484d1c759adefdfcbb424c817fa7f82166881bfb80384a8f81dc17ed13fce33c0db3ef69a887dd2684ebd95337e29e0f6d9e64fe18bf0579d6eaa703ecd368451fff2518e521fa5deaeffaf8f1b97c382a0a299affeacadfb12646ce73a11fd29b8bbca66541459c106ab840aad9fc0b2deaef148028bd8e5219cc741b59889abac4820931d6562949534627199b12d73484391a50a3660c14a8b280dd80a455b5a9f16d3bccab27f0a6eb98a32a155abcf542c1021e28a73362682e728e7744a6194a242c411a1fb09b4e5a36297d3ac1e88b09258115e9487dc823ded37177d028f04f24e495f5614497d3121462945450ab188fc0d2c7c72ce867194d3c83bce84096c50f5e3054cfd3d8ae74ba4742946c785c4578e047bae41799d06d1348084503aa164a57b422b92dca0cfb6a4b881d35601ea2925e671b4656e977a991fa541632842924a4dda8504753b2733510a8b5d7326444d69e2130ba3069da3a4496e13fc8ecbbbe56a05712686a840bf1c0e114cbd0ca304a622a18507097a375c5e5dbca0d13947ed0609ccc9dbac791c54e0bfcb2312eaf3600d3211f2006a867490350ccfc4bce03a5404f1609a1e089ac5889d4c0849b8ff12bdc26b334faaf566410d71d09cf2f2b249ae124ab28236a7524469013dd49ccb083fe3e6549e61dca4cf1f29d00a238fe2889e4c93280d305ae128084f76253be2418c45b4451e4ad79796ca947b7a3d4f11a138e3d66567d9b09a4eaa2cc8be44370a8e434a0ee37d0c27ecd5a5fa129312d328871c143ef1779951e4f3a3802e0fcd14d1eaaf18529a3786fccf01bd7af2a0f17e8e65cbbcc878a6647459d4093c231c807d2abf90d1f7a8f25180b6793d10c92ea590e1539429adccd98f442fc81a548d1fa459c2d3e38b953d702fe6d95b5a4bd83b0c8bc08c9fd4f19a21bbd4db7f1dc5efcfafbe85a0bb29a2caab4fafa533ba8a04365b9953a691c7defdea9158d295d43da5af3849e08af1ad51ea6785186418a6c197ac08c4ad78b88e42e88550061fe3ca33bc93da4079879b7fb1a0fb28df2145bfc55c166b74b8dadee00b637ff536c7cb5bed0de6772c667eeba7847d1244080c5e1377121941c923ef5dbebcc8b6bb77186531cca117bfc115f9297c6599ecc83e135e5ae55e489057164874233f2aca57d1aa1cb680296129fc2da6838f32811fe14b99bcbf3e7f02573f81f70991d917071f316fff6be4677e0fff68094c55a12fcc7657c1bdacc6ce72983aa682bd640c1cf33eb0d338809305f02677ddd94e4da1b5c87c532f6d59a533e0afef65957ada5699c912f6b5f1b32d87d8356f7afacde29b7ea37c3346c3f1e2063fce82bc87768b8d6dce0bdbf4f14332a6ce72d0fdb61c940b59bd3f9ba72b0bdc7adaf809cae3d4590e7b6837886bfa51095df331603ca394f61cd9004b53dab8ed29f07683f2303fd540f0f50904b3a89287da74679b4aeab03d352381a682efadf9b3634a913bc1eaea3e0bf4d1d55a9fd09e3e52262e98af5d53c26e7acff7f2277853e9a24c5c69a1789af1d53625bcb240e0b5173bdf9c037d426ef5d1b087649ce82365e958c39d63cdb19b2e9e1f1375eddf18c469c8d44743fbe171cbe5e89390ba23a51a6bc38e6b6eba7a12027f3260d83f79ede9d32c5172af7d5f3ab22acf64e57926abcfb63c26b3e79bf26ec4712a2b0c87ea6aa907309dafdda72c9a2da7c1281a04a84da8ae19a533915486d16c393c62926c43a73d7f17076e1fc300b07330d4d50113b0087d6d0c9035e498d8cc9eeb2c426d529a9a44b85e96a4ceb431f0273a716529f735837a9385a247c3bf3d592dbf465326eb968d8ffc2a85d602bbd610206647a537769345a5eb84f6a06907b3585a3b9a412a1d077c5e9f4c4337f1b13e52e6aebcc0ee48d1a069106e7f340838df9bb6563ccc8685acd6e7bda7e78e29ddd9165efbd6425d59b4378bfdb5c1fce4b1c626409a442abb06471cf8f96cd7ae8981634a1b7f1247ba963fbb72a7ab33fb6236560efb9d62950c6afb1a3834e7ea337d30d5d83137e54b3fe776ad67bbca6716b27aedca12754c05e84d6c26954d87b3a869d3a00fda5871db065859d28b9878b00ce26b78e36a46c73117673828b66b6e275ea24ade6498bb895f618743eade1c70fbddd8303b41e025e3d2911f6b5f99c5f3cc95f113b3ad8e8fa3cf9cf80acb91a84d02663fcb7bae6994fe6858fbe07f82d3db71d2f4fb632c33be251bc797b1b207d907ec1f3f7bb241ed64abecfdfc4d5ff83dfecfcffdf2b9fd4cfc9fe7b1e085bd9c764c25aeee029efb6b2c2edd038b0463575bbc9bfb509bc4ee88dd5b43e2989d60163bc436fd677d24a9abfb9c63cc7291d3be0fa6da26b81b5577cf4fdd1d27e754c9ff8533bab1ad45c8f7677e79b857d217f116fa93c5ee577d8e615e6171f43986879ba8401f29e34a6e85c9857be4d99f4c7337f1ea989869f3ccb6a631b3e1977c84fb00a789271bc7985d0e73271a944b6b3eb7ad69e15b8360b6cf05c733e3783fb27bed98bb07aa7e23855e4225af196f93393e9cc7dbcfd7b6d6381dfcb5f2d5fb4a8fb4e9c727f7d98d63717fc76e32cf1debeedd77946fb52e0678300d605bf327a819d45e32de6168cb34746463ff2e22a9b3f4423c331f978dd2e179efdfffe63fd80b94d2e38beaf15594bfc5fe6afb86d72630daa2e2279b382f1eac5b390a50df6be548ca83d4ed03d0efa85fae7a92a2aabd9efc9fb4727a5df937b672b8e63fd5cae94a9deea1e9d26983365080dabed4ca917a579d8e7a60ad6dbed4ca3967ed28aa7a05e4cf56ce672be7b395f3d9caf96ce57cb6723e5b399fad9ccf56ce672be7b395f3d9caf96ce5fc5fb5725efcc4fdff6ce864ebd96e38f7cd2d80d690385688bdf42eb0ad29d6355c3a1ade39e61ce85a5568f576c3d2318d98e9e024ea4e9fccb197e0d0d570d7b616b92b7718dfb3634d73dbdce628190368aae528ba5aebdaf8795f000e6c5389ab46c93081e6167bbb610c4d27712c3d70cd31d83f4fd07298bbd11040cdc8bd88175b24bbbd90bce4b1e4cda1c959c1e33a5379c1efbc105217f616b4e2e9ec0b3307be475e147e218f1726f3dcb5866b2fbd0f6e4753ec26f3b5c3b0d9a9bc90a547312fea348ad2923b59e49eb6c54833765efbbc90f4b2a8634a178aefed69eec8b8b4cdeda11097f8a6f2a48f42ca658f067fef8b83c7a29425a9b7cba1e12652e8a5f3cc36b7b78f40fd7aabe96c8f08590b7cbb1c622f9daebd68d83b364fd8e758e89bc5785f289442efa4c9c2f964dbd203682acfd05ce00773bcd13529f4c6745f0cf3fd177a3daa3b68fab99b8c796367b43ccae385566bbae3e752f94769980ab5ade933d4c6e456d3893e7272379de78e66cc6d6b907fdd311bf4407f00819b6052155d9b3a1e3f5e6200df9a963a3b8b203b59ab1b2e878fb6e1cd46d71c17ce3274ad97c5f06f5e8253682aa13b91d4d968b0998d7811396be271bb8ccfe43a0cef62361acadcce430150c3a527e3d87994426f747e1e8dcfc42e8fc55b8a9125a9fa3508e026bbcc3f1a12b66e5bc38d632af1adb621fac4ce4741dc90094e756c143f9b4db3f38f9f8c770ca70ff8ec6bba3dfb3206b61c0436261b6bf986ddda3cf4e4c760da26e9d7e035794d1b9c90e509682aa9ab1980e59af77cf15d99a361ee4495bf31dfe0c5f44869c4d826b3a34d304de7ccf789632dd66e14f7b8bf4583f0db7258427313a057cfeae7fdf6b2ed1fb2e5825f9ce8fdaa0c473312db32887f9dfd3ecc92cd4fc5f265bba7d89f183bb7daef23baa9aff9dbb9cf9e341f4e9fc96e138937466f970355d736b7afe8c4cefe96ef19e4270d82f78aee55c5157dfeabcc7fc3cbe58fff050000ffff010000ffff6affaa391d350000`)))