{"id":16868686,"url":"https://github.com/vltr/middle-schema","last_synced_at":"2026-04-20T03:32:13.287Z","repository":{"id":57441584,"uuid":"142580855","full_name":"vltr/middle-schema","owner":"vltr","description":"Translate your middle model declarations to OpenAPI, JSONSchema or any other schema you need","archived":false,"fork":false,"pushed_at":"2019-10-03T16:35:03.000Z","size":73,"stargazers_count":2,"open_issues_count":2,"forks_count":0,"subscribers_count":2,"default_branch":"develop","last_synced_at":"2025-03-13T12:48:25.092Z","etag":null,"topics":["customizable","hooks","jsonschema","middle","models","openapi","schema","swagger"],"latest_commit_sha":null,"homepage":"https://middle-schema.readthedocs.io/en/latest/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/vltr.png","metadata":{"files":{"readme":"README.rst","changelog":"CHANGELOG.rst","contributing":"CONTRIBUTING.rst","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-07-27T13:30:42.000Z","updated_at":"2019-02-06T15:35:22.000Z","dependencies_parsed_at":"2022-09-06T02:21:53.122Z","dependency_job_id":null,"html_url":"https://github.com/vltr/middle-schema","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vltr%2Fmiddle-schema","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vltr%2Fmiddle-schema/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vltr%2Fmiddle-schema/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vltr%2Fmiddle-schema/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vltr","download_url":"https://codeload.github.com/vltr/middle-schema/tar.gz/refs/heads/develop","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247332524,"owners_count":20921852,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["customizable","hooks","jsonschema","middle","models","openapi","schema","swagger"],"created_at":"2024-10-13T14:59:08.630Z","updated_at":"2026-04-20T03:32:08.257Z","avatar_url":"https://github.com/vltr.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"=================\n``middle-schema``\n=================\n\n.. start-badges\n\n.. image:: https://img.shields.io/pypi/status/middle-schema.svg\n    :alt: PyPI - Status\n    :target: https://pypi.org/project/middle-schema/\n\n.. image:: https://img.shields.io/pypi/v/middle-schema.svg\n    :alt: PyPI Package latest release\n    :target: https://pypi.org/project/middle-schema/\n\n.. image:: https://img.shields.io/pypi/pyversions/middle-schema.svg\n    :alt: Supported versions\n    :target: https://pypi.org/project/middle-schema/\n\n.. image:: https://travis-ci.org/vltr/middle-schema.svg?branch=master\n    :alt: Travis-CI Build Status\n    :target: https://travis-ci.org/vltr/middle-schema\n\n.. image:: https://ci.appveyor.com/api/projects/status/github/vltr/middle-schema?branch=master\u0026svg=true\n    :alt: AppVeyor Build Status\n    :target: https://ci.appveyor.com/project/vltr/middle-schema\n\n.. image:: https://readthedocs.org/projects/middle-schema/badge/?style=flat\n    :target: https://readthedocs.org/projects/middle-schema\n    :alt: Documentation Status\n\n.. image:: https://codecov.io/github/vltr/middle-schema/coverage.svg?branch=master\n    :alt: Coverage Status\n    :target: https://codecov.io/github/vltr/middle-schema\n\n.. image:: https://api.codacy.com/project/badge/Grade/6425ac0a119f481bb4f2b269bd7f52fc\n    :alt: Codacy Grade\n    :target: https://www.codacy.com/app/vltr/middle-schema?utm_source=github.com\u0026amp;utm_medium=referral\u0026amp;utm_content=vltr/middle-schema\u0026amp;utm_campaign=Badge_Grade\n\n.. image:: https://pyup.io/repos/github/vltr/middle-schema/shield.svg\n    :target: https://pyup.io/account/repos/github/vltr/middle-schema/\n    :alt: Packages status\n\n.. end-badges\n\nTranslate your `middle \u003chttps://middle.readthedocs.io/en/latest/\u003e`_ model declarations to OpenAPI, JSONSchema or any other schema you need!\n\nIn a nutshell\n-------------\n\n.. code-block:: pycon\n\n    \u003e\u003e\u003e import enum\n    \u003e\u003e\u003e import json\n    \u003e\u003e\u003e import typing as t\n    \u003e\u003e\u003e import middle\n    \u003e\u003e\u003e from middle_schema.openapi import parse\n\n    \u003e\u003e\u003e @enum.unique\n    ... class PlatformEnum(str, enum.Enum):\n    ...     XBOX1 = \"XBOX1\"\n    ...     PLAYSTATION4 = \"PLAYSTATION4\"\n    ...     PC = \"PC\"\n\n    \u003e\u003e\u003e @enum.unique\n    ... class LanguageEnum(enum.IntEnum):\n    ...     ENGLISH = 1\n    ...     JAPANESE = 2\n    ...     SPANISH = 3\n    ...     GERMAN = 4\n    ...     PORTUGUESE = 5\n\n    \u003e\u003e\u003e @enum.unique\n    ... class CityRegionEnum(str, enum.Enum):\n    ...     TROPICAL = \"TROPICAL\"\n    ...     TEMPERATE = \"TEMPERATE\"\n    ...     BOREAL = \"BOREAL\"\n\n    \u003e\u003e\u003e class City(middle.Model):\n    ...     __description__ = \"One awesome city built\"\n    ...     name = middle.field(type=str, description=\"The city name\")\n    ...     region = middle.field(\n    ...         default=CityRegionEnum.TEMPERATE,\n    ...         type=CityRegionEnum,\n    ...         description=\"The region this city is located\",\n    ...     )\n\n    \u003e\u003e\u003e class Player(middle.Model):\n    ...     nickname = middle.field(\n    ...         type=str, description=\"The nickname of the player over the internet\"\n    ...     )\n    ...     youtube_channel = middle.field(\n    ...         type=str, description=\"The YouTube channel of the player\", default=None\n    ...     )\n\n    \u003e\u003e\u003e class Game(middle.Model):\n    ...     __description__ = \"An electronic game model\"\n    ...     name = middle.field(type=str, description=\"The name of the game\")\n    ...     platform = middle.field(\n    ...         type=PlatformEnum, description=\"Which platform it runs on\"\n    ...     )\n    ...     score = middle.field(\n    ...         type=float,\n    ...         description=\"The average score of the game\",\n    ...         minimum=0,\n    ...         maximum=10,\n    ...         multiple_of=0.1,\n    ...     )\n    ...     resolution_tested = middle.field(\n    ...         type=str,\n    ...         description=\"The resolution which the game was tested\",\n    ...         pattern=\"^\\d+x\\d+$\",\n    ...     )\n    ...     genre = middle.field(\n    ...         type=t.List[str],\n    ...         description=\"One or more genres this game is part of\",\n    ...         min_items=1,\n    ...         unique_items=True,\n    ...     )\n    ...     rating = middle.field(\n    ...         type=t.Dict[str, float],\n    ...         description=\"Ratings given on specialized websites\",\n    ...         min_properties=3,\n    ...     )\n    ...     players = middle.field(\n    ...         type=t.Set[str],\n    ...         description=\"Some of the notorious players of this game\",\n    ...     )\n    ...     language = middle.field(\n    ...         type=LanguageEnum, description=\"The main language of the game\"\n    ...     )\n    ...     awesome_city = middle.field(type=City)\n    ...     remarkable_resources = middle.field(\n    ...         type=t.Union[Player, City],\n    ...         description=\"Some remarkable resources of this game over the internet\",\n    ...     )\n\n    \u003e\u003e\u003e api = parse(Game)\n\n    \u003e\u003e\u003e json.dumps(api.specification, indent=4, sort_keys=True)\n    {\n        \"description\": \"An electronic game model\",\n        \"properties\": {\n            \"awesome_city\": {\n                \"description\": \"One awesome city built\",\n                \"properties\": {\n                    \"name\": {\n                        \"description\": \"The city name\",\n                        \"type\": \"string\"\n                    },\n                    \"region\": {\n                        \"choices\": [\n                            \"TROPICAL\",\n                            \"TEMPERATE\",\n                            \"BOREAL\"\n                        ],\n                        \"description\": \"The region this city is located\",\n                        \"type\": \"string\"\n                    }\n                },\n                \"required\": [\n                    \"name\"\n                ],\n                \"type\": \"object\"\n            },\n            \"genre\": {\n                \"description\": \"One or more genres this game is part of\",\n                \"items\": {\n                    \"type\": \"string\"\n                },\n                \"minItems\": 1,\n                \"type\": \"array\",\n                \"uniqueItems\": true\n            },\n            \"language\": {\n                \"choices\": [\n                    1,\n                    2,\n                    3,\n                    4,\n                    5\n                ],\n                \"description\": \"The main language of the game\",\n                \"format\": \"int64\",\n                \"type\": \"integer\"\n            },\n            \"name\": {\n                \"description\": \"The name of the game\",\n                \"type\": \"string\"\n            },\n            \"platform\": {\n                \"choices\": [\n                    \"XBOX1\",\n                    \"PLAYSTATION4\",\n                    \"PC\"\n                ],\n                \"description\": \"Which platform it runs on\",\n                \"type\": \"string\"\n            },\n            \"players\": {\n                \"description\": \"Some of the notorious players of this game\",\n                \"items\": {\n                    \"properties\": {\n                        \"nickname\": {\n                            \"description\": \"The nickname of the player over the internet\",\n                            \"type\": \"string\"\n                        },\n                        \"youtube_channel\": {\n                            \"description\": \"The YouTube channel of the player\",\n                            \"type\": \"string\"\n                        }\n                    },\n                    \"required\": [\n                        \"nickname\"\n                    ],\n                    \"type\": \"object\"\n                },\n                \"type\": \"array\"\n            },\n            \"rating\": {\n                \"additionalProperties\": {\n                    \"format\": \"double\",\n                    \"type\": \"number\"\n                },\n                \"description\": \"Ratings given on specialized websites\",\n                \"minProperties\": 3,\n                \"type\": \"object\"\n            },\n            \"remarkable_resources\": {\n                \"anyOf\": [\n                    {\n                        \"properties\": {\n                            \"nickname\": {\n                                \"description\": \"The nickname of the player over the internet\",\n                                \"type\": \"string\"\n                            },\n                            \"youtube_channel\": {\n                                \"description\": \"The YouTube channel of the player\",\n                                \"type\": \"string\"\n                            }\n                        },\n                        \"required\": [\n                            \"nickname\"\n                        ],\n                        \"type\": \"object\"\n                    },\n                    {\n                        \"description\": \"One awesome city built\",\n                        \"properties\": {\n                            \"name\": {\n                                \"description\": \"The city name\",\n                                \"type\": \"string\"\n                            },\n                            \"region\": {\n                                \"choices\": [\n                                    \"TROPICAL\",\n                                    \"TEMPERATE\",\n                                    \"BOREAL\"\n                                ],\n                                \"description\": \"The region this city is located\",\n                                \"type\": \"string\"\n                            }\n                        },\n                        \"required\": [\n                            \"name\"\n                        ],\n                        \"type\": \"object\"\n                    }\n                ],\n                \"description\": \"Some remarkable resources of this game over the internet\"\n            },\n            \"resolution_tested\": {\n                \"description\": \"The resolution which the game was tested\",\n                \"pattern\": \"^\\\\d+x\\\\d+$\",\n                \"type\": \"string\"\n            },\n            \"score\": {\n                \"description\": \"The average score of the game\",\n                \"format\": \"double\",\n                \"maximum\": 10,\n                \"minimum\": 0,\n                \"multipleOf\": 0.1,\n                \"type\": \"number\"\n            }\n        },\n        \"required\": [\n            \"name\",\n            \"platform\",\n            \"score\",\n            \"resolution_tested\",\n            \"genre\",\n            \"rating\",\n            \"players\",\n            \"language\",\n            \"awesome_city\",\n            \"remarkable_resources\"\n        ],\n        \"type\": \"object\"\n    }\n\n\n.. warning::\n\n    **IMPORTANT**: ``middle`` and ``middle-schema`` are in **very early stages** of development! Use with caution and be aware that some functionalities and APIs may change between versions until they're out of **alpha**.\n\nDocumentation\n=============\n\nhttps://middle-schema.readthedocs.io/en/latest/\n\nLicense\n=======\n\n``middle-schema`` is a free software distributed under the `MIT \u003chttps://choosealicense.com/licenses/mit/\u003e`_ license.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvltr%2Fmiddle-schema","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvltr%2Fmiddle-schema","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvltr%2Fmiddle-schema/lists"}