{"id":15694367,"url":"https://github.com/novotnyr/spring-jsonschema-validation","last_synced_at":"2025-08-20T08:08:29.605Z","repository":{"id":145666053,"uuid":"119292340","full_name":"novotnyr/spring-jsonschema-validation","owner":"novotnyr","description":"Adds support for JSON Schema validation in Spring MVC Controllers","archived":false,"fork":false,"pushed_at":"2020-01-22T22:17:16.000Z","size":30,"stargazers_count":7,"open_issues_count":1,"forks_count":3,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-31T18:07:09.699Z","etag":null,"topics":["json-schema","spring","spring-boot","spring-mvc"],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/novotnyr.png","metadata":{"files":{"readme":"README.markdown","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2018-01-28T19:53:40.000Z","updated_at":"2021-11-08T09:36:22.000Z","dependencies_parsed_at":"2023-04-04T19:31:31.273Z","dependency_job_id":null,"html_url":"https://github.com/novotnyr/spring-jsonschema-validation","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/novotnyr%2Fspring-jsonschema-validation","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/novotnyr%2Fspring-jsonschema-validation/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/novotnyr%2Fspring-jsonschema-validation/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/novotnyr%2Fspring-jsonschema-validation/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/novotnyr","download_url":"https://codeload.github.com/novotnyr/spring-jsonschema-validation/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253149380,"owners_count":21861717,"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","spring","spring-boot","spring-mvc"],"created_at":"2024-10-03T18:57:19.220Z","updated_at":"2025-05-08T20:53:43.110Z","avatar_url":"https://github.com/novotnyr.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"Spring MVC JSON Schema Validation\n=================================\n\nValidate Spring MVC Controller parameters against JSON schema.\nJust annotate them with `@JsonRequestBody`.\n\nHow does it work?\n-----------------\nBy adding `@JsonRequestBody` to the controller method parameter,\nwe will be able to validate the corresponding parameter against JSON Schema.\n\n    @RequestMapping(method = RequestMethod.POST, value = \"/boxes\")\n    public void register(@JsonRequestBody BoxRequest request)\n\nBy convention, the `request` parameter will be validated against\nJSON schema available in the `CLASSPATH`, in the `BoxController#register.json`\nfile.\n\nAny schema validation error will be converted to the `JsonSchemaValidationException`\nwhich wraps standard Spring `Errors` instance. Such exception\ncan be converted to the proper response by `@ExceptionHandler` mechanism\nand like.\n\nConfiguring\n-----------\nTo enable this facility, register the `JsonRequestBodyArgumentResolverRegisteringBeanPostProcessor`\nbean in the application context.\n\n    @Bean\n    static BeanPostProcessor jsonRequestBodyArgumentResolverRegisteringBeanPostProcessor() {\n        return new JsonRequestBodyArgumentResolverRegisteringBeanPostProcessor();\n    }\n\nNote that the post processor bean method must be static, as per\nSpring Framework requirements for bean postprocessors.\n\nFor details and complex example, see unit tests and `TestApplicationContext`.\n\nRequirements\n------------\n\n* Spring Framework 4.2.0 or newer\n* Everit JSON Schema validator\n\nAdvanced Usage\n--------------\n\n### Combining JSON Schema validation and Spring MVC Validators\n\nJSON Schema validation can be combined with the standard Spring MVC\nvalidation. Just pass the `Errors` instance as the following\nparameter and suppress the immediate validation exception throwing:\n\n    @RequestMapping(method = RequestMethod.POST, value = \"/boxes\")\n    public void register(@JsonRequestBody(strict = false) BoxRequest request, Errors errors)\n\nBy setting `strict` parameter to false, no validation exception will be thrown.\nInstead, all validation exceptions will be converted to the `Errors` validation\nerrors.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnovotnyr%2Fspring-jsonschema-validation","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnovotnyr%2Fspring-jsonschema-validation","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnovotnyr%2Fspring-jsonschema-validation/lists"}