# Buggy code
def schema_cleanup(schema):
    # Sanity check first
    schema_mandatory_attributes(schema)
    # trailing space cleanup
    ecs_helpers.dict_clean_string_values(schema["schema_details"])
    ecs_helpers.dict_clean_string_values(schema["field_details"])
    # Some defaults
    schema["schema_details"].setdefault("group", 2)
    schema["schema_details"].setdefault("root", False)
    schema["field_details"].setdefault("type", "group")
    schema["field_details"].setdefault("short", schema["field_details"]["description"])
    if "reusable" in schema["schema_details"]:
        # order to perform chained reuses. Set to 1 if it needs to happen earlier.
        schema["schema_details"]["reusable"].setdefault("order", 2)
    # Precalculate stuff. Those can't be set in the YAML.
    if schema["schema_details"]["root"]:
        schema["schema_details"]["prefix"] = ""
    else:
        schema["schema_details"]["prefix"] = schema["field_details"]["name"] + "."
    normalize_reuse_notation(schema)
    # Final validity check
    schema_assertions_and_warnings(schema)


# Traceback (ValueError)
$ python scripts/generator.py --ref v1.5.0
Loading schemas from git ref v1.5.0
Running generator. ECS version 1.5.0
Traceback (most recent call last):
File "scripts/generator.py", line 94, in <module>
main()
File "scripts/generator.py", line 44, in main
cleaner.clean(fields)
File "<redacted>/ecs/scripts/schema/cleaner.py", line 23, in clean
visitor.visit_fields(fields, fieldset_func=schema_cleanup, field_func=field_cleanup)
File "<redacted>/ecs/scripts/schema/visitor.py", line 21, in visit_fields
visit_fields(details['fields'],
File "<redacted>/ecs/scripts/schema/visitor.py", line 19, in visit_fields
field_func(details)
File "<redacted>/ecs/scripts/schema/cleaner.py", line 125, in field_cleanup
field_assertions_and_warnings(field)
File "<redacted>/ecs/scripts/schema/cleaner.py", line 168, in field_assertions_and_warnings
single_line_short_description(field)
File "<redacted>/ecs/scripts/schema/cleaner.py", line 189, in single_line_short_description
raise ValueError(msg)
ValueError: Short descriptions must be single line, and under 120 characters (current length: 134).
Offending field or field set: number
Short description:
Unique number allocated to the autonomous system. The autonomous system number (ASN) uniquely identifies each network on the Internet.

# Fixed code
def schema_cleanup(schema):
    # Sanity check first
    schema_mandatory_attributes(schema)
    # trailing space cleanup
    ecs_helpers.dict_clean_string_values(schema["schema_details"])
    ecs_helpers.dict_clean_string_values(schema["field_details"])
    # Some defaults
    schema["schema_details"].setdefault("group", 2)
    schema["schema_details"].setdefault("root", False)
    schema["field_details"].setdefault("type", "group")
    schema["field_details"].setdefault("short", schema["field_details"]["description"])
    if "reusable" in schema["schema_details"]:
        # order to perform chained reuses. Set to 1 if it needs to happen earlier.
        schema["schema_details"]["reusable"].setdefault("order", 2)
    # Precalculate stuff. Those can't be set in the YAML.
    if schema["schema_details"]["root"]:
        schema["schema_details"]["prefix"] = ""
    else:
        schema["schema_details"]["prefix"] = schema["field_details"]["name"] + "."
    normalize_reuse_notation(schema)
    # Final validity check if in strict mode
    schema_assertions_and_warnings(schema)