All Projects → victools → jsonschema-generator

victools / jsonschema-generator

Licence: Apache-2.0 license
Java JSON Schema Generator – creating JSON Schema (Draft 6, Draft 7, Draft 2019-09, or Draft 2020-12) from Java classes

Programming Languages

java
68154 projects - #9 most used programming language
javascript
184084 projects - #8 most used programming language
SCSS
7915 projects

Projects that are alternatives of or similar to jsonschema-generator

Jsonschema2pojo
Generate Java types from JSON or JSON Schema and annotate those types for data-binding with Jackson, Gson, etc
Stars: ✭ 5,633 (+2544.6%)
Mutual labels:  json-schema, jackson
Json Schema Validator
A fast Java JSON schema validator that supports draft V4, V6, V7 and V2019-09
Stars: ✭ 292 (+37.09%)
Mutual labels:  json-schema, jackson
json-schema-inferrer
Java library for inferring JSON schema from sample JSONs
Stars: ✭ 78 (-63.38%)
Mutual labels:  json-schema, jackson
jackson-json-reference
JSON Reference for Java with Jackson.
Stars: ✭ 21 (-90.14%)
Mutual labels:  json-schema, jackson
flowjv
Flow based approach to JSON validation.
Stars: ✭ 20 (-90.61%)
Mutual labels:  json-schema
flow2schema
Generate json-schemas for flowtype definitions
Stars: ✭ 20 (-90.61%)
Mutual labels:  json-schema
jsoncodegen
Groovy based generation tasks from JSON schema
Stars: ✭ 28 (-86.85%)
Mutual labels:  json-schema
react-jsonschema-formbuilder
No description or website provided.
Stars: ✭ 45 (-78.87%)
Mutual labels:  json-schema
id-mask
IDMask is a Java library for masking internal ids (e.g. from your DB) when they need to be published to hide their actual value and to prevent forging. It has support optional randomisation has a wide support for various Java types including long, UUID and BigInteger. This library bases its security on strong cryptographic primitives.
Stars: ✭ 39 (-81.69%)
Mutual labels:  jackson
schema
SpaceAPI JSON schema files.
Stars: ✭ 20 (-90.61%)
Mutual labels:  json-schema
udacity-baking-recipes
Udacity - Baking Android App
Stars: ✭ 14 (-93.43%)
Mutual labels:  jackson
php-simple-request
php-simple-request is a request parser library designed to simplify requests validation and filtering using annotations, generating at the same time an object representation from the request data.
Stars: ✭ 15 (-92.96%)
Mutual labels:  json-schema
Minecraft-bedrock-json-schemas
The JSON validation schema files for Minecraft bedrock
Stars: ✭ 17 (-92.02%)
Mutual labels:  json-schema
scalable-form-platform
A solution for building dynamic web forms with visual editor
Stars: ✭ 109 (-48.83%)
Mutual labels:  json-schema
jackson-dynamic-filter
An easy way to determine filters dynamically using Jackson
Stars: ✭ 35 (-83.57%)
Mutual labels:  jackson
jersey-jwt-springsecurity
Example of REST API with JWT authentication using Spring Boot, Spring Security, Jersey and Jackson.
Stars: ✭ 44 (-79.34%)
Mutual labels:  jackson
resource-x
Resource and domain modeling for quick APIs, CMSs, and applications.
Stars: ✭ 26 (-87.79%)
Mutual labels:  json-schema
sf-java-ui
Json Schema Form java based library allow developers to define schema and form using field annotations
Stars: ✭ 23 (-89.2%)
Mutual labels:  json-schema
JsonSettings
This library simplifies creating configuration for your C# app/service by utilizing the serialization capabilities of Json.NET to serialize nested (custom) objects, dictionaries and lists as simply as by creating a POCO and inheriting JsonSettings class.
Stars: ✭ 59 (-72.3%)
Mutual labels:  json-schema
jgeXml
The Just-Good-Enough XML Toolkit
Stars: ✭ 20 (-90.61%)
Mutual labels:  json-schema

Java JSON Schema Generator

Build Status Maven Central

Creating JSON Schema (Draft 6, Draft 7, Draft 2019-09 or Draft 2020-12) from your Java classes utilising Jackson.


This project consists of:

  • the victools/jsonschema-generator (the only thing you need to get started)
  • a few modules bundling standard configurations for your convenience:
    • victools/jsonschema-module-jackson – deriving JSON Schema attributes from jackson annotations (e.g. "description", property name overrides, what properties to ignore) as well as looking up appropriate (annotated) subtypes
    • victools/jsonschema-module-jakarta-validation – deriving JSON Schema attributes from jakarta.validation.constraints annotations (e.g. which properties are nullable or not, their "minimum"/"maximum", "minItems"/"maxItems", "minLength"/"maxLength")
    • victools/jsonschema-module-javax-validation – deriving JSON Schema attributes from javax.validation annotations (e.g. which properties are nullable or not, their "minimum"/"maximum", "minItems"/"maxItems", "minLength"/"maxLength")
    • victools/jsonschema-module-swagger-1.5 – deriving JSON Schema attributes from swagger (1.5.x) annotations (e.g. "description", property name overrides, what properties to ignore, their "minimum"/"maximum", "const"/"enum")
    • victools/jsonschema-module-swagger-2 – deriving JSON Schema attributes from swagger (2.x) @Schema annotations
  • the victools/jsonschema-maven-plugin – allowing you to generate JSON Schemas as part of your Maven build

Another example for such a module is:


Documentation

JavaDoc is being used throughout the codebase, offering contextual information in your respective IDE or being available online through services like javadoc.io.

Additional documentation and configuration examples can be found here: https://victools.github.io/jsonschema-generator


Usage

Dependency (Maven)

<dependency>
    <groupId>com.github.victools</groupId>
    <artifactId>jsonschema-generator</artifactId>
    <version>4.25.0</version>
</dependency>

Since version 4.7, the release versions of the main generator library and the (standard) victools modules listed above are aligned. It is recommended to use identical versions for all of them to ensure compatibility.

It is discouraged to use a older/lower jsonschema-generator version than any of your jsonschema-module-* dependencies. If the module uses any feature only added to the jsonschema-generator in the newer version, runtime errors are to be expected.

Code

Complete/Minimal Example

import com.fasterxml.jackson.databind.JsonNode;
import com.github.victools.jsonschema.generator.OptionPreset;
import com.github.victools.jsonschema.generator.SchemaGenerator;
import com.github.victools.jsonschema.generator.SchemaGeneratorConfig;
import com.github.victools.jsonschema.generator.SchemaGeneratorConfigBuilder;
import com.github.victools.jsonschema.generator.SchemaVersion;
SchemaGeneratorConfigBuilder configBuilder = new SchemaGeneratorConfigBuilder(SchemaVersion.DRAFT_2019_09, OptionPreset.PLAIN_JSON);
SchemaGeneratorConfig config = configBuilder.build();
SchemaGenerator generator = new SchemaGenerator(config);
JsonNode jsonSchema = generator.generateSchema(YourClass.class);

System.out.println(jsonSchema.toPrettyString());
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].