Skip to content

Commit

Permalink
Schema 1.0 (#96)
Browse files Browse the repository at this point in the history
* Bump specs version to 1.0

* Too many 00

* Allow version numbers without patch
  • Loading branch information
mbasaglia authored Sep 17, 2024
1 parent 51d85a2 commit 61525d7
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 10 deletions.
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

0 comments on commit 61525d7

Please sign in to comment.