{"id":19563121,"url":"https://github.com/fasterxml/jackson-module-jsonschema","last_synced_at":"2025-05-13T23:04:08.126Z","repository":{"id":4298221,"uuid":"5429496","full_name":"FasterXML/jackson-module-jsonSchema","owner":"FasterXML","description":"Module for generating JSON Schema (v3) definitions from POJOs","archived":false,"fork":false,"pushed_at":"2025-04-25T01:15:30.000Z","size":2649,"stargazers_count":377,"open_issues_count":38,"forks_count":139,"subscribers_count":27,"default_branch":"2.x","last_synced_at":"2025-04-29T23:41:45.441Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/FasterXML.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":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2012-08-15T18:00:25.000Z","updated_at":"2025-04-25T01:15:34.000Z","dependencies_parsed_at":"2023-07-06T10:16:41.389Z","dependency_job_id":"e0734b81-b786-49e7-8091-abe11b12e44a","html_url":"https://github.com/FasterXML/jackson-module-jsonSchema","commit_stats":{"total_commits":607,"total_committers":37,"mean_commits":"16.405405405405407","dds":0.2652388797364086,"last_synced_commit":"f0994296d2c285ad3ed16b59760782ba3477fa15"},"previous_names":[],"tags_count":149,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FasterXML%2Fjackson-module-jsonSchema","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FasterXML%2Fjackson-module-jsonSchema/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FasterXML%2Fjackson-module-jsonSchema/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FasterXML%2Fjackson-module-jsonSchema/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/FasterXML","download_url":"https://codeload.github.com/FasterXML/jackson-module-jsonSchema/tar.gz/refs/heads/2.x","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251602596,"owners_count":21615956,"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":[],"created_at":"2024-11-11T05:16:37.650Z","updated_at":"2025-04-29T23:42:16.687Z","avatar_url":"https://github.com/FasterXML.png","language":"Java","readme":"# Jackson [JSON Schema](http://json-schema.org/) Module\n\nThis module supports the creation of a JSON Schema (v3)\n\nNote that since JSON Schema draft version 3 and 4 are incompatible, this module CAN NOT, as-is,\nsupport v4. There is another module [mbknor-jackson-jsonSchema](https://github.com/mbknor/mbknor-jackson-jsonSchema) that does support v4, however.\n\nIt is possible that in future this repo could have 2 different modules; one for v3, another v4.\nAnd if necessary, more if future revisions also prove incompatible.\n\n## Status\n\n[![Build Status](https://travis-ci.org/FasterXML/jackson-module-jsonSchema.svg)](https://travis-ci.org/FasterXML/jackson-module-jsonSchema)\n[![Maven Central](https://maven-badges.herokuapp.com/maven-central/com.fasterxml.jackson.module/jackson-module-jsonSchema/badge.svg)](https://maven-badges.herokuapp.com/maven-central/com.fasterxml.jackson.module/jackson-module-jsonSchema/)\n[![Javadoc](https://javadoc.io/badge/com.fasterxml.jackson.module/jackson-module-jsonSchema.svg)](http://www.javadoc.io/doc/com.fasterxml.jackson.module/jackson-module-jsonSchema)\n\nVersion 2.4 was considered the first stable version of the module.\n\n## Two modules (with Jackson 2.15)\n\nStarting with upcoming Jackson 2.15, this repository contains TWO versions of the module:\n\n1. Old JSON Schema module `com.fasterxml.jackson.module:jackson-module-jsonSchema` (since 2.0)\n2. New JSON Schema module `com.fasterxml.jackson.module:jackson-module-jsonSchema-jakarta` (2.15+)\n\ndepending on whether system needs to work with \"old\" `javax`/`JAXB` APIs (first module) or newer \"Jakarta\" APIs.\n\n## Future plans (lack thereof)\n\nDue to lack of support by community, this module is NOT planned to be supported beyond\nJackson 2.x -- no work has been done for it to work with future Jackson 3.0.\nUsers are encouraged to use more up-to-date JSON Schema support tools.\n\n## Example Usage\n\n(from [TestGenerateJsonSchema](https://github.com/FasterXML/jackson-module-jsonSchema/blob/master/javax/src/test/java/com/fasterxml/jackson/module/jsonSchema/TestGenerateJsonSchema.java#L136))\n\nsimply add a dependency\n`\"com.fasterxml.jackson.module:jackson-module-jsonSchema:2.15.0\"`\nor\n`\"com.fasterxml.jackson.module:jackson-module-jsonSchema-jakarta:2.15.0\"` for the jakarta namespace\n\nand for gradle, at least, you can simply add `mavenLocal()` to your repositories. \nMaven should resolve the dependency from its local repo transparently.\n\n```java\nObjectMapper mapper = new ObjectMapper();\n// configure mapper, if necessary, then create schema generator\nJsonSchemaGenerator schemaGen = new JsonSchemaGenerator(mapper);\nJsonSchema schema = schemaGen.generateSchema(SimpleBean.class);\n```\n\nThis will yield a java pojo representing a JSON Schema, which can itself easily be serialized with jackson, or configured with java. Customizing the generation should be simply a matter of locating the particular stage of generation you want to override, and replacing or extending that particular object in the dependency injection cycle in schemafactory wrapper.\n\n## Adding Property Processing\n\nSee `com.fasterxml.jackson.module.jsonSchema.customProperties.TitleSchemaFactoryWrapper` for an example of writing custom schema properties.\n\n## Required Fields\n\nJSON Schema has the ability to mark fields as required. This module supports this via the `@JsonProperty(required = true)` field annotation.\n\n## JsonSchema Hypermedia support\n### Generic support\nCurrent implementation is partial for IETF published draft v4 (http://json-schema.org/latest/json-schema-hypermedia.html).\n\nCurrently 2 aspects of IETF supported:\n* pathStart - URI that defines what the instance's URI MUST start with in order to validate.\n* links - associated Link Description Objects with instances.\n\nYou can enable HypermediaSupport using `com.fasterxml.jackson.module.jsonSchema.customProperties.HyperSchemaFactoryWrapper`.\nExample:\n\n```java\nHyperSchemaFactoryWrapper personVisitor = new HyperSchemaFactoryWrapper();\nObjectMapper mapper = new ObjectMapper();\nmapper.acceptJsonFormatVisitor(Person.class, personVisitor);\nJsonSchema personSchema = personVisitor.finalSchema();\n```\n\nBy default all default values for Link Description Object are ignored in the output (method = GET, enctype = application/json, mediaType = application/json), to enable default setIgnoreDefaults(true)\n\n### Describing JSON hyper-schema\n\nYou can describe hyperlinks, using annotations @JsonHyperSchema \u0026 @Link\n\n     public class Pet {\n         public String genus;\n     }\n\n     @JsonHyperSchema(\n         pathStart = \"http://localhost:8080/persons/\",\n         links = {\n             @Link(href = \"{name}\", rel = \"self\"),\n             @Link(href = \"{name}/pet\", rel = \"pet\", targetSchema = Pet.class)\n     })\n     public class Person {\n         public String name;\n         public String hat;\n     }\n\nWould generate following values:\n\n    {\n      \"type\" : \"object\",\n      \"pathStart\" : \"http://localhost:8080/persons/\",\n      \"links\" : [ {\n        \"href\" : \"http://localhost:8080/persons/{name}\",\n        \"rel\" : \"self\"\n      }, {\n        \"href\" : \"http://localhost:8080/persons/{name}/pet\",\n        \"rel\" : \"pet\",\n        \"targetSchema\" : {\n          \"type\" : \"object\",\n          \"properties\" : {\n            \"genus\" : {\n              \"type\" : \"string\"\n            }\n          }\n        }\n      } ],\n      \"properties\" : {\n        \"name\" : {\n          \"type\" : \"string\"\n        },\n        \"hat\" : {\n          \"type\" : \"string\"\n        }\n      }\n    }\n\n## More\n\nCheck out [Project Wiki](http://github.com/FasterXML/jackson-module-jsonSchema/wiki) for more information (javadocs, downloads).\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffasterxml%2Fjackson-module-jsonschema","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffasterxml%2Fjackson-module-jsonschema","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffasterxml%2Fjackson-module-jsonschema/lists"}