{"id":22750049,"url":"https://github.com/pwall567/json-kotlin-maven","last_synced_at":"2025-06-17T13:35:28.242Z","repository":{"id":57737635,"uuid":"437437627","full_name":"pwall567/json-kotlin-maven","owner":"pwall567","description":"Maven JSON Schema code generation plugin","archived":false,"fork":false,"pushed_at":"2025-05-15T02:06:26.000Z","size":22,"stargazers_count":4,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-05-15T03:28:44.524Z","etag":null,"topics":["json-schema","kotlin","maven-plugin"],"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/pwall567.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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,"zenodo":null}},"created_at":"2021-12-12T02:49:05.000Z","updated_at":"2025-05-15T02:06:09.000Z","dependencies_parsed_at":"2024-02-19T15:46:28.115Z","dependency_job_id":"f052473d-a083-4012-b4d0-d8a069fd0117","html_url":"https://github.com/pwall567/json-kotlin-maven","commit_stats":null,"previous_names":[],"tags_count":26,"template":false,"template_full_name":null,"purl":"pkg:github/pwall567/json-kotlin-maven","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pwall567%2Fjson-kotlin-maven","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pwall567%2Fjson-kotlin-maven/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pwall567%2Fjson-kotlin-maven/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pwall567%2Fjson-kotlin-maven/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pwall567","download_url":"https://codeload.github.com/pwall567/json-kotlin-maven/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pwall567%2Fjson-kotlin-maven/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260370226,"owners_count":22998791,"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-schema","kotlin","maven-plugin"],"created_at":"2024-12-11T04:11:49.446Z","updated_at":"2025-06-17T13:35:23.225Z","avatar_url":"https://github.com/pwall567.png","language":"Kotlin","funding_links":[],"categories":[],"sub_categories":[],"readme":"# json-kotlin-maven\n\n[![Build Status](https://github.com/pwall567/json-kotlin-maven/actions/workflows/build.yml/badge.svg)](https://github.com/pwall567/json-kotlin-maven/actions/workflows/build.yml)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n[![Kotlin](https://img.shields.io/static/v1?label=Kotlin\u0026message=v2.0.21\u0026color=7f52ff\u0026logo=kotlin\u0026logoColor=7f52ff)](https://github.com/JetBrains/kotlin/releases/tag/v2.0.21)\n[![Maven Central](https://img.shields.io/maven-central/v/net.pwall.json/json-kotlin-maven?label=Maven%20Central)](https://central.sonatype.com/artifact/net.pwall.json/json-kotlin-maven)\n\nMaven JSON Schema code generation plugin.\n\n## Background\n\nThe [`json-kotlin-schema-codegen`](https://github.com/pwall567/json-kotlin-schema-codegen) project provides a means of\ngenerating Kotlin or Java classes (or TypeScript interfaces) from [JSON Schema](https://json-schema.org/) object\ndescriptions.\nThe `json-kotlin-maven` plugin simplifies the use of this code generation mechanism from\n[Maven](https://maven.apache.org/).\n\n## To Use\n\nFirst, ensure you have a `pluginRepository` entry for Maven Central:\n```xml\n  \u003cpluginRepositories\u003e\n    \u003cpluginRepository\u003e\n      \u003cid\u003ecentral\u003c/id\u003e\n      \u003cname\u003eMaven Central\u003c/name\u003e\n      \u003curl\u003ehttps://repo1.maven.org/maven2/\u003c/url\u003e\n    \u003c/pluginRepository\u003e\n  \u003c/pluginRepositories\u003e\n```\n\nThen, in the plugins section:\n```xml\n      \u003cplugin\u003e\n        \u003cgroupId\u003enet.pwall.json\u003c/groupId\u003e\n        \u003cartifactId\u003ejson-kotlin-maven\u003c/artifactId\u003e\n        \u003cversion\u003e0.119\u003c/version\u003e\n        \u003cexecutions\u003e\n          \u003cexecution\u003e\n            \u003cphase\u003egenerate-sources\u003c/phase\u003e\n            \u003cgoals\u003e\n              \u003cgoal\u003ecodegen\u003c/goal\u003e\n            \u003c/goals\u003e\n          \u003c/execution\u003e\n        \u003c/executions\u003e\n      \u003c/plugin\u003e\n```\nAnd to have the generated source files compiled:\n```xml\n    \u003csourceDirectory\u003etarget/generated-sources/kotlin\u003c/sourceDirectory\u003e\n```\n(this shows the use of the default output directory; if it is changed by the use of the `outputDir` parameter, this line\nwill also change.)\n\nThe plugin follows the principle of \"convention over configuration\".\nThe default location for the schema file or files to be input to the generation process is:\n```\n    «project root»/src/main/resources/schema\n```\nand the default location for the\n[config file](https://github.com/pwall567/json-kotlin-schema-codegen/blob/main/CONFIG.md) (if required) is:\n```\n    «project root»/src/main/resources/codegen-config.json\n```\nIf your files are in these default locations, the above additions to `pom.xml` will be all you will need.\n\nIf you wish to specify the location of your schema or config files, or if you wish to use any of the other plugin\ncustomisation options, you may include a `configuration` section in the `plugin` declaration as follows:\n```xml\n      \u003cplugin\u003e\n        \u003cgroupId\u003enet.pwall.json\u003c/groupId\u003e\n        \u003cartifactId\u003ejson-kotlin-maven\u003c/artifactId\u003e\n        \u003cversion\u003e0.119\u003c/version\u003e\n        \u003cconfiguration\u003e\n          \u003cconfigFile\u003epath/to/your/config.json\u003c/configFile\u003e\n          \u003cinputFile\u003epath/to/your/schema/file/or/files\u003c/inputFile\u003e\n          \u003cpackageName\u003eyour.package.name\u003c/packageName\u003e\n          \u003cpointer\u003e/$defs\u003c/pointer\u003e\n          \u003ccomment\u003eTest comment 12345\u003c/comment\u003e\n        \u003c/configuration\u003e\n        \u003cexecutions\u003e\n          \u003cexecution\u003e\n            \u003cphase\u003egenerate-sources\u003c/phase\u003e\n            \u003cgoals\u003e\n              \u003cgoal\u003ecodegen\u003c/goal\u003e\n            \u003c/goals\u003e\n          \u003c/execution\u003e\n        \u003c/executions\u003e\n      \u003c/plugin\u003e\n```\n\nIf any setting in this configuration block conflicts with the equivalent setting in the config file, this configuration\nblock (in `pom.xml`) takes precedence.\n\n## Configuration Options\n\n### `configFile`\n\nIf the config file is not in the default location of `src/main/resources/codegen-config.json`, the location of the file\nmay be specified using the `configFile` property:\n```xml\n          \u003cconfigFile\u003epath/to/your/config.json\u003c/configFile\u003e\n```\n\n### `inputFile`\n\nThe input to the code generation process may be a single file or a directory tree containing a number of schema files.\nBy default, the plugin will process all files in the `src/main/resources/schema` directory (and subdirectories), but to\nspecify an alternative file or directory, use:\n```xml\n          \u003cinputFile\u003epath/to/your/schema/file/or/files\u003c/inputFile\u003e\n```\n\n### `pointer`\n\nOne of the common uses of the code generator is to generate a set of classes from a composite file.\nFor example, an OpenAPI file may contain a number of schema definitions for the request and response objects of the API,\nor a JSON Schema file may contain a set of definitions in the `$defs` section.\n\nTo specify this form of usage to the plugin, the configuration block must contain:\n```xml\n          \u003cinputFile\u003epath/to/your/schema/file/or/files\u003c/inputFile\u003e\n          \u003cpointer\u003e/pointer/to/definitions\u003c/pointer\u003e\n```\n\nFor example, to process the entire set of schema definitions in an OpenAPI file:\n```xml\n          \u003cinputFile\u003esrc/main/resources/openapi/openapi.yaml\u003c/inputFile\u003e\n          \u003cpointer\u003e/components/schemas\u003c/pointer\u003e\n```\n\n### `outputDir`\n\nThe default output directory is `target/generated-sources/«language»`, where `«language»` is `kotlin`, `java` or\n`ts` (for TypeScript), depending on the target language.\nTo specify a different output directory, use:\n```xml\n          \u003coutputDir\u003epath/to/your/output/directory\u003c/outputDir\u003e\n```\n\n### `language`\n\nThe default target language is Kotlin (naturally enough, for a project written in Kotlin and primarily intended to\ntarget Kotlin).\nTo specify Java output:\n```xml\n          \u003clanguage\u003ejava\u003c/language\u003e\n```\nThe value of this setting must be `kotlin`, `java` or `typescript`.\n\nThis setting may be specified in the config file, and that is the recommended practice.\n\n### `packageName`\n\nBy default, classes will be generated without a `package` directive.\nTo supply a package name:\n```xml\n          \u003cpackageName\u003ecom.example.model\u003c/packageName\u003e\n```\n\nThis setting may be specified in the config file, and that is the recommended practice.\n\n### `comment`\n\nThe `comment` allows the provision of a line of text to be added to the comment block output to the start of each\ngenerated file:\n```xml\n          \u003ccomment\u003eThis was generated from Schema version 1.0\u003c/comment\u003e\n```\n\nThis setting may be specified in the config file, and that is the recommended practice.\n\nPeter Wall\n\n2025-04-13\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpwall567%2Fjson-kotlin-maven","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpwall567%2Fjson-kotlin-maven","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpwall567%2Fjson-kotlin-maven/lists"}