{"id":10348,"library":"weblate-schemas","title":"Weblate Schemas","description":"A collection of JSON schemas used by Weblate for various objects and APIs. This library provides a programmatic way to access and retrieve these schemas as Python dictionaries, often used in conjunction with the `jsonschema` library for validation. It follows a calendar versioning scheme (YYYY.M) with regular monthly releases.","status":"active","version":"2025.6","language":"en","source_language":"en","source_url":"https://github.com/WeblateOrg/weblate-schemas","tags":["json-schema","weblate","validation","schema-definitions"],"install":[{"cmd":"pip install weblate-schemas","lang":"bash","label":"Install stable version"}],"dependencies":[],"imports":[{"symbol":"get_schema","correct":"from weblate_schemas import get_schema"},{"symbol":"list_schemas","correct":"from weblate_schemas import list_schemas"}],"quickstart":{"code":"from weblate_schemas import get_schema, list_schemas\nimport json\n\n# List available schemas\navailable_schemas = list_schemas()\nprint(f\"Available schemas: {available_schemas[:3]}...\")\n\n# Retrieve a specific schema (e.g., component.json)\ntry:\n    component_schema = get_schema('component.json')\n    print(f\"\\nSuccessfully loaded 'component.json' schema. First 100 chars:\\n{json.dumps(component_schema, indent=2)[:100]}...\")\nexcept KeyError:\n    print(\"\\n'component.json' not found. Please check available schemas.\")\n\n# Example of how you might use it with jsonschema (requires pip install jsonschema)\n# from jsonschema import validate, ValidationError\n# data_to_validate = {\"name\": \"My Component\", \"slug\": \"my-component\"}\n# try:\n#     validate(instance=data_to_validate, schema=component_schema)\n#     print(\"\\nData is valid against 'component.json' schema.\")\n# except ValidationError as e:\n#     print(f\"\\nData validation failed: {e.message}\")","lang":"python","description":"Demonstrates how to list available schemas and retrieve a specific schema using `get_schema`. The schemas are returned as Python dictionaries, ready for use with a JSON schema validator like `jsonschema` (not directly imported here as it's an external dependency for validation, not schema retrieval)."},"warnings":[{"fix":"Always test your schema consumers (e.g., validation logic) after updating `weblate-schemas`. Pin to specific versions (e.g., `weblate-schemas==2025.6`) to ensure schema stability, but be aware this may miss new features or bug fixes.","message":"The *structure* of specific schemas (e.g., fields, types, required properties) can change between versions. While the `get_schema` Python API remains stable, applications validating against older schema definitions may break with new schema versions.","severity":"breaking","affected_versions":"All versions"},{"fix":"Use `from weblate_schemas import list_schemas; list_schemas()` to get a current list of all available schema names before attempting to retrieve a specific one with `get_schema()`.","message":"Schema names are case-sensitive and must exactly match the internal registry (e.g., 'component.json' vs 'Component.json'). Requesting a non-existent schema will raise a `KeyError`.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Be mindful of frequent releases. If strict schema stability is required, pin to a specific `weblate-schemas` version. For development, consider using `pip install --pre weblate-schemas` to get the latest pre-release, but lock down for production.","message":"This library uses calendar versioning (YYYY.M), meaning new versions are released monthly. This implies frequent updates to schema definitions, which can introduce changes to existing schemas or add new ones.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-04-17T00:00:00.000Z","next_check":"2026-07-16T00:00:00.000Z","problems":[{"fix":"First, list all available schemas using `from weblate_schemas import list_schemas; print(list_schemas())` to verify the correct schema name. Then, call `get_schema()` with the exact, correct name.","cause":"You attempted to retrieve a schema using `get_schema('non_existent_schema.json')` with a name that either does not exist or has a typo (case sensitivity matters).","error":"KeyError: 'non_existent_schema.json'"},{"fix":"Install the package using pip: `pip install weblate-schemas`. If using virtual environments, ensure your environment is activated before running your Python script.","cause":"The `weblate-schemas` package has not been installed in your current Python environment, or the environment is not activated.","error":"ModuleNotFoundError: No module named 'weblate_schemas'"}]}