Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Schema 1.0 #96

Merged
merged 3 commits into from
Sep 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion schema/composition/animation.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"title": "Specification Version",
"description": "Specification version this Lottie is targeting. This is a 6 digit number with version components encoded as `MMmmpp`, with `MM` being major version, `mm` being minor and `pp` being patch.",
"type": "integer",
"minimum": 100
"minimum": 10000
},
"fr": {
"title": "Framerate",
Expand Down
4 changes: 2 additions & 2 deletions schema/root.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://lottie.github.io/lottie-spec/specs/schema/0.1.0",
"$id": "https://lottie.github.io/lottie-spec/1.0/specs/schema/",
"$ref": "#/$defs/composition/animation",
"$version": 100
"$version": 10000
}
18 changes: 11 additions & 7 deletions tools/schema-validate.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,16 +70,20 @@ def collect_defs(self, schema):
self.collect_defs(child)

def check_version(self, schema: Schema):
versionNumber = schema["$version"]
version_number = schema["$version"]

majorVersion = versionNumber // 10000
minorVersion = (versionNumber % 10000) // 100
patchVersion = versionNumber % 100
major_version = version_number // 10000
minor_version = (version_number % 10000) // 100
patch_version = version_number % 100

versionString = f'{majorVersion}.{minorVersion}.{patchVersion}'
components = [major_version, minor_version]
if patch_version != 0:
components.append(patch_version)

if versionString not in schema["$id"]:
self.error(schema, "Mismatched URI version - expected: %s" % versionString)
version_string = ".".join(map(str, components))

if version_string not in schema["$id"]:
self.error(schema, "Mismatched URI version - expected: %s" % version_string)

def check_links(self, html_path: pathlib.Path):
checked = set()
Expand Down