Commit daa70b99 authored by Mark Canterbury's avatar Mark Canterbury
Browse files

Updating XML-JSON translation

parent 9f981102
Loading
Loading
Loading
Loading
+23 −1
Original line number Diff line number Diff line
@@ -66,7 +66,12 @@ coerce_to_list = [
    'task:LDTaskFlag',
    'task:TrafficPolicyReference',
    'tp:TrafficRuleReference',
    'tp:Criteria'
    'tp:Criteria',
    'common:DictionaryEntry',
    'dictionaries:Dictionary',
    'config:TargetFormatTypeDefinitionEntry',
    'config:SupportedLIWorkflowEndpoint',
    'config:SupportedLPWorkflowEndpoint',
]

coerce_to_int = [
@@ -81,6 +86,18 @@ coerce_to_bool = [
    'delivery:LastSequence'
]

coerce_to_empty = [
    'CONFIG'
]

coerce_null_to_empty = [
    'SupportedLIWorkflowEndpoints',
    'SupportedLPWorkflowEndpoints',
    'config:AssociatedLDRequestSubtypes',
    'config:AssociatedLPRequestSubtypes',
    'config:AssociatedLIRequestSubtypes',
]

def postprocessor (path, key, value):
    if key == "@xsi:type":
        object_name = value.split(":")[-1]
@@ -91,6 +108,11 @@ def postprocessor (path, key, value):
        return key, int(value)
    if key in coerce_to_bool:
        return key, bool(value)
    if key in coerce_to_empty:
        return key, {}
    if key in coerce_null_to_empty:
        if value is None:
            return key, {}
    return key, value

if __name__ == "__main__":