{"id":15091319,"url":"https://github.com/lts-beratung/json-to-openapi","last_synced_at":"2026-04-30T20:33:25.722Z","repository":{"id":57285396,"uuid":"167950329","full_name":"lts-beratung/json-to-openapi","owner":"lts-beratung","description":"A small cli application to convert json schemas to openapi schemas","archived":false,"fork":false,"pushed_at":"2019-04-01T08:39:02.000Z","size":13,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2026-03-03T21:00:48.837Z","etag":null,"topics":["cli","json","json-schema","openapi","openapi-spec","openapi-specification","schema","swagger"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/lts-beratung.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"license","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-01-28T11:22:20.000Z","updated_at":"2020-11-13T16:46:57.000Z","dependencies_parsed_at":"2022-09-07T18:52:41.787Z","dependency_job_id":null,"html_url":"https://github.com/lts-beratung/json-to-openapi","commit_stats":null,"previous_names":["vikepic/json-to-openapi"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/lts-beratung/json-to-openapi","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lts-beratung%2Fjson-to-openapi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lts-beratung%2Fjson-to-openapi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lts-beratung%2Fjson-to-openapi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lts-beratung%2Fjson-to-openapi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lts-beratung","download_url":"https://codeload.github.com/lts-beratung/json-to-openapi/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lts-beratung%2Fjson-to-openapi/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32476682,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-30T13:12:12.517Z","status":"ssl_error","status_checked_at":"2026-04-30T13:12:06.837Z","response_time":57,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["cli","json","json-schema","openapi","openapi-spec","openapi-specification","schema","swagger"],"created_at":"2024-09-25T10:40:23.271Z","updated_at":"2026-04-30T20:33:25.705Z","avatar_url":"https://github.com/lts-beratung.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# json-to-openapi [![install size](https://flat.badgen.net/packagephobia/install/json-to-openapi)](https://packagephobia.now.sh/result?p=json-to-openapi) [![Build Status](https://flat.badgen.net/travis/vikepic/json-to-openapi)](https://travis-ci.org/vikepic/json-to-openapi) [![XO code style](https://flat.badgen.net/xo/status/json-to-openapi)](https://github.com/xojs/xo) \n\n\u003e A small cli application to convert json schemas to openapi schemas.\n\nUsing both [json-schema-ref-parser](https://www.npmjs.com/package/json-schema-ref-parser) and [json-schema-to-openapi schema](https://github.com/wework/json-schema-to-openapi-schema).\n\n## Features\n\nPlease read the documentation for [json-schema-ref-parser](https://www.npmjs.com/package/json-schema-ref-parser) and [json-schema-to-openapi schema](https://github.com/wework/json-schema-to-openapi-schema#features) to get a complete list of all the features available.\n\n## Install\n\n```\n$ npm install --global json-to-openapi\n```\n\n```\n$ json-to-openapi --help\n\nUsage\njson-to-openapi filename\n\nExamples\n$ json-to-openapi schema.json\n// \u003e Converts the json schema stored under schema.json to an openapi schema.\n```\n\n## Examples\n\nBasic use case where one wants to convert a json schema stored under schema.json to an openapi schema:\n\n```\n// schema.json\n{\n\t\"$schema\": \"http://json-schema.org/draft-06/schema#\",\n\t\"description\": \"A customer schema\",\n\t\"type\": \"object\",\n\t\"required\": [\n\t\t\"id\"\n\t],\n\t\"properties\": {\n\t\t\"id\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"description\": \"Customer ID\"\n\t\t},\n\t\t\"firstName\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"description\": \"First name of a customer\"\n\t\t},\n\t\t\"lastName\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"description\": \"Last name of a customer\"\n\t\t}\n\t}\n}\n```\n\nAfter conversion with `json-to-openapi schema.json`:\n\n```\n{\n\t\"description\": \"A customer schema\",\n\t\"type\": \"object\",\n\t\"required\": [\n\t\t\"id\"\n\t],\n\t\"properties\": {\n\t\t\"id\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"description\": \"Customer ID\"\n\t\t},\n\t\t\"firstName\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"description\": \"First name of a customer\"\n\t\t},\n\t\t\"lastName\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"description\": \"Last name of a customer\"\n\t\t}\n\t}\n}\n```\n\nIt also dereferences `$ref` keywords, thanks to [json-schema-ref-parser](https://www.npmjs.com/package/json-schema-ref-parser). An example of how would that work can be found below:\n\n```\n// schema.json\n{\n\t// ...\n\t\"properties\": {\n\t\t// ...\n\t\t\"emails\": {\n\t\t\t\"type\": \"array\",\n\t\t\t\"description\": \"All emails of the customer\",\n\t\t\t\"items\": {\n\t\t\t\t\"$ref\": \"#/definitions/email\"\n\t\t\t}\n\t\t}\n\t},\n\t\"definitions\": {\n\t\t\"email\": {\n\t\t\t\"type\": \"object\",\n\t\t\t\"additionalProperties\": false,\n\t\t\t\"properties\": {\n\t\t\t\t\"id\": {\n\t\t\t\t\t\"type\": \"string\",\n\t\t\t\t\t\"description\": \"Identifier of the email\"\n\t\t\t\t},\n\t\t\t\t\"mail\": {\n\t\t\t\t\t\"type\": \"string\",\n\t\t\t\t\t\"description\": \"Mail address\"\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n```\n\nAfter the conversion:\n\n```\n{\n\t// ...\n\t\"properties\": {\n\t\t// ...\n\t\t\"emails\": {\n\t\t\t\"type\": \"array\",\n\t\t\t\"description\": \"All emails of the customer\",\n\t\t\t\"items\": {\n\t\t\t\t\"type\": \"object\",\n\t\t\t\t\"additionalProperties\": false,\n\t\t\t\t\"properties\": {\n\t\t\t\t\t\"id\": {\n\t\t\t\t\t\t\"type\": \"string\",\n\t\t\t\t\t\t\"description\": \"Identifier of the email\"\n\t\t\t\t\t},\n\t\t\t\t\t\"mail\": {\n\t\t\t\t\t\t\"type\": \"string\",\n\t\t\t\t\t\t\"description\": \"Mail address\"\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t},\n\t\"definitions\": {\n\t\t\"email\": {\n\t\t\t// ...\n\t\t}\n\t}\n}\n```\n\n## See also\n\n* [json-schema-ref-parser](https://www.npmjs.com/package/json-schema-ref-parser)\n* [json-schema-to-openapi schema](https://github.com/wework/json-schema-to-openapi-schema)\n\n## License\n\nMIT © [vikepic](https://vikepic.github.io)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flts-beratung%2Fjson-to-openapi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flts-beratung%2Fjson-to-openapi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flts-beratung%2Fjson-to-openapi/lists"}