示例#1
0
# Dictionary of entities that need to be present.
# If the schema has been updated recently and you want to ensure certain fields are present,
# you can set an array of fields to validate for each entity.
schema_requirements = {
    # This is a builtin entity that is disabled by default.
    "Scene": [],
    # Simply turn these on. Nothing else to do.
    "CustomEntity02": [],
    "CustomEntity03": [],
}

# Ensure every entity is present and their fields.
for entity, fields in schema_requirements.items():
    if entity not in list(schema.keys()):
        errors.append("Entity '%s' is missing." % entity)

    for field in fields:
        if field not in schema[entity]:
            errors.append(
                "Missing field '%s' on entity 'PipelineConfiguration'." %
                field)

if errors:
    print("There are problems with the schema:")
    for e in errors:
        print("-", e)
else:
    print("Saving schema...")
    mockgun.generate_schema(sg, "schema.pickle", "schema_entity.pickle")
    print("Schema cloning completed!")
示例#2
0
print "Validating schema..."
errors = []

# Dictionary of entities that need to be present.
# If the schema has been updated recently and you want to ensure certain fields are present,
# you can set an array of fields to validate for each entity.
schema_requirements = {
    # This is a builtin entity that is disabled by default.
    "Scene": [],
    # Simply turn this one on. Nothing else to do.
    "CustomEntity02": []
}

# Ensure every entity is present and their fields.
for entity, fields in schema_requirements.iteritems():
    if entity not in schema.keys():
        errors.append("Entity '%s' is missing." % entity)

    for field in fields:
        if field not in schema[entity]:
            errors.append("Missing field '%s' on entity 'PipelineConfiguration'." % field)

if errors:
    print "There are problems with the schema:"
    for e in errors:
        print "-", e
else:
    print "Saving schema..."
    mockgun.generate_schema(sg, "schema.pickle", "schema_entity.pickle")
    print "Schema cloning completed!"