diff --git a/.claude/skills/meta-compile/scripts/meta-compile.ps1 b/.claude/skills/meta-compile/scripts/meta-compile.ps1 index 435c0759..96c1881b 100644 --- a/.claude/skills/meta-compile/scripts/meta-compile.ps1 +++ b/.claude/skills/meta-compile/scripts/meta-compile.ps1 @@ -1,4 +1,4 @@ -# meta-compile v1.3 — Compile 1C metadata object from JSON +# meta-compile v1.4 — Compile 1C metadata object from JSON # Source: https://github.com/Nikolay-Shirokov/cc-1c-skills param( [Parameter(Mandatory)] @@ -79,6 +79,90 @@ $script:objectTypeSynonyms = @{ "ОпределяемыйТип" = "DefinedType" } +# Enum property value synonyms — model often gets these slightly wrong +$script:enumValueAliases = @{ + # RegisterType (AccumulationRegister) + "Balances" = "Balance"; "Остатки" = "Balance"; "Обороты" = "Turnovers" + # WriteMode (InformationRegister) + "RecordSubordinate" = "RecorderSubordinate"; "Subordinate" = "RecorderSubordinate" + "ПодчинениеРегистратору" = "RecorderSubordinate"; "Независимый" = "Independent" + # DependenceOnCalculationTypes (ChartOfCalculationTypes) + "NotDependOnCalculationTypes" = "DontUse"; "NoDependence" = "DontUse" + "Depend" = "RequireCalculationTypes"; "RequireCalculation" = "RequireCalculationTypes" + # InformationRegisterPeriodicity + "None" = "Nonperiodical"; "Daily" = "Day"; "Monthly" = "Month" + "Quarterly" = "Quarter"; "Yearly" = "Year" + "Непериодический" = "Nonperiodical"; "Секунда" = "Second"; "День" = "Day" + "Месяц" = "Month"; "Квартал" = "Quarter"; "Год" = "Year" + "ПозицияРегистратора" = "RecorderPosition" + # DataLockControlMode + "Автоматический" = "Automatic"; "Управляемый" = "Managed" + # FullTextSearch + "Использовать" = "Use"; "НеИспользовать" = "DontUse" + # Posting + "Разрешить" = "Allow"; "Запретить" = "Deny" + # EditType + "ВДиалоге" = "InDialog"; "ВСписке" = "InList"; "ОбаСпособа" = "BothWays" + # DefaultPresentation + "ВВидеНаименования" = "AsDescription"; "ВВидеКода" = "AsCode" + # FillChecking + "НеПроверять" = "DontCheck"; "Ошибка" = "ShowError"; "Предупреждение" = "ShowWarning" + # Indexing + "НеИндексировать" = "DontIndex"; "Индексировать" = "Index" + "ИндексироватьСДопУпорядочиванием" = "IndexWithAdditionalOrder" +} + +# Valid enum values per property (from meta-validate) +$script:validEnumValues = @{ + "RegisterType" = @("Balance","Turnovers") + "WriteMode" = @("Independent","RecorderSubordinate") + "InformationRegisterPeriodicity" = @("Nonperiodical","Second","Day","Month","Quarter","Year","RecorderPosition") + "DependenceOnCalculationTypes" = @("DontUse","RequireCalculationTypes") + "DataLockControlMode" = @("Automatic","Managed") + "FullTextSearch" = @("Use","DontUse") + "DataHistory" = @("Use","DontUse") + "DefaultPresentation" = @("AsDescription","AsCode") + "Posting" = @("Allow","Deny") + "RealTimePosting" = @("Allow","Deny") + "EditType" = @("InDialog","InList","BothWays") + "HierarchyType" = @("HierarchyFoldersAndItems","HierarchyItemsOnly") + "CodeType" = @("String","Number") + "CodeAllowedLength" = @("Variable","Fixed") + "NumberType" = @("String","Number") + "NumberAllowedLength" = @("Variable","Fixed") + "RegisterRecordsDeletion" = @("AutoDelete","AutoDeleteOnUnpost","AutoDeleteOff") + "RegisterRecordsWritingOnPost" = @("WriteModified","WriteSelected","WriteAll") + "ReturnValuesReuse" = @("DontUse","DuringRequest","DuringSession") + "ReuseSessions" = @("DontUse","AutoUse") + "FillChecking" = @("DontCheck","ShowError","ShowWarning") + "Indexing" = @("DontIndex","Index","IndexWithAdditionalOrder") +} + +function Normalize-EnumValue { + param([string]$propName, [string]$value) + # 1. Check alias dictionary + if ($script:enumValueAliases.ContainsKey($value)) { + return $script:enumValueAliases[$value] + } + # 2. Case-insensitive match against valid values + $valid = $script:validEnumValues[$propName] + if ($valid) { + foreach ($v in $valid) { + if ($v -ieq $value) { return $v } + } + } + # 3. Return as-is (validator will catch if wrong) + return $value +} + +# Helper: read enum property from $def with default and normalization +function Get-EnumProp { + param([string]$propName, [string]$fieldName, [string]$default) + $val = $def.$fieldName + $raw = if ($val) { "$val" } else { $default } + return (Normalize-EnumValue $propName $raw) +} + if (-not $def.type) { Write-Error "JSON must have 'type' field" exit 1 @@ -984,7 +1068,7 @@ function Emit-CatalogProperties { X "$i" $hierarchical = if ($def.hierarchical -eq $true) { "true" } else { "false" } - $hierarchyType = if ($def.hierarchyType) { "$($def.hierarchyType)" } else { "HierarchyFoldersAndItems" } + $hierarchyType = Get-EnumProp "HierarchyType" "hierarchyType" "HierarchyFoldersAndItems" X "$i$hierarchical" X "$i$hierarchyType" X "$ifalse" @@ -996,8 +1080,8 @@ function Emit-CatalogProperties { $codeLength = if ($null -ne $def.codeLength) { "$($def.codeLength)" } else { "9" } $descriptionLength = if ($null -ne $def.descriptionLength) { "$($def.descriptionLength)" } else { "25" } - $codeType = if ($def.codeType) { "$($def.codeType)" } else { "String" } - $codeAllowedLength = if ($def.codeAllowedLength) { "$($def.codeAllowedLength)" } else { "Variable" } + $codeType = Get-EnumProp "CodeType" "codeType" "String" + $codeAllowedLength = Get-EnumProp "CodeAllowedLength" "codeAllowedLength" "Variable" $autonumbering = if ($def.autonumbering -eq $false) { "false" } else { "true" } $checkUnique = if ($def.checkUnique -eq $true) { "true" } else { "false" } @@ -1009,7 +1093,7 @@ function Emit-CatalogProperties { X "$i$checkUnique" X "$i$autonumbering" - $defaultPresentation = if ($def.defaultPresentation) { "$($def.defaultPresentation)" } else { "AsDescription" } + $defaultPresentation = Get-EnumProp "DefaultPresentation" "defaultPresentation" "AsDescription" X "$i$defaultPresentation" Emit-StandardAttributes $i "Catalog" @@ -1039,10 +1123,10 @@ function Emit-CatalogProperties { X "$i" X "$i" - $dataLockControlMode = if ($def.dataLockControlMode) { "$($def.dataLockControlMode)" } else { "Automatic" } + $dataLockControlMode = Get-EnumProp "DataLockControlMode" "dataLockControlMode" "Automatic" X "$i$dataLockControlMode" - $fullTextSearch = if ($def.fullTextSearch) { "$($def.fullTextSearch)" } else { "Use" } + $fullTextSearch = Get-EnumProp "FullTextSearch" "fullTextSearch" "Use" X "$i$fullTextSearch" X "$i" @@ -1067,9 +1151,9 @@ function Emit-DocumentProperties { X "$itrue" X "$i" - $numberType = if ($def.numberType) { "$($def.numberType)" } else { "String" } + $numberType = Get-EnumProp "NumberType" "numberType" "String" $numberLength = if ($null -ne $def.numberLength) { "$($def.numberLength)" } else { "11" } - $numberAllowedLength = if ($def.numberAllowedLength) { "$($def.numberAllowedLength)" } else { "Variable" } + $numberAllowedLength = Get-EnumProp "NumberAllowedLength" "numberAllowedLength" "Variable" $numberPeriodicity = if ($def.numberPeriodicity) { "$($def.numberPeriodicity)" } else { "Year" } $checkUnique = if ($def.checkUnique -eq $false) { "false" } else { "true" } $autonumbering = if ($def.autonumbering -eq $false) { "false" } else { "true" } @@ -1099,10 +1183,10 @@ function Emit-DocumentProperties { X "$i" X "$i" - $posting = if ($def.posting) { "$($def.posting)" } else { "Allow" } - $realTimePosting = if ($def.realTimePosting) { "$($def.realTimePosting)" } else { "Deny" } - $registerRecordsDeletion = if ($def.registerRecordsDeletion) { "$($def.registerRecordsDeletion)" } else { "AutoDelete" } - $registerRecordsWritingOnPost = if ($def.registerRecordsWritingOnPost) { "$($def.registerRecordsWritingOnPost)" } else { "WriteModified" } + $posting = Get-EnumProp "Posting" "posting" "Allow" + $realTimePosting = Get-EnumProp "RealTimePosting" "realTimePosting" "Deny" + $registerRecordsDeletion = Get-EnumProp "RegisterRecordsDeletion" "registerRecordsDeletion" "AutoDelete" + $registerRecordsWritingOnPost = Get-EnumProp "RegisterRecordsWritingOnPost" "registerRecordsWritingOnPost" "WriteModified" $sequenceFilling = if ($def.sequenceFilling) { "$($def.sequenceFilling)" } else { "AutoFill" } $postInPrivilegedMode = if ($def.postInPrivilegedMode -eq $false) { "false" } else { "true" } $unpostInPrivilegedMode = if ($def.unpostInPrivilegedMode -eq $false) { "false" } else { "true" } @@ -1148,10 +1232,10 @@ function Emit-DocumentProperties { X "$ifalse" X "$i" - $dataLockControlMode = if ($def.dataLockControlMode) { "$($def.dataLockControlMode)" } else { "Automatic" } + $dataLockControlMode = Get-EnumProp "DataLockControlMode" "dataLockControlMode" "Automatic" X "$i$dataLockControlMode" - $fullTextSearch = if ($def.fullTextSearch) { "$($def.fullTextSearch)" } else { "Use" } + $fullTextSearch = Get-EnumProp "FullTextSearch" "fullTextSearch" "Use" X "$i$fullTextSearch" X "$i" @@ -1225,7 +1309,7 @@ function Emit-ConstantProperties { X "$i" X "$iAuto" - $dataLockControlMode = if ($def.dataLockControlMode) { "$($def.dataLockControlMode)" } else { "Automatic" } + $dataLockControlMode = Get-EnumProp "DataLockControlMode" "dataLockControlMode" "Automatic" X "$i$dataLockControlMode" X "$iDontUse" X "$ifalse" @@ -1248,8 +1332,8 @@ function Emit-InformationRegisterProperties { Emit-StandardAttributes $i "InformationRegister" - $periodicity = if ($def.periodicity) { "$($def.periodicity)" } else { "Nonperiodical" } - $writeMode = if ($def.writeMode) { "$($def.writeMode)" } else { "Independent" } + $periodicity = Get-EnumProp "InformationRegisterPeriodicity" "periodicity" "Nonperiodical" + $writeMode = Get-EnumProp "WriteMode" "writeMode" "Independent" # MainFilterOnPeriod: auto based on periodicity unless explicitly set $mainFilterOnPeriod = "false" @@ -1264,10 +1348,10 @@ function Emit-InformationRegisterProperties { X "$i$mainFilterOnPeriod" X "$ifalse" - $dataLockControlMode = if ($def.dataLockControlMode) { "$($def.dataLockControlMode)" } else { "Automatic" } + $dataLockControlMode = Get-EnumProp "DataLockControlMode" "dataLockControlMode" "Automatic" X "$i$dataLockControlMode" - $fullTextSearch = if ($def.fullTextSearch) { "$($def.fullTextSearch)" } else { "Use" } + $fullTextSearch = Get-EnumProp "FullTextSearch" "fullTextSearch" "Use" X "$i$fullTextSearch" X "$ifalse" @@ -1293,17 +1377,17 @@ function Emit-AccumulationRegisterProperties { X "$i" X "$i" - $registerType = if ($def.registerType) { "$($def.registerType)" } else { "Balance" } + $registerType = Get-EnumProp "RegisterType" "registerType" "Balance" X "$i$registerType" X "$ifalse" Emit-StandardAttributes $i "AccumulationRegister" - $dataLockControlMode = if ($def.dataLockControlMode) { "$($def.dataLockControlMode)" } else { "Automatic" } + $dataLockControlMode = Get-EnumProp "DataLockControlMode" "dataLockControlMode" "Automatic" X "$i$dataLockControlMode" - $fullTextSearch = if ($def.fullTextSearch) { "$($def.fullTextSearch)" } else { "Use" } + $fullTextSearch = Get-EnumProp "FullTextSearch" "fullTextSearch" "Use" X "$i$fullTextSearch" $enableTotalsSplitting = if ($def.enableTotalsSplitting -eq $false) { "false" } else { "true" } @@ -1393,7 +1477,7 @@ function Emit-CommonModuleProperties { X "$i$serverCall" X "$i$privileged" - $returnValuesReuse = if ($def.returnValuesReuse) { "$($def.returnValuesReuse)" } else { "DontUse" } + $returnValuesReuse = Get-EnumProp "ReturnValuesReuse" "returnValuesReuse" "DontUse" X "$i$returnValuesReuse" } @@ -1532,7 +1616,7 @@ function Emit-ExchangePlanProperties { $codeLength = if ($null -ne $def.codeLength) { "$($def.codeLength)" } else { "9" } $descriptionLength = if ($null -ne $def.descriptionLength) { "$($def.descriptionLength)" } else { "100" } - $codeAllowedLength = if ($def.codeAllowedLength) { "$($def.codeAllowedLength)" } else { "Variable" } + $codeAllowedLength = Get-EnumProp "CodeAllowedLength" "codeAllowedLength" "Variable" X "$i$codeLength" X "$i$codeAllowedLength" @@ -1566,10 +1650,10 @@ function Emit-ExchangePlanProperties { X "$ifalse" X "$i" - $dataLockControlMode = if ($def.dataLockControlMode) { "$($def.dataLockControlMode)" } else { "Automatic" } + $dataLockControlMode = Get-EnumProp "DataLockControlMode" "dataLockControlMode" "Automatic" X "$i$dataLockControlMode" - $fullTextSearch = if ($def.fullTextSearch) { "$($def.fullTextSearch)" } else { "Use" } + $fullTextSearch = Get-EnumProp "FullTextSearch" "fullTextSearch" "Use" X "$i$fullTextSearch" X "$i" @@ -1595,7 +1679,7 @@ function Emit-ChartOfCharacteristicTypesProperties { $codeLength = if ($null -ne $def.codeLength) { "$($def.codeLength)" } else { "9" } $descriptionLength = if ($null -ne $def.descriptionLength) { "$($def.descriptionLength)" } else { "25" } - $codeAllowedLength = if ($def.codeAllowedLength) { "$($def.codeAllowedLength)" } else { "Variable" } + $codeAllowedLength = Get-EnumProp "CodeAllowedLength" "codeAllowedLength" "Variable" $autonumbering = if ($def.autonumbering -eq $false) { "false" } else { "true" } $checkUnique = if ($def.checkUnique -eq $true) { "true" } else { "false" } @@ -1672,10 +1756,10 @@ function Emit-ChartOfCharacteristicTypesProperties { X "$i" X "$i" - $dataLockControlMode = if ($def.dataLockControlMode) { "$($def.dataLockControlMode)" } else { "Automatic" } + $dataLockControlMode = Get-EnumProp "DataLockControlMode" "dataLockControlMode" "Automatic" X "$i$dataLockControlMode" - $fullTextSearch = if ($def.fullTextSearch) { "$($def.fullTextSearch)" } else { "Use" } + $fullTextSearch = Get-EnumProp "FullTextSearch" "fullTextSearch" "Use" X "$i$fullTextSearch" X "$i" @@ -1809,10 +1893,10 @@ function Emit-ChartOfAccountsProperties { X "$i" X "$i" - $dataLockControlMode = if ($def.dataLockControlMode) { "$($def.dataLockControlMode)" } else { "Automatic" } + $dataLockControlMode = Get-EnumProp "DataLockControlMode" "dataLockControlMode" "Automatic" X "$i$dataLockControlMode" - $fullTextSearch = if ($def.fullTextSearch) { "$($def.fullTextSearch)" } else { "Use" } + $fullTextSearch = Get-EnumProp "FullTextSearch" "fullTextSearch" "Use" X "$i$fullTextSearch" X "$i" @@ -1852,10 +1936,10 @@ function Emit-AccountingRegisterProperties { Emit-StandardAttributes $i "AccountingRegister" - $dataLockControlMode = if ($def.dataLockControlMode) { "$($def.dataLockControlMode)" } else { "Automatic" } + $dataLockControlMode = Get-EnumProp "DataLockControlMode" "dataLockControlMode" "Automatic" X "$i$dataLockControlMode" - $fullTextSearch = if ($def.fullTextSearch) { "$($def.fullTextSearch)" } else { "Use" } + $fullTextSearch = Get-EnumProp "FullTextSearch" "fullTextSearch" "Use" X "$i$fullTextSearch" X "$i" @@ -1874,8 +1958,8 @@ function Emit-ChartOfCalculationTypesProperties { $codeLength = if ($null -ne $def.codeLength) { "$($def.codeLength)" } else { "9" } $descriptionLength = if ($null -ne $def.descriptionLength) { "$($def.descriptionLength)" } else { "25" } - $codeType = if ($def.codeType) { "$($def.codeType)" } else { "String" } - $codeAllowedLength = if ($def.codeAllowedLength) { "$($def.codeAllowedLength)" } else { "Variable" } + $codeType = Get-EnumProp "CodeType" "codeType" "String" + $codeAllowedLength = Get-EnumProp "CodeAllowedLength" "codeAllowedLength" "Variable" X "$i$codeLength" X "$i$codeType" @@ -1883,7 +1967,7 @@ function Emit-ChartOfCalculationTypesProperties { X "$i$descriptionLength" X "$iAsDescription" - $dependence = if ($def.dependenceOnCalculationTypes) { "$($def.dependenceOnCalculationTypes)" } else { "DontUse" } + $dependence = Get-EnumProp "DependenceOnCalculationTypes" "dependenceOnCalculationTypes" "DontUse" X "$i$dependence" # BaseCalculationTypes @@ -1925,10 +2009,10 @@ function Emit-ChartOfCalculationTypesProperties { X "$i" X "$i" - $dataLockControlMode = if ($def.dataLockControlMode) { "$($def.dataLockControlMode)" } else { "Automatic" } + $dataLockControlMode = Get-EnumProp "DataLockControlMode" "dataLockControlMode" "Automatic" X "$i$dataLockControlMode" - $fullTextSearch = if ($def.fullTextSearch) { "$($def.fullTextSearch)" } else { "Use" } + $fullTextSearch = Get-EnumProp "FullTextSearch" "fullTextSearch" "Use" X "$i$fullTextSearch" X "$i" @@ -1955,7 +2039,7 @@ function Emit-CalculationRegisterProperties { if ($chartOfCalcTypes) { X "$i$chartOfCalcTypes" } else { X "$i" } - $periodicity = if ($def.periodicity) { "$($def.periodicity)" } else { "Month" } + $periodicity = Get-EnumProp "InformationRegisterPeriodicity" "periodicity" "Month" X "$i$periodicity" $actionPeriod = if ($def.actionPeriod -eq $true) { "true" } else { "false" } @@ -1977,10 +2061,10 @@ function Emit-CalculationRegisterProperties { Emit-StandardAttributes $i "CalculationRegister" - $dataLockControlMode = if ($def.dataLockControlMode) { "$($def.dataLockControlMode)" } else { "Automatic" } + $dataLockControlMode = Get-EnumProp "DataLockControlMode" "dataLockControlMode" "Automatic" X "$i$dataLockControlMode" - $fullTextSearch = if ($def.fullTextSearch) { "$($def.fullTextSearch)" } else { "Use" } + $fullTextSearch = Get-EnumProp "FullTextSearch" "fullTextSearch" "Use" X "$i$fullTextSearch" X "$i" @@ -1999,12 +2083,12 @@ function Emit-BusinessProcessProperties { X "$i" X "$itrue" - $editType = if ($def.editType) { "$($def.editType)" } else { "InDialog" } + $editType = Get-EnumProp "EditType" "editType" "InDialog" X "$i$editType" - $numberType = if ($def.numberType) { "$($def.numberType)" } else { "String" } + $numberType = Get-EnumProp "NumberType" "numberType" "String" $numberLength = if ($null -ne $def.numberLength) { "$($def.numberLength)" } else { "11" } - $numberAllowedLength = if ($def.numberAllowedLength) { "$($def.numberAllowedLength)" } else { "Variable" } + $numberAllowedLength = Get-EnumProp "NumberAllowedLength" "numberAllowedLength" "Variable" $checkUnique = if ($def.checkUnique -eq $false) { "false" } else { "true" } $autonumbering = if ($def.autonumbering -eq $false) { "false" } else { "true" } @@ -2041,10 +2125,10 @@ function Emit-BusinessProcessProperties { X "$ifalse" X "$i" - $dataLockControlMode = if ($def.dataLockControlMode) { "$($def.dataLockControlMode)" } else { "Automatic" } + $dataLockControlMode = Get-EnumProp "DataLockControlMode" "dataLockControlMode" "Automatic" X "$i$dataLockControlMode" - $fullTextSearch = if ($def.fullTextSearch) { "$($def.fullTextSearch)" } else { "Use" } + $fullTextSearch = Get-EnumProp "FullTextSearch" "fullTextSearch" "Use" X "$i$fullTextSearch" X "$i" @@ -2067,9 +2151,9 @@ function Emit-TaskProperties { X "$i" X "$itrue" - $numberType = if ($def.numberType) { "$($def.numberType)" } else { "String" } + $numberType = Get-EnumProp "NumberType" "numberType" "String" $numberLength = if ($null -ne $def.numberLength) { "$($def.numberLength)" } else { "14" } - $numberAllowedLength = if ($def.numberAllowedLength) { "$($def.numberAllowedLength)" } else { "Variable" } + $numberAllowedLength = Get-EnumProp "NumberAllowedLength" "numberAllowedLength" "Variable" $checkUnique = if ($def.checkUnique -eq $false) { "false" } else { "true" } $autonumbering = if ($def.autonumbering -eq $false) { "false" } else { "true" } @@ -2114,10 +2198,10 @@ function Emit-TaskProperties { X "$ifalse" X "$i" - $dataLockControlMode = if ($def.dataLockControlMode) { "$($def.dataLockControlMode)" } else { "Automatic" } + $dataLockControlMode = Get-EnumProp "DataLockControlMode" "dataLockControlMode" "Automatic" X "$i$dataLockControlMode" - $fullTextSearch = if ($def.fullTextSearch) { "$($def.fullTextSearch)" } else { "Use" } + $fullTextSearch = Get-EnumProp "FullTextSearch" "fullTextSearch" "Use" X "$i$fullTextSearch" X "$i" @@ -2144,7 +2228,7 @@ function Emit-HTTPServiceProperties { $rootURL = if ($def.rootURL) { "$($def.rootURL)" } else { $objName.ToLower() } X "$i$(Esc-Xml $rootURL)" - $reuseSessions = if ($def.reuseSessions) { "$($def.reuseSessions)" } else { "DontUse" } + $reuseSessions = Get-EnumProp "ReuseSessions" "reuseSessions" "DontUse" X "$i$reuseSessions" $sessionMaxAge = if ($null -ne $def.sessionMaxAge) { "$($def.sessionMaxAge)" } else { "20" } @@ -2165,7 +2249,7 @@ function Emit-WebServiceProperties { $xdtoPackages = if ($def.xdtoPackages) { "$($def.xdtoPackages)" } else { "" } if ($xdtoPackages) { X "$i$xdtoPackages" } else { X "$i" } - $reuseSessions = if ($def.reuseSessions) { "$($def.reuseSessions)" } else { "DontUse" } + $reuseSessions = Get-EnumProp "ReuseSessions" "reuseSessions" "DontUse" X "$i$reuseSessions" $sessionMaxAge = if ($null -ne $def.sessionMaxAge) { "$($def.sessionMaxAge)" } else { "20" } diff --git a/.claude/skills/meta-compile/scripts/meta-compile.py b/.claude/skills/meta-compile/scripts/meta-compile.py index c3ea7907..bfb79135 100644 --- a/.claude/skills/meta-compile/scripts/meta-compile.py +++ b/.claude/skills/meta-compile/scripts/meta-compile.py @@ -1,5 +1,5 @@ #!/usr/bin/env python3 -# meta-compile v1.3 — Compile 1C metadata object from JSON +# meta-compile v1.4 — Compile 1C metadata object from JSON # Source: https://github.com/Nikolay-Shirokov/cc-1c-skills import argparse @@ -139,6 +139,83 @@ object_type_synonyms = { 'ОпределяемыйТип': 'DefinedType', } +# Enum property value synonyms — model often gets these slightly wrong +enum_value_aliases = { + # RegisterType (AccumulationRegister) + 'Balances': 'Balance', 'Остатки': 'Balance', 'Обороты': 'Turnovers', + # WriteMode (InformationRegister) + 'RecordSubordinate': 'RecorderSubordinate', 'Subordinate': 'RecorderSubordinate', + 'ПодчинениеРегистратору': 'RecorderSubordinate', 'Независимый': 'Independent', + # DependenceOnCalculationTypes (ChartOfCalculationTypes) + 'NotDependOnCalculationTypes': 'DontUse', 'NoDependence': 'DontUse', + 'Depend': 'RequireCalculationTypes', 'RequireCalculation': 'RequireCalculationTypes', + # InformationRegisterPeriodicity + 'None': 'Nonperiodical', 'Daily': 'Day', 'Monthly': 'Month', + 'Quarterly': 'Quarter', 'Yearly': 'Year', + 'Непериодический': 'Nonperiodical', 'Секунда': 'Second', 'День': 'Day', + 'Месяц': 'Month', 'Квартал': 'Quarter', 'Год': 'Year', + 'ПозицияРегистратора': 'RecorderPosition', + # DataLockControlMode + 'Автоматический': 'Automatic', 'Управляемый': 'Managed', + # FullTextSearch + 'Использовать': 'Use', 'НеИспользовать': 'DontUse', + # Posting + 'Разрешить': 'Allow', 'Запретить': 'Deny', + # EditType + 'ВДиалоге': 'InDialog', 'ВСписке': 'InList', 'ОбаСпособа': 'BothWays', + # DefaultPresentation + 'ВВидеНаименования': 'AsDescription', 'ВВидеКода': 'AsCode', + # FillChecking + 'НеПроверять': 'DontCheck', 'Ошибка': 'ShowError', 'Предупреждение': 'ShowWarning', + # Indexing + 'НеИндексировать': 'DontIndex', 'Индексировать': 'Index', + 'ИндексироватьСДопУпорядочиванием': 'IndexWithAdditionalOrder', +} + +# Valid enum values per property (from meta-validate) +valid_enum_values = { + 'RegisterType': ['Balance', 'Turnovers'], + 'WriteMode': ['Independent', 'RecorderSubordinate'], + 'InformationRegisterPeriodicity': ['Nonperiodical', 'Second', 'Day', 'Month', 'Quarter', 'Year', 'RecorderPosition'], + 'DependenceOnCalculationTypes': ['DontUse', 'RequireCalculationTypes'], + 'DataLockControlMode': ['Automatic', 'Managed'], + 'FullTextSearch': ['Use', 'DontUse'], + 'DataHistory': ['Use', 'DontUse'], + 'DefaultPresentation': ['AsDescription', 'AsCode'], + 'Posting': ['Allow', 'Deny'], + 'RealTimePosting': ['Allow', 'Deny'], + 'EditType': ['InDialog', 'InList', 'BothWays'], + 'HierarchyType': ['HierarchyFoldersAndItems', 'HierarchyItemsOnly'], + 'CodeType': ['String', 'Number'], + 'CodeAllowedLength': ['Variable', 'Fixed'], + 'NumberType': ['String', 'Number'], + 'NumberAllowedLength': ['Variable', 'Fixed'], + 'RegisterRecordsDeletion': ['AutoDelete', 'AutoDeleteOnUnpost', 'AutoDeleteOff'], + 'RegisterRecordsWritingOnPost': ['WriteModified', 'WriteSelected', 'WriteAll'], + 'ReturnValuesReuse': ['DontUse', 'DuringRequest', 'DuringSession'], + 'ReuseSessions': ['DontUse', 'AutoUse'], + 'FillChecking': ['DontCheck', 'ShowError', 'ShowWarning'], + 'Indexing': ['DontIndex', 'Index', 'IndexWithAdditionalOrder'], +} + +def normalize_enum_value(prop_name, value): + # 1. Check alias dictionary + if value in enum_value_aliases: + return enum_value_aliases[value] + # 2. Case-insensitive match against valid values + valid = valid_enum_values.get(prop_name) + if valid: + for v in valid: + if v.lower() == value.lower(): + return v + # 3. Return as-is (validator will catch if wrong) + return value + +def get_enum_prop(prop_name, field_name, default): + val = defn.get(field_name) + raw = str(val) if val else default + return normalize_enum_value(prop_name, raw) + if not defn.get('type'): print("JSON must have 'type' field", file=sys.stderr) sys.exit(1) @@ -892,7 +969,7 @@ def emit_catalog_properties(indent): emit_mltext(i, 'Synonym', synonym) X(f'{i}') hierarchical = 'true' if defn.get('hierarchical') is True else 'false' - hierarchy_type = str(defn['hierarchyType']) if defn.get('hierarchyType') else 'HierarchyFoldersAndItems' + hierarchy_type = get_enum_prop('HierarchyType', 'hierarchyType', 'HierarchyFoldersAndItems') X(f'{i}{hierarchical}') X(f'{i}{hierarchy_type}') X(f'{i}false') @@ -903,8 +980,8 @@ def emit_catalog_properties(indent): X(f'{i}ToItems') code_length = str(defn['codeLength']) if defn.get('codeLength') is not None else '9' description_length = str(defn['descriptionLength']) if defn.get('descriptionLength') is not None else '25' - code_type = str(defn['codeType']) if defn.get('codeType') else 'String' - code_allowed_length = str(defn['codeAllowedLength']) if defn.get('codeAllowedLength') else 'Variable' + code_type = get_enum_prop('CodeType', 'codeType', 'String') + code_allowed_length = get_enum_prop('CodeAllowedLength', 'codeAllowedLength', 'Variable') autonumbering = 'false' if defn.get('autonumbering') is False else 'true' check_unique = 'true' if defn.get('checkUnique') is True else 'false' X(f'{i}{code_length}') @@ -914,7 +991,7 @@ def emit_catalog_properties(indent): X(f'{i}WholeCatalog') X(f'{i}{check_unique}') X(f'{i}{autonumbering}') - default_presentation = str(defn['defaultPresentation']) if defn.get('defaultPresentation') else 'AsDescription' + default_presentation = get_enum_prop('DefaultPresentation', 'defaultPresentation', 'AsDescription') X(f'{i}{default_presentation}') emit_standard_attributes(i, 'Catalog') X(f'{i}') @@ -942,9 +1019,9 @@ def emit_catalog_properties(indent): X(f'{i}false') X(f'{i}') X(f'{i}') - data_lock_control_mode = str(defn['dataLockControlMode']) if defn.get('dataLockControlMode') else 'Automatic' + data_lock_control_mode = get_enum_prop('DataLockControlMode', 'dataLockControlMode', 'Automatic') X(f'{i}{data_lock_control_mode}') - full_text_search = str(defn['fullTextSearch']) if defn.get('fullTextSearch') else 'Use' + full_text_search = get_enum_prop('FullTextSearch', 'fullTextSearch', 'Use') X(f'{i}{full_text_search}') X(f'{i}') X(f'{i}') @@ -964,10 +1041,10 @@ def emit_document_properties(indent): X(f'{i}') X(f'{i}true') X(f'{i}') - number_type = str(defn['numberType']) if defn.get('numberType') else 'String' + number_type = get_enum_prop('NumberType', 'numberType', 'String') number_length = str(defn['numberLength']) if defn.get('numberLength') is not None else '11' - number_allowed_length = str(defn['numberAllowedLength']) if defn.get('numberAllowedLength') else 'Variable' - number_periodicity = str(defn['numberPeriodicity']) if defn.get('numberPeriodicity') else 'Year' + number_allowed_length = get_enum_prop('NumberAllowedLength', 'numberAllowedLength', 'Variable') + number_periodicity = get_enum_prop('InformationRegisterPeriodicity', 'numberPeriodicity', 'Year') check_unique = 'false' if defn.get('checkUnique') is False else 'true' autonumbering = 'false' if defn.get('autonumbering') is False else 'true' X(f'{i}{number_type}') @@ -992,10 +1069,10 @@ def emit_document_properties(indent): X(f'{i}') X(f'{i}') X(f'{i}') - posting = str(defn['posting']) if defn.get('posting') else 'Allow' - real_time_posting = str(defn['realTimePosting']) if defn.get('realTimePosting') else 'Deny' - reg_records_deletion = str(defn['registerRecordsDeletion']) if defn.get('registerRecordsDeletion') else 'AutoDelete' - reg_records_writing = str(defn['registerRecordsWritingOnPost']) if defn.get('registerRecordsWritingOnPost') else 'WriteModified' + posting = get_enum_prop('Posting', 'posting', 'Allow') + real_time_posting = get_enum_prop('RealTimePosting', 'realTimePosting', 'Deny') + reg_records_deletion = get_enum_prop('RegisterRecordsDeletion', 'registerRecordsDeletion', 'AutoDelete') + reg_records_writing = get_enum_prop('RegisterRecordsWritingOnPost', 'registerRecordsWritingOnPost', 'WriteModified') sequence_filling = str(defn['sequenceFilling']) if defn.get('sequenceFilling') else 'AutoFill' post_in_priv = 'false' if defn.get('postInPrivilegedMode') is False else 'true' unpost_in_priv = 'false' if defn.get('unpostInPrivilegedMode') is False else 'true' @@ -1029,9 +1106,9 @@ def emit_document_properties(indent): X(f'{i}{unpost_in_priv}') X(f'{i}false') X(f'{i}') - data_lock_control_mode = str(defn['dataLockControlMode']) if defn.get('dataLockControlMode') else 'Automatic' + data_lock_control_mode = get_enum_prop('DataLockControlMode', 'dataLockControlMode', 'Automatic') X(f'{i}{data_lock_control_mode}') - full_text_search = str(defn['fullTextSearch']) if defn.get('fullTextSearch') else 'Use' + full_text_search = get_enum_prop('FullTextSearch', 'fullTextSearch', 'Use') X(f'{i}{full_text_search}') X(f'{i}') X(f'{i}') @@ -1092,7 +1169,7 @@ def emit_constant_properties(indent): X(f'{i}') X(f'{i}') X(f'{i}Auto') - data_lock_control_mode = str(defn['dataLockControlMode']) if defn.get('dataLockControlMode') else 'Automatic' + data_lock_control_mode = get_enum_prop('DataLockControlMode', 'dataLockControlMode', 'Automatic') X(f'{i}{data_lock_control_mode}') X(f'{i}DontUse') X(f'{i}false') @@ -1110,8 +1187,8 @@ def emit_information_register_properties(indent): X(f'{i}') X(f'{i}') emit_standard_attributes(i, 'InformationRegister') - periodicity = str(defn['periodicity']) if defn.get('periodicity') else 'Nonperiodical' - write_mode = str(defn['writeMode']) if defn.get('writeMode') else 'Independent' + periodicity = get_enum_prop('InformationRegisterPeriodicity', 'periodicity', 'Nonperiodical') + write_mode = get_enum_prop('WriteMode', 'writeMode', 'Independent') main_filter_on_period = 'false' if defn.get('mainFilterOnPeriod') is not None: main_filter_on_period = 'true' if defn['mainFilterOnPeriod'] is True else 'false' @@ -1121,9 +1198,9 @@ def emit_information_register_properties(indent): X(f'{i}{write_mode}') X(f'{i}{main_filter_on_period}') X(f'{i}false') - data_lock_control_mode = str(defn['dataLockControlMode']) if defn.get('dataLockControlMode') else 'Automatic' + data_lock_control_mode = get_enum_prop('DataLockControlMode', 'dataLockControlMode', 'Automatic') X(f'{i}{data_lock_control_mode}') - full_text_search = str(defn['fullTextSearch']) if defn.get('fullTextSearch') else 'Use' + full_text_search = get_enum_prop('FullTextSearch', 'fullTextSearch', 'Use') X(f'{i}{full_text_search}') X(f'{i}false') X(f'{i}false') @@ -1144,13 +1221,13 @@ def emit_accumulation_register_properties(indent): X(f'{i}true') X(f'{i}') X(f'{i}') - register_type = str(defn['registerType']) if defn.get('registerType') else 'Balance' + register_type = get_enum_prop('RegisterType', 'registerType', 'Balance') X(f'{i}{register_type}') X(f'{i}false') emit_standard_attributes(i, 'AccumulationRegister') - data_lock_control_mode = str(defn['dataLockControlMode']) if defn.get('dataLockControlMode') else 'Automatic' + data_lock_control_mode = get_enum_prop('DataLockControlMode', 'dataLockControlMode', 'Automatic') X(f'{i}{data_lock_control_mode}') - full_text_search = str(defn['fullTextSearch']) if defn.get('fullTextSearch') else 'Use' + full_text_search = get_enum_prop('FullTextSearch', 'fullTextSearch', 'Use') X(f'{i}{full_text_search}') enable_totals_splitting = 'false' if defn.get('enableTotalsSplitting') is False else 'true' X(f'{i}{enable_totals_splitting}') @@ -1231,7 +1308,7 @@ def emit_common_module_properties(indent): X(f'{i}{client_ordinary}') X(f'{i}{server_call}') X(f'{i}{privileged}') - return_values_reuse = str(defn['returnValuesReuse']) if defn.get('returnValuesReuse') else 'DontUse' + return_values_reuse = get_enum_prop('ReturnValuesReuse', 'returnValuesReuse', 'DontUse') X(f'{i}{return_values_reuse}') def emit_scheduled_job_properties(indent): @@ -1353,7 +1430,7 @@ def emit_exchange_plan_properties(indent): X(f'{i}true') code_length = str(defn['codeLength']) if defn.get('codeLength') is not None else '9' description_length = str(defn['descriptionLength']) if defn.get('descriptionLength') is not None else '100' - code_allowed_length = str(defn['codeAllowedLength']) if defn.get('codeAllowedLength') else 'Variable' + code_allowed_length = get_enum_prop('CodeAllowedLength', 'codeAllowedLength', 'Variable') X(f'{i}{code_length}') X(f'{i}{code_allowed_length}') X(f'{i}{description_length}') @@ -1382,9 +1459,9 @@ def emit_exchange_plan_properties(indent): X(f'{i}') X(f'{i}false') X(f'{i}') - data_lock_control_mode = str(defn['dataLockControlMode']) if defn.get('dataLockControlMode') else 'Automatic' + data_lock_control_mode = get_enum_prop('DataLockControlMode', 'dataLockControlMode', 'Automatic') X(f'{i}{data_lock_control_mode}') - full_text_search = str(defn['fullTextSearch']) if defn.get('fullTextSearch') else 'Use' + full_text_search = get_enum_prop('FullTextSearch', 'fullTextSearch', 'Use') X(f'{i}{full_text_search}') X(f'{i}') X(f'{i}') @@ -1405,7 +1482,7 @@ def emit_chart_of_characteristic_types_properties(indent): X(f'{i}true') code_length = str(defn['codeLength']) if defn.get('codeLength') is not None else '9' description_length = str(defn['descriptionLength']) if defn.get('descriptionLength') is not None else '25' - code_allowed_length = str(defn['codeAllowedLength']) if defn.get('codeAllowedLength') else 'Variable' + code_allowed_length = get_enum_prop('CodeAllowedLength', 'codeAllowedLength', 'Variable') autonumbering = 'false' if defn.get('autonumbering') is False else 'true' check_unique = 'true' if defn.get('checkUnique') is True else 'false' X(f'{i}{code_length}') @@ -1473,9 +1550,9 @@ def emit_chart_of_characteristic_types_properties(indent): X(f'{i}false') X(f'{i}') X(f'{i}') - data_lock_control_mode = str(defn['dataLockControlMode']) if defn.get('dataLockControlMode') else 'Automatic' + data_lock_control_mode = get_enum_prop('DataLockControlMode', 'dataLockControlMode', 'Automatic') X(f'{i}{data_lock_control_mode}') - full_text_search = str(defn['fullTextSearch']) if defn.get('fullTextSearch') else 'Use' + full_text_search = get_enum_prop('FullTextSearch', 'fullTextSearch', 'Use') X(f'{i}{full_text_search}') X(f'{i}') X(f'{i}') @@ -1585,9 +1662,9 @@ def emit_chart_of_accounts_properties(indent): X(f'{i}false') X(f'{i}') X(f'{i}') - data_lock_control_mode = str(defn['dataLockControlMode']) if defn.get('dataLockControlMode') else 'Automatic' + data_lock_control_mode = get_enum_prop('DataLockControlMode', 'dataLockControlMode', 'Automatic') X(f'{i}{data_lock_control_mode}') - full_text_search = str(defn['fullTextSearch']) if defn.get('fullTextSearch') else 'Use' + full_text_search = get_enum_prop('FullTextSearch', 'fullTextSearch', 'Use') X(f'{i}{full_text_search}') X(f'{i}') X(f'{i}') @@ -1619,9 +1696,9 @@ def emit_accounting_register_properties(indent): X(f'{i}{period_adj_len}') X(f'{i}false') emit_standard_attributes(i, 'AccountingRegister') - data_lock_control_mode = str(defn['dataLockControlMode']) if defn.get('dataLockControlMode') else 'Automatic' + data_lock_control_mode = get_enum_prop('DataLockControlMode', 'dataLockControlMode', 'Automatic') X(f'{i}{data_lock_control_mode}') - full_text_search = str(defn['fullTextSearch']) if defn.get('fullTextSearch') else 'Use' + full_text_search = get_enum_prop('FullTextSearch', 'fullTextSearch', 'Use') X(f'{i}{full_text_search}') X(f'{i}') X(f'{i}') @@ -1635,14 +1712,14 @@ def emit_chart_of_calculation_types_properties(indent): X(f'{i}true') code_length = str(defn['codeLength']) if defn.get('codeLength') is not None else '9' description_length = str(defn['descriptionLength']) if defn.get('descriptionLength') is not None else '25' - code_type = str(defn['codeType']) if defn.get('codeType') else 'String' - code_allowed_length = str(defn['codeAllowedLength']) if defn.get('codeAllowedLength') else 'Variable' + code_type = get_enum_prop('CodeType', 'codeType', 'String') + code_allowed_length = get_enum_prop('CodeAllowedLength', 'codeAllowedLength', 'Variable') X(f'{i}{code_length}') X(f'{i}{code_type}') X(f'{i}{code_allowed_length}') X(f'{i}{description_length}') X(f'{i}AsDescription') - dependence = str(defn['dependenceOnCalculationTypes']) if defn.get('dependenceOnCalculationTypes') else 'DontUse' + dependence = get_enum_prop('DependenceOnCalculationTypes', 'dependenceOnCalculationTypes', 'DontUse') X(f'{i}{dependence}') base_types = list(defn.get('baseCalculationTypes', [])) if base_types: @@ -1676,9 +1753,9 @@ def emit_chart_of_calculation_types_properties(indent): X(f'{i}false') X(f'{i}') X(f'{i}') - data_lock_control_mode = str(defn['dataLockControlMode']) if defn.get('dataLockControlMode') else 'Automatic' + data_lock_control_mode = get_enum_prop('DataLockControlMode', 'dataLockControlMode', 'Automatic') X(f'{i}{data_lock_control_mode}') - full_text_search = str(defn['fullTextSearch']) if defn.get('fullTextSearch') else 'Use' + full_text_search = get_enum_prop('FullTextSearch', 'fullTextSearch', 'Use') X(f'{i}{full_text_search}') X(f'{i}') X(f'{i}') @@ -1701,7 +1778,7 @@ def emit_calculation_register_properties(indent): X(f'{i}{chart_of_calc_types}') else: X(f'{i}') - periodicity = str(defn['periodicity']) if defn.get('periodicity') else 'Month' + periodicity = get_enum_prop('InformationRegisterPeriodicity', 'periodicity', 'Month') X(f'{i}{periodicity}') action_period = 'true' if defn.get('actionPeriod') is True else 'false' X(f'{i}{action_period}') @@ -1724,9 +1801,9 @@ def emit_calculation_register_properties(indent): X(f'{i}') X(f'{i}false') emit_standard_attributes(i, 'CalculationRegister') - data_lock_control_mode = str(defn['dataLockControlMode']) if defn.get('dataLockControlMode') else 'Automatic' + data_lock_control_mode = get_enum_prop('DataLockControlMode', 'dataLockControlMode', 'Automatic') X(f'{i}{data_lock_control_mode}') - full_text_search = str(defn['fullTextSearch']) if defn.get('fullTextSearch') else 'Use' + full_text_search = get_enum_prop('FullTextSearch', 'fullTextSearch', 'Use') X(f'{i}{full_text_search}') X(f'{i}') X(f'{i}') @@ -1738,11 +1815,11 @@ def emit_business_process_properties(indent): emit_mltext(i, 'Synonym', synonym) X(f'{i}') X(f'{i}true') - edit_type = str(defn['editType']) if defn.get('editType') else 'InDialog' + edit_type = get_enum_prop('EditType', 'editType', 'InDialog') X(f'{i}{edit_type}') - number_type = str(defn['numberType']) if defn.get('numberType') else 'String' + number_type = get_enum_prop('NumberType', 'numberType', 'String') number_length = str(defn['numberLength']) if defn.get('numberLength') is not None else '11' - number_allowed_length = str(defn['numberAllowedLength']) if defn.get('numberAllowedLength') else 'Variable' + number_allowed_length = get_enum_prop('NumberAllowedLength', 'numberAllowedLength', 'Variable') check_unique = 'false' if defn.get('checkUnique') is False else 'true' autonumbering = 'false' if defn.get('autonumbering') is False else 'true' X(f'{i}{number_type}') @@ -1773,9 +1850,9 @@ def emit_business_process_properties(indent): X(f'{i}') X(f'{i}false') X(f'{i}') - data_lock_control_mode = str(defn['dataLockControlMode']) if defn.get('dataLockControlMode') else 'Automatic' + data_lock_control_mode = get_enum_prop('DataLockControlMode', 'dataLockControlMode', 'Automatic') X(f'{i}{data_lock_control_mode}') - full_text_search = str(defn['fullTextSearch']) if defn.get('fullTextSearch') else 'Use' + full_text_search = get_enum_prop('FullTextSearch', 'fullTextSearch', 'Use') X(f'{i}{full_text_search}') X(f'{i}') X(f'{i}') @@ -1793,9 +1870,9 @@ def emit_task_properties(indent): emit_mltext(i, 'Synonym', synonym) X(f'{i}') X(f'{i}true') - number_type = str(defn['numberType']) if defn.get('numberType') else 'String' + number_type = get_enum_prop('NumberType', 'numberType', 'String') number_length = str(defn['numberLength']) if defn.get('numberLength') is not None else '14' - number_allowed_length = str(defn['numberAllowedLength']) if defn.get('numberAllowedLength') else 'Variable' + number_allowed_length = get_enum_prop('NumberAllowedLength', 'numberAllowedLength', 'Variable') check_unique = 'false' if defn.get('checkUnique') is False else 'true' autonumbering = 'false' if defn.get('autonumbering') is False else 'true' task_number_auto_prefix = str(defn['taskNumberAutoPrefix']) if defn.get('taskNumberAutoPrefix') else 'BusinessProcessNumber' @@ -1840,9 +1917,9 @@ def emit_task_properties(indent): X(f'{i}') X(f'{i}false') X(f'{i}') - data_lock_control_mode = str(defn['dataLockControlMode']) if defn.get('dataLockControlMode') else 'Automatic' + data_lock_control_mode = get_enum_prop('DataLockControlMode', 'dataLockControlMode', 'Automatic') X(f'{i}{data_lock_control_mode}') - full_text_search = str(defn['fullTextSearch']) if defn.get('fullTextSearch') else 'Use' + full_text_search = get_enum_prop('FullTextSearch', 'fullTextSearch', 'Use') X(f'{i}{full_text_search}') X(f'{i}') X(f'{i}') @@ -1861,7 +1938,7 @@ def emit_http_service_properties(indent): X(f'{i}') root_url = str(defn['rootURL']) if defn.get('rootURL') else obj_name.lower() X(f'{i}{esc_xml(root_url)}') - reuse_sessions = str(defn['reuseSessions']) if defn.get('reuseSessions') else 'DontUse' + reuse_sessions = get_enum_prop('ReuseSessions', 'reuseSessions', 'DontUse') X(f'{i}{reuse_sessions}') session_max_age = str(defn['sessionMaxAge']) if defn.get('sessionMaxAge') is not None else '20' X(f'{i}{session_max_age}') @@ -1878,7 +1955,7 @@ def emit_web_service_properties(indent): X(f'{i}{xdto_packages}') else: X(f'{i}') - reuse_sessions = str(defn['reuseSessions']) if defn.get('reuseSessions') else 'DontUse' + reuse_sessions = get_enum_prop('ReuseSessions', 'reuseSessions', 'DontUse') X(f'{i}{reuse_sessions}') session_max_age = str(defn['sessionMaxAge']) if defn.get('sessionMaxAge') is not None else '20' X(f'{i}{session_max_age}')