{"id":35265743,"url":"https://github.com/ricky12awesome/json-schema-serialization","last_synced_at":"2025-12-30T10:03:25.481Z","repository":{"id":45208325,"uuid":"277644957","full_name":"Ricky12Awesome/json-schema-serialization","owner":"Ricky12Awesome","description":"Adds support for Json Schema using Kotlin.serialization","archived":false,"fork":false,"pushed_at":"2022-11-01T15:45:25.000Z","size":81,"stargazers_count":34,"open_issues_count":9,"forks_count":12,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-12-26T20:23:57.480Z","etag":null,"topics":["json-schema","kotlin","kotlinx-serialization"],"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/Ricky12Awesome.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":"2020-07-06T20:44:12.000Z","updated_at":"2025-12-20T12:18:24.000Z","dependencies_parsed_at":"2023-01-21T05:04:22.780Z","dependency_job_id":null,"html_url":"https://github.com/Ricky12Awesome/json-schema-serialization","commit_stats":null,"previous_names":[],"tags_count":14,"template":false,"template_full_name":null,"purl":"pkg:github/Ricky12Awesome/json-schema-serialization","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ricky12Awesome%2Fjson-schema-serialization","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ricky12Awesome%2Fjson-schema-serialization/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ricky12Awesome%2Fjson-schema-serialization/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ricky12Awesome%2Fjson-schema-serialization/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Ricky12Awesome","download_url":"https://codeload.github.com/Ricky12Awesome/json-schema-serialization/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ricky12Awesome%2Fjson-schema-serialization/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28125792,"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","status":"online","status_checked_at":"2025-12-30T02:00:05.476Z","response_time":64,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["json-schema","kotlin","kotlinx-serialization"],"created_at":"2025-12-30T10:03:11.109Z","updated_at":"2025-12-30T10:03:25.475Z","avatar_url":"https://github.com/Ricky12Awesome.png","language":"Kotlin","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ⚠️Important\n \nI lost interest in this project, that why there hasn't been any changes for over 2 years\nif anyone wants to maintain this project or a fork of this project, then I will update this readme\n\n# json-schema-serialization (jss)\nAdds support for Json Schema using [kotlinx.serialization](https://github.com/Kotlin/kotlinx.serialization)\n\nCurrently, Json Schema DSL is very experimental, expect a lot of changes.\n\nDependency\n----------\nYou would need [kotlinx.serialization](https://github.com/Kotlin/kotlinx.serialization) setup to use this dependency\n##### Gradle / Gradle Kotlin DSL\n\n```kotlin\nrepositories {\n  jcenter()  \n  // or maven(\"https://dl.bintray.com/ricky12awesome/github\")\n}\n\ndependencies {\n  implementation(\"com.github.Ricky12Awesome:json-schema-serialization:0.6.6\")\n}\n```\n\nUsage\n-----\n![](https://i.imgur.com/PwPEMAw.gif)\n\nCode\n----\n```kotlin\n@Serializable\ndata class Config(\n  @Description([\"Name for this project.\"])\n  val name: String = \"\",\n  @Description([\"Theme for this project.\"])\n  val theme: Theme = Theme()\n)\n\n@Serializable\nsealed class ThemeColor {\n  @Serializable @SerialName(\"HEX\")\n  data class HEX(\n    @Pattern(\"#[0-9a-fA-F]{2,6}\") val hex: String\n  ) : ThemeColor()\n\n  @Serializable @SerialName(\"RGB\")\n  data class RGB(\n    @IntRange(0, 255) val r: Int,\n    @IntRange(0, 255) val g: Int,\n    @IntRange(0, 255) val b: Int\n  ) : ThemeColor()\n\n  @Serializable @SerialName(\"HSV\")\n  data class HSV(\n    @IntRange(1, 360) val h: Int,\n    @FloatRange(0.0, 1.0) val s: Double,\n    @FloatRange(0.0, 1.0) val v: Double\n  ) : ThemeColor()\n\n  @Serializable @SerialName(\"HSL\")\n  data class HSL(\n    @IntRange(1, 360) val h: Int,\n    @FloatRange(0.0, 1.0) val s: Double,\n    @FloatRange(0.0, 1.0) val l: Double\n  ) : ThemeColor()\n}\n\n@Serializable\ndata class Theme(\n  @Description([\"Primary color for this theme.\"]) @Definition(\"ThemeColor\")\n  val primary: ThemeColor = ThemeColor.RGB(128, 128, 128),\n  @Description([\"Secondary color for this theme.\"]) @Definition(\"ThemeColor\")\n  val secondary: ThemeColor = ThemeColor.HSV(0, 0.0, 0.3),\n  @Description([\"Accent color for this theme.\"]) @Definition(\"ThemeColor\")\n  val accent: ThemeColor = ThemeColor.HSL(0, 0.0, 0.8),\n  @Description([\"Background color for this theme.\"]) @Definition(\"ThemeColor\")\n  val background: ThemeColor = ThemeColor.HEX(\"#242424\")\n)\n```\nSchema\n------\n```kotlin\nglobalJson.encodeToSchema(Config.serializer(), generateDefinitions = false)\n```\n```json\n{\n  \"$schema\": \"http://json-schema.org/draft-07/schema\",\n  \"type\": \"object\",\n  \"properties\": {\n    \"name\": {\n      \"type\": \"string\",\n      \"description\": \"Name for this project.\"\n    },\n    \"theme\": {\n      \"type\": \"object\",\n      \"properties\": {\n        \"primary\": {\n          \"description\": \"Primary color for this theme.\",\n          \"$ref\": \"#/definitions/ThemeColor\"\n        },\n        \"secondary\": {\n          \"description\": \"Secondary color for this theme.\",\n          \"$ref\": \"#/definitions/ThemeColor\"\n        },\n        \"accent\": {\n          \"description\": \"Accent color for this theme.\",\n          \"$ref\": \"#/definitions/ThemeColor\"\n        },\n        \"background\": {\n          \"description\": \"Background color for this theme.\",\n          \"$ref\": \"#/definitions/ThemeColor\"\n        }\n      }\n    }\n  },\n  \"definitions\": {\n    \"ThemeColor\": {\n      \"properties\": {\n        \"type\": {\n          \"type\": \"string\",\n          \"enum\": [\n            \"HEX\",\n            \"RGB\",\n            \"HSV\",\n            \"HSL\"\n          ]\n        }\n      },\n      \"anyOf\": [\n        {\n          \"type\": \"object\",\n          \"properties\": {\n            \"type\": {\n              \"const\": \"HEX\"\n            },\n            \"hex\": {\n              \"type\": \"string\",\n              \"pattern\": \"#[0-9a-fA-F]{2,6}\"\n            }\n          },\n          \"required\": [\n            \"hex\"\n          ]\n        },\n        {\n          \"type\": \"object\",\n          \"properties\": {\n            \"type\": {\n              \"const\": \"RGB\"\n            },\n            \"r\": {\n              \"type\": \"number\",\n              \"minimum\": 0,\n              \"maximum\": 255\n            },\n            \"g\": {\n              \"type\": \"number\",\n              \"minimum\": 0,\n              \"maximum\": 255\n            },\n            \"b\": {\n              \"type\": \"number\",\n              \"minimum\": 0,\n              \"maximum\": 255\n            }\n          },\n          \"required\": [\n            \"r\",\n            \"g\",\n            \"b\"\n          ]\n        },\n        {\n          \"type\": \"object\",\n          \"properties\": {\n            \"type\": {\n              \"const\": \"HSV\"\n            },\n            \"h\": {\n              \"type\": \"number\",\n              \"minimum\": 1,\n              \"maximum\": 360\n            },\n            \"s\": {\n              \"type\": \"number\",\n              \"minimum\": 0.0,\n              \"maximum\": 1.0\n            },\n            \"v\": {\n              \"type\": \"number\",\n              \"minimum\": 0.0,\n              \"maximum\": 1.0\n            }\n          },\n          \"required\": [\n            \"h\",\n            \"s\",\n            \"v\"\n          ]\n        },\n        {\n          \"type\": \"object\",\n          \"properties\": {\n            \"type\": {\n              \"const\": \"HSL\"\n            },\n            \"h\": {\n              \"type\": \"number\",\n              \"minimum\": 1,\n              \"maximum\": 360\n            },\n            \"s\": {\n              \"type\": \"number\",\n              \"minimum\": 0.0,\n              \"maximum\": 1.0\n            },\n            \"l\": {\n              \"type\": \"number\",\n              \"minimum\": 0.0,\n              \"maximum\": 1.0\n            }\n          },\n          \"required\": [\n            \"h\",\n            \"s\",\n            \"l\"\n          ]\n        }\n      ],\n      \"required\": [\n        \"type\"\n      ]\n    }\n  }\n}\n```\n\nSome Features I'm thinking about adding\n---------------------------------------\n\n- Json Schema DSL\n- Json Schema Data Object instead of using `JsonObject`\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fricky12awesome%2Fjson-schema-serialization","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fricky12awesome%2Fjson-schema-serialization","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fricky12awesome%2Fjson-schema-serialization/lists"}