{ "info": { "author": "Gareth Rushgrove", "author_email": "gareth@morethanseven.net", "bugtrack_url": null, "classifiers": [ "License :: OSI Approved :: Apache Software License", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.7" ], "description": "# openapi2jsonschema\n\nA utility to extract [JSON Schema](http://json-schema.org/) from a\nvalid [OpenAPI](https://www.openapis.org/) specification.\n\n\n## Why\n\nOpenAPI contains a list of type `definitions` using a superset of JSON\nSchema. These are used internally by various OpenAPI compatible tools. I\nfound myself however wanting to use those schemas separately, outside\nexisting OpenAPI tooling. Generating separate schemas for types defined\nin OpenAPI allows for all sorts of indepent tooling to be build which\ncan be easily maintained, because the canonical definition is shared.\n\n\n## Installation\n\n`openapi2jsonschema` is implemented in Python. Assuming you have a\nPython intepreter and pip installed you should be able to install with:\n\n```\npip install openapi2jsonschema\n```\n\nThis has not yet been widely tested and is currently in a _works on my\nmachine_ state.\n\n\n## Usage\n\nThe simplest usage is to point the `openapi2jsonschema` tool at a URL\ncontaining a JSON (or YAML) OpenAPI definition like so:\n\n```\nopenapi2jsonschema https://raw.githubusercontent.com/kubernetes/kubernetes/master/api/openapi-spec/swagger.json\n```\n\nThis will generate a set of schemas in a `schemas` directory. The tool\nprovides a number of options to modify the output:\n\n```\n$ openapi2jsonschema --help\nUsage: openapi2jsonschema [OPTIONS] SCHEMA\n\n Converts a valid OpenAPI specification into a set of JSON Schema files\n\nOptions:\n -o, --output PATH Directory to store schema files\n -p, --prefix TEXT Prefix for JSON references (only for OpenAPI versions\n before 3.0)\n --stand-alone Whether or not to de-reference JSON schemas\n --kubernetes Enable Kubernetes specific processors\n --strict Prohibits properties not in the schema\n (additionalProperties: false)\n --help Show this message and exit.\n```\n\n\n## Example\n\nMy specific usecase was being able to validate a Kubernetes\nconfiguration file without a Kubernetes client like `kubectl` and\nwithout the server. For that I have a bash script shown below:\n\n```bash\n#!/bin/bash -xe\n\n# This script uses openapi2jsonschema to generate a set of JSON schemas\nfor\n# the specified Kubernetes versions in three different flavours:\n#\n# X.Y.Z - URL referenced based on the specified GitHub repository\n# X.Y.Z-standalone - de-referenced schemas, more useful as standalone\ndocuments\n# X.Y.Z-local - relative references, useful to avoid the network\ndependency\n\nREPO=\"garethr/kubernetes=json-schema\"\n\ndeclare -a arr=(1.6.6\n 1.6.5\n 1.6.4\n 1.6.3\n 1.6.2\n 1.6.1\n 1.6.0\n 1.5.6\n 1.5.4\n 1.5.3\n 1.5.2\n 1.5.1\n 1.5.0\n )\n\nfor version in \"${arr[@]}\"\ndo\n schema=https://raw.githubusercontent.com/kubernetes/kubernetes/v${version}/api/openapi-spec/swagger.json\n prefix=https://raw.githubusercontent.com/${REPO}/master/v${version}/_definitions.json\n\n openapi2jsonschema -o \"${version}-standalone\" --stand-alone \"${schema}\"\n openapi2jsonschema -o \"${version}-local\" \"${schema}\"\n openapi2jsonschema -o \"${version}\"\" --prefix \"${prefix}\" \"${schema}\"\ndone\n```\n\nThe output from running this script can be seen in the accompanying\n[garethr/kubernetes-json-schema](https://github.com/garethr/kubernetes-json-schema).\n\n\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/garethr/openapi2jsonschema", "keywords": "openapi,jsonschema", "license": "Apache-2.0", "maintainer": "Gareth Rushgrove", "maintainer_email": "gareth@morethanseven.net", "name": "openapi2jsonschema", "package_url": "https://pypi.org/project/openapi2jsonschema/", "platform": "", "project_url": "https://pypi.org/project/openapi2jsonschema/", "project_urls": { "Homepage": "https://github.com/garethr/openapi2jsonschema", "Repository": "https://github.com/garethr/openapi2jsonschema" }, "release_url": "https://pypi.org/project/openapi2jsonschema/0.9.1/", "requires_dist": [ "jsonref (>=0.2.0,<0.3.0)", "pyyaml (>=5.1,<6.0)", "click (>=7.0,<8.0)", "colorama (>=0.4.1,<0.5.0)" ], "requires_python": ">=3.7,<4.0", "summary": "A utility to extract JSON Schema from a valid OpenAPI specification", "version": "0.9.1" }, "last_serial": 5658928, "releases": { "0.2.0": [ { "comment_text": "", "digests": { "md5": "bcc256c2c1c65c2a8ff1747ecf415b59", "sha256": "772651a4990982e3a13974f5a18b4ec5c134a283c9680828d831a16a17587a8f" }, "downloads": -1, "filename": "openapi2jsonschema-0.2.0.tar.gz", "has_sig": false, "md5_digest": "bcc256c2c1c65c2a8ff1747ecf415b59", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2267, "upload_time": "2017-06-19T12:00:03", "url": "https://files.pythonhosted.org/packages/cf/97/474fe90df7781dd2d569f702aee4269585d669a06f99453dd25d0a966c58/openapi2jsonschema-0.2.0.tar.gz" } ], "0.2.1": [ { "comment_text": "", "digests": { "md5": "80c6a58d4b4b86c63a607021aea10a6f", "sha256": "c2c203d9560b9f59a0a2703ed5b67d597b2602ec7fa37c561247128b87320c10" }, "downloads": -1, "filename": "openapi2jsonschema-0.2.1.tar.gz", "has_sig": false, "md5_digest": "80c6a58d4b4b86c63a607021aea10a6f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2257, "upload_time": "2017-06-19T15:48:51", "url": "https://files.pythonhosted.org/packages/62/ed/cdfabb8647d1d78c204d9569046f722f02aeb72a80ccba5b00f558e8a8d1/openapi2jsonschema-0.2.1.tar.gz" } ], "0.3.0": [ { "comment_text": "", "digests": { "md5": "81d70319de2f491bf03d0d0495aac0e3", "sha256": "14940db75e91674954a4509c348612ae602a09c25a9fc6adfd359fa0d85ea032" }, "downloads": -1, "filename": "openapi2jsonschema-0.3.0.tar.gz", "has_sig": false, "md5_digest": "81d70319de2f491bf03d0d0495aac0e3", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2409, "upload_time": "2017-07-03T11:05:55", "url": "https://files.pythonhosted.org/packages/d3/46/dc0fd668ab08177fa9b84802e525cda4254a52a864da3221f6b8b6f05388/openapi2jsonschema-0.3.0.tar.gz" } ], "0.4.0": [ { "comment_text": "", "digests": { "md5": "5011d32346129cafd41b408f1c0553e3", "sha256": "842f18cb2260a2680a74fe3d7388dc6375ab3157bf03dc7b4a36683067b3825a" }, "downloads": -1, "filename": "openapi2jsonschema-0.4.0.tar.gz", "has_sig": false, "md5_digest": "5011d32346129cafd41b408f1c0553e3", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2575, "upload_time": "2017-07-21T12:54:51", "url": "https://files.pythonhosted.org/packages/fb/cd/32a42f252cbbac677364913e2e583959cae32dcc91b887284a2e044af6fc/openapi2jsonschema-0.4.0.tar.gz" } ], "0.5.0": [ { "comment_text": "", "digests": { "md5": "dc76355cdc671e243b2ab841529f962f", "sha256": "62ce1bbb848768b8964013dd8a444e0b7bf6e0d470d24233873018e8ae9f4316" }, "downloads": -1, "filename": "openapi2jsonschema-0.5.0.tar.gz", "has_sig": false, "md5_digest": "dc76355cdc671e243b2ab841529f962f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2693, "upload_time": "2017-08-11T14:49:28", "url": "https://files.pythonhosted.org/packages/af/50/655d97800b18aece7f5cf6a7839d7145bdb1704a0d9dbc60721bdf711087/openapi2jsonschema-0.5.0.tar.gz" } ], "0.6.0": [ { "comment_text": "", "digests": { "md5": "2672fea8858ed2f06009ee9a746bfc28", "sha256": "52cebb3da41df1b91668c9f80d5585b07f6dec28bf96fdc50b17c309dadd7f29" }, "downloads": -1, "filename": "openapi2jsonschema-0.6.0.tar.gz", "has_sig": false, "md5_digest": "2672fea8858ed2f06009ee9a746bfc28", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2730, "upload_time": "2017-08-18T07:28:01", "url": "https://files.pythonhosted.org/packages/5f/0f/095e6b7ce6baa497af18d6704a9ae61f6f88ec91a652930f2408a5a375cc/openapi2jsonschema-0.6.0.tar.gz" } ], "0.7.0": [ { "comment_text": "", "digests": { "md5": "785632737216b5e376dd5e7a492866f0", "sha256": "fbfac1297a43110fa5d92e4e7d2e57360b2f12647ba1df8791c1b5bc19133c6e" }, "downloads": -1, "filename": "openapi2jsonschema-0.7.0.tar.gz", "has_sig": false, "md5_digest": "785632737216b5e376dd5e7a492866f0", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3152, "upload_time": "2017-09-16T15:58:28", "url": "https://files.pythonhosted.org/packages/26/d1/90343079fb0f8d649fde16112638ba07c59fd2b6994aff2deb2c18731811/openapi2jsonschema-0.7.0.tar.gz" } ], "0.7.1": [ { "comment_text": "", "digests": { "md5": "e03462da92c89976e2ef8d42abac3f10", "sha256": "368c551edd881a210f8d521f6cd2e1acec92b31df7a0eebedd6ee6fc894b63a2" }, "downloads": -1, "filename": "openapi2jsonschema-0.7.1.tar.gz", "has_sig": false, "md5_digest": "e03462da92c89976e2ef8d42abac3f10", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3178, "upload_time": "2018-02-24T18:43:17", "url": "https://files.pythonhosted.org/packages/27/d9/b7b5de0ec242f5d281e33408258906a4eb3193aaf8f427403febcf4e3a52/openapi2jsonschema-0.7.1.tar.gz" } ], "0.8.0": [ { "comment_text": "", "digests": { "md5": "5f799ee71bbcc2dfd5d8ee8aa407157f", "sha256": "d2197e6bd97318ac9dbf94e570e16e28abf1782bcdeae295a40a1276540f9ba6" }, "downloads": -1, "filename": "openapi2jsonschema-0.8.0.tar.gz", "has_sig": false, "md5_digest": "5f799ee71bbcc2dfd5d8ee8aa407157f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3429, "upload_time": "2018-08-25T08:51:11", "url": "https://files.pythonhosted.org/packages/fc/8b/3dcd47f1569024dfbadf364540a76e7346a92780d58b413d62ee58e8e5da/openapi2jsonschema-0.8.0.tar.gz" } ], "0.9.0": [ { "comment_text": "", "digests": { "md5": "ff728f3606f9cb4ee9ac19c62fc1ca05", "sha256": "d52cebaa1093595aeabbc6a8a170943612893570332acc534dff087beb0fb8eb" }, "downloads": -1, "filename": "openapi2jsonschema-0.9.0.tar.gz", "has_sig": false, "md5_digest": "ff728f3606f9cb4ee9ac19c62fc1ca05", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4863, "upload_time": "2019-04-04T15:34:21", "url": "https://files.pythonhosted.org/packages/4b/44/63cc24266efccce5a39f42ad453ab595b3286671fe3ccd2fc0feffc117ae/openapi2jsonschema-0.9.0.tar.gz" } ], "0.9.1": [ { "comment_text": "", "digests": { "md5": "55044098e2daee16e8255dd92957a5bb", "sha256": "ee70245ce1af71d0d34f7fc5a349fccfe1a9ac50b44002e8bbfa8890e8c7e9ed" }, "downloads": -1, "filename": "openapi2jsonschema-0.9.1-py3-none-any.whl", "has_sig": false, "md5_digest": "55044098e2daee16e8255dd92957a5bb", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.7,<4.0", "size": 8243, "upload_time": "2019-08-10T07:49:05", "url": "https://files.pythonhosted.org/packages/29/2b/ed3e4960b16bbdc4a360518de8f46b223632a0e783f626042418e2cce223/openapi2jsonschema-0.9.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "64ac3dc59f474ca850c272f56b00c10c", "sha256": "49df4851b56ec4fdd14878a92d48f266dde4d8b76e41fdfe36565a35cc1f3811" }, "downloads": -1, "filename": "openapi2jsonschema-0.9.1.tar.gz", "has_sig": false, "md5_digest": "64ac3dc59f474ca850c272f56b00c10c", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.7,<4.0", "size": 7108, "upload_time": "2019-08-10T07:49:07", "url": "https://files.pythonhosted.org/packages/60/e9/ab7d0ee2f18ac7c5bd3c7108785b13366fe62929312e9464afe44746c049/openapi2jsonschema-0.9.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "55044098e2daee16e8255dd92957a5bb", "sha256": "ee70245ce1af71d0d34f7fc5a349fccfe1a9ac50b44002e8bbfa8890e8c7e9ed" }, "downloads": -1, "filename": "openapi2jsonschema-0.9.1-py3-none-any.whl", "has_sig": false, "md5_digest": "55044098e2daee16e8255dd92957a5bb", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.7,<4.0", "size": 8243, "upload_time": "2019-08-10T07:49:05", "url": "https://files.pythonhosted.org/packages/29/2b/ed3e4960b16bbdc4a360518de8f46b223632a0e783f626042418e2cce223/openapi2jsonschema-0.9.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "64ac3dc59f474ca850c272f56b00c10c", "sha256": "49df4851b56ec4fdd14878a92d48f266dde4d8b76e41fdfe36565a35cc1f3811" }, "downloads": -1, "filename": "openapi2jsonschema-0.9.1.tar.gz", "has_sig": false, "md5_digest": "64ac3dc59f474ca850c272f56b00c10c", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.7,<4.0", "size": 7108, "upload_time": "2019-08-10T07:49:07", "url": "https://files.pythonhosted.org/packages/60/e9/ab7d0ee2f18ac7c5bd3c7108785b13366fe62929312e9464afe44746c049/openapi2jsonschema-0.9.1.tar.gz" } ] }