{"id":27148198,"url":"https://github.com/drewlakee/json-object-openapi-schema","last_synced_at":"2025-04-08T11:54:02.138Z","repository":{"id":239073028,"uuid":"798438987","full_name":"drewlakee/json-object-openapi-schema","owner":"drewlakee","description":"A Kotlin library for converting Json-object into OpenAPI Schema","archived":false,"fork":false,"pushed_at":"2024-11-10T14:29:43.000Z","size":218,"stargazers_count":0,"open_issues_count":2,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-11-10T15:29:11.412Z","etag":null,"topics":["json","kotlin","object","openapi","schema","swagger","yaml"],"latest_commit_sha":null,"homepage":"","language":"Kotlin","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/drewlakee.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-05-09T19:24:30.000Z","updated_at":"2024-11-10T14:29:47.000Z","dependencies_parsed_at":"2024-05-27T23:59:44.887Z","dependency_job_id":"3aee61b5-5014-4d31-8d48-fda397f47e18","html_url":"https://github.com/drewlakee/json-object-openapi-schema","commit_stats":null,"previous_names":["drewlakee/json-object-swagger-schema","drewlakee/json-object-openapi-schema"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/drewlakee%2Fjson-object-openapi-schema","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/drewlakee%2Fjson-object-openapi-schema/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/drewlakee%2Fjson-object-openapi-schema/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/drewlakee%2Fjson-object-openapi-schema/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/drewlakee","download_url":"https://codeload.github.com/drewlakee/json-object-openapi-schema/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247838388,"owners_count":21004576,"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":["json","kotlin","object","openapi","schema","swagger","yaml"],"created_at":"2025-04-08T11:54:01.543Z","updated_at":"2025-04-08T11:54:02.128Z","avatar_url":"https://github.com/drewlakee.png","language":"Kotlin","readme":"# A Kotlin library for converting Json-object into OpenAPI Schema\n\n[![Maven Central](https://img.shields.io/maven-central/v/io.github.drewlakee/jooas.svg?label=Maven%20Central)](https://search.maven.org/search?q=g:%22io.github.drewlakee%22%20AND%20a:%22jooas%22)\n\nConverts a json object into an OpenAPI schema in YAML format\n\n![jooas logo](docs/logo.png)\n\nSupported types:\n- arrays\n- objects\n- primitives\n\nFeatures:\n- values from json as example\n\n```json\n{\n  \"integer_value\": 1,\n  \"object_value\": {\n    \"a\": 2,\n    \"b\": \"value\"\n  }\n}\n```\n\n```yaml\nSchema:\n  type: object\n  properties:\n    integer_value:\n      type: integer\n    object_value:\n      type: object\n      properties:\n        a:\n          type: integer\n        b:\n          type: string\n```\n\n- object references and structural deduplication\n\n```json\n{\n  \"pagination\": {\n    \"page\": 1,\n    \"pages\": 63,\n    \"per_page\": 2,\n    \"items\": 126,\n    \"urls\": {\n      \"last\": \"https://api.discogs.com/artists/1/releases?page=63\u0026per_page=2\",\n      \"next\": \"https://api.discogs.com/artists/1/releases?page=2\u0026per_page=2\"\n    }\n  },\n  \"community\": {\n    \"in_wantlist\": 1451,\n    \"in_collection\": 383\n  },\n  \"releases\": [\n    {\n      \"id\": 20209,\n      \"stats\": {\n        \"community\": {\n          \"in_wantlist\": 1451,\n          \"in_collection\": 383\n        }\n      }\n    },\n    {\n      \"id\": 62584,\n      \"stats\": {\n        \"community\": {\n          \"in_wantlist\": 830,\n          \"in_collection\": 682\n        }\n      }\n    }\n  ]\n}\n```\n\n```yaml\ncomponents:\n  schemas:\n    Schema:\n      type: object\n      properties:\n        pagination:\n          $ref: \"#/components/schemas/Pagination\"\n        community:\n          $ref: \"#/components/schemas/Community\"\n        releases:\n          type: array\n          items:\n            $ref: \"#/components/schemas/Releases\"\n    Pagination:\n      type: object\n      properties:\n        page:\n          type: integer\n          example: 1\n        pages:\n          type: integer\n          example: 63\n        per_page:\n          type: integer\n          example: 2\n        items:\n          type: integer\n          example: 126\n        urls:\n          $ref: \"#/components/schemas/Urls\"\n    Urls:\n      type: object\n      properties:\n        last:\n          type: string\n          example: https://api.discogs.com/artists/1/releases?page=63\u0026per_page=2\n        next:\n          type: string\n          example: https://api.discogs.com/artists/1/releases?page=2\u0026per_page=2\n    Community:\n      type: object\n      properties:\n        in_wantlist:\n          type: integer\n          example: 1451\n        in_collection:\n          type: integer\n          example: 383\n    Releases:\n      type: object\n      properties:\n        id:\n          type: integer\n          example: 20209\n        stats:\n          $ref: \"#/components/schemas/Stats\"\n    Stats:\n      type: object\n      properties:\n        community:\n          $ref: \"#/components/schemas/Community\"\n```\n\nCheck specification rendering here: https://editor.swagger.io/\n\n## Usage examples\n\n```kotlin\nfun main() {\n    var adapter = AdaptersFactory.createObjectAdapter()\n    val json = \"\"\"\n            {\n              \"name\": \"London\",\n              \"region\": \"City of London, Greater London\",\n              \"country\": \"United Kingdom\",\n              \"lat\": 51.52,\n              \"lon\": -0.11,\n              \"tz_id\": \"Europe/London\",\n              \"localtime_epoch\": 1613896955,\n              \"localtime\": \"2021-02-21 8:42\"\n            }\n    \"\"\"\n}\n```\n\n### Result at need\n\n```kotlin\n    val result: String = adapter.convert(json)\n    println(result)\n```\n\n```yaml\nSchema:\n  type: object\n  properties:\n    name:\n      type: string\n    region:\n      type: string\n    country:\n      type: string\n    lat:\n      type: number\n    lon:\n      type: number\n    tz_id:\n      type: string\n    localtime_epoch:\n      type: integer\n    localtime:\n      type: string\n```\n\n### Feature toggles for adapter\n\n```kotlin\n    adapter = AdaptersFactory.createObjectAdapter(\n        Pair(Features.Feature.WITH_EXAMPLE, true)\n    )\n```\n\n```yaml\nSchema:\n  type: object\n  properties:\n    name:\n      type: string\n      example: London\n    region:\n      type: string\n      example: \"City of London, Greater London\"\n    country:\n      type: string\n      example: United Kingdom\n    lat:\n      type: number\n      example: 51.52\n    lon:\n      type: number\n      example: -0.11\n    tz_id:\n      type: string\n      example: Europe/London\n    localtime_epoch:\n      type: integer\n      example: 1613896955\n    localtime:\n      type: string\n      example: 2021-02-21 8:42\n```","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdrewlakee%2Fjson-object-openapi-schema","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdrewlakee%2Fjson-object-openapi-schema","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdrewlakee%2Fjson-object-openapi-schema/lists"}