if "definitions" in schema.keys():
     candidates = [[name,attributes] for name,attributes in schema["definitions"].items()]
 
 # here we recursively traverse the schema tree, collecting all the bona fide objects and enums
 master_enum_added=False
 while len(candidates):
     name,attributes = candidates[0]
     candidates = candidates[1:]
     if len(attributes) == 0: continue;
 
     if "$ref" in attributes: continue
     if attributes["type"] == "string":
         if "enum" in attributes.keys():
             if name[-8:] == "EnumType":
                 scheme.enums.append(ocpp2_schema.create("Enum", name=ocpp2_schema.digit_prefix(name), attributes=attributes))
             elif name == "status":
                 # this one is weird - it's as though the schema providers have an anomalous inconsistency 
                 pass
             else:
                 pass
         else: pass 
     elif attributes["type"] == "object":
         scheme.objects.append(ocpp2_schema.create("Object", name=name, attributes=attributes, master=None))
         candidates.extend([[name,attributes] for name,attributes in attributes["properties"].items()])
     elif attributes["type"] == "array":
         # hmmm...
         pass
     elif attributes["type"] == "integer":
         pass
     elif attributes["type"] == "number":
Ejemplo n.º 2
0
                  for name, attributes in schema["definitions"].items()]

# here we recursively traverse the schema tree, collecting all the bona fide objects and enums
master_enum_added = False
while len(candidates):
    name, attributes = candidates[0]
    candidates = candidates[1:]
    if len(attributes) == 0: continue

    if "$ref" in attributes: continue
    if attributes["type"] == "string":
        if "enum" in attributes.keys():
            if name[-8:] == "EnumType":
                scheme.enums.append(
                    ocpp2_schema.create("Enum",
                                        name=ocpp2_schema.digit_prefix(name),
                                        attributes=attributes))
            elif name == "status":
                # this one is weird - it's as though the schema providers have an anomalous inconsistency
                pass
            else:
                pass
        else:
            pass
    elif attributes["type"] == "object":
        scheme.objects.append(
            ocpp2_schema.create("Object",
                                name=name,
                                attributes=attributes,
                                master=None))
        candidates.extend(