INNER CODE UNIT · Python
field
RockxyApp/Rockxy · releases/validate_metadata.py:176
def field(snake: str, camel: str) -> str:
return snake if snake_case else camel
if data[field("binary_license", "binaryLicense")] != "Rockxy Binary EULA v1.0":
fail(f"{path} must identify Rockxy Binary EULA v1.0")
if data[field("public_source_edition_license", "publicSourceEditionLicense")] != "AGPL-3.0-or-later":
fail(f"{path} must identify the public source edition as AGPL-3.0-or-later")
if data[field("source_relationship", "sourceRelationship")] != "separate-source-edition":
fail(f"{path} must identify the public source as a separate source edition")
if data[field("community_mode_available_without_purchase", "communityModeAvailableWithoutPurchase")] is not True:
fail(f"{path} must record that Community mode is available without purchase")
commit = str(data[field("public_source_commit", "publicSourceCommit")])
if not re.fullmatch(r"[0-9a-f]{40}", commit):
fail(f"{path} public source commit must be a full Git SHA")
notices_sha = str(data[field("third_party_notices_sha256", "thirdPartyNoticesSha256")])
if not re.fullmatch(r"[0-9a-f]{64}", notices_sha):
fail(f"{path} third-party notices digest must be a SHA-256 hex digest")