- Saved searches
- Use saved searches to filter your results more quickly
- License
- joelittlejohn/jsonschema2pojo
- Name already in use
- Sign In Required
- Launching GitHub Desktop
- Launching GitHub Desktop
- Launching Xcode
- Launching Visual Studio Code
- Latest commit
- Git stats
- Files
- README.md
- About
- Saved searches
- Use saved searches to filter your results more quickly
- License
- gmoyanollc/java-json-schema-generator
- Name already in use
- Sign In Required
- Launching GitHub Desktop
- Launching GitHub Desktop
- Launching Xcode
- Launching Visual Studio Code
- Latest commit
- Git stats
- Files
- README.md
- About
- Generate a pojo from json schema in less than a minute
- What Is A Json Minifier? What Is The Benefit Of Compact Json Data?
- Which Problems Can Be Solved With Json Formatter?
- Yaml Or Xml Or Json? When To Use Each Of These Formats?
- What Are The Common Errors In Json? How To Catch Them Easily?
- What Are The Easy Ways To Beautify Json Data What Is The Need To Beautify Json Data
Saved searches
Use saved searches to filter your results more quickly
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session.
Generate Java types from JSON or JSON Schema and annotate those types for data-binding with Jackson, Gson, etc
License
joelittlejohn/jsonschema2pojo
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Sign In Required
Please sign in to use Codespaces.
Launching GitHub Desktop
If nothing happens, download GitHub Desktop and try again.
Launching GitHub Desktop
If nothing happens, download GitHub Desktop and try again.
Launching Xcode
If nothing happens, download Xcode and try again.
Launching Visual Studio Code
Your codespace will open once ready.
There was a problem preparing your codespace, please try again.
Latest commit
Signed-off-by: Michael Edgar
Git stats
Files
Failed to load latest commit information.
README.md
jsonschema2pojo generates Java types from JSON Schema (or example JSON) and can annotate those types for data-binding with Jackson 2.x or Gson.
You can use jsonschema2pojo as a Maven plugin, an Ant task, a command line utility, a Gradle plugin or embedded within your own Java app. The Getting Started guide will show you how.
A very simple Maven example:
plugin> groupId>org.jsonschema2pojogroupId> artifactId>jsonschema2pojo-maven-pluginartifactId> version>1.2.1version> configuration> sourceDirectory>$/src/main/resources/schemasourceDirectory> targetPackage>com.example.typestargetPackage> configuration> executions> execution> goals> goal>generategoal> goals> execution> executions> plugin>
A very simple Gradle example:
plugins < id "java" id "org.jsonschema2pojo" version "1.2.1" > repositories < mavenCentral() >dependencies < implementation 'com.fasterxml.jackson.core:jackson-databind:2.12.2' > jsonSchema2Pojo < targetPackage = 'com.example' >
- unkish
- Thach Hoang
- Dan Cruver
- Ben Manes
- Sam Duke
- Duane Zamrok
- Christian Trimble
- YourKit, who support this project through a free license for the YourKit Java Profiler.
About
Generate Java types from JSON or JSON Schema and annotate those types for data-binding with Jackson, Gson, etc
Saved searches
Use saved searches to filter your results more quickly
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session.
Generate JSON schema for binding to Java classes from JSONIX generated JSON schema.
License
gmoyanollc/java-json-schema-generator
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Sign In Required
Please sign in to use Codespaces.
Launching GitHub Desktop
If nothing happens, download GitHub Desktop and try again.
Launching GitHub Desktop
If nothing happens, download GitHub Desktop and try again.
Launching Xcode
If nothing happens, download Xcode and try again.
Launching Visual Studio Code
Your codespace will open once ready.
There was a problem preparing your codespace, please try again.
Latest commit
Git stats
Files
Failed to load latest commit information.
README.md
schema-generator generates JSON schema components from XML Schema that support binding to Java classes .
The JSON schema components are generated by processing four products that originate from XML Schema.
.------------. | JavaScript | | modules |`-------->. '------------' | .--------------. | | intermediary | | | JSON Schema |`------->: '--------------' | .+-+-+-+-+-+. .----------------. :----> + schema- + | data component | | + generator + | documentation |`----->: '+-+-+-+-+-+' .-------------. '----------------' | `-----> | JSON schema | .----------------. | | components | | data component | | '-------------' | facets |`---->' '----------------'
Since XML Schema is the source, schema-generator generates JSON schema with patterns and characteristics derived from the source XML Schema. Therefore, if the source XML Schema is described with a deep data model, the JSON schema will also have a deep data model. And, if the source XML Schema is well documented and constrained, the generated JSON schema will have these similar characteristics.
schema-generator stands out from the hand-full of products that convert XML Schema to JSON Schema. The differentiated capabilities are support for:
- Jackson-based jsonschema2pojo Java binding
- XML Schema substitution and abstract elements
- XML Schema documentation
- XML Schema simple-type validation facets
- configurable global validation facets
Jackson-based jsonschema2pojo Java Binding
schema-generator is specifically tuned to support Jackson-based jsonschema2pojo. Jackson is a prominant JSON library of modules for Java. And, jsonschema2pojo is a popular Java binder for JSON schema.
More about jsonschema2pojo is that it implements the Jackson module jackson-module-jsonSchema, which supports JSON Schema Version 3. This is an issue because JSON Schema Version 4 is currently more popular in other languages than JSON Schema Version 3.
schema-generator overcomes the JSON Schema Version 3 by converting JSON Schema Version 4 schema generated by JSONIX to JSON Schema Version 3 schema.
For more specific information about the missing support for JSON Schema Version 4 oneOf , anyOf and allOf keywords, see Generating a POJO using oneOf, anyOf or allOf with constraints · Issue #392 · joelittlejohn/jsonschema2pojo.
XML Schema Substitution And Abstract Elements
XML Schema Simple-Type Validation Facets
Configurable Global Validation Facets
The following Jsonix caveats that the Schema Generator is intended to resolve.
- xs:pattern is not supported and the expressions are not compatible
- XML Schema regular expressions are not compatible with JavaScript/ECMAScript regular expressions
- http://stackoverflow.com/questions/33482031/are-xml-schema-regular-expressions-compatible-to-javascript-ecmascript-regular-e
- JAXB may be the reason since simple type facets are ignored
- https://jaxb.java.net/guide/Generating_Schema_that_you_want.html
- https://java.net/jira/browse/JAXB-917
- https://github.com/whummer/jaxb-facets)
#JSON Schema Generation Several schema file components are produced to represent general and specific concepts and properties. They are associated to each other by relative file-path value in a ‘$ref’ property. These associations compose larger representations for general concepts. In other words, general concepts are described by specific concepts and properties that are assocatied to each other by file references. A de-referenced JSON schema file contains all the representations that describe a general concept.
"id": anyOf[].elementName.namespaceURI + lowerFirstCharacter(anyOf.elementName.localPart) "title": lowerFirstCharacter(anyOf.elementName.localPart) "type": anyOf.elementName.type "description": "" "version": "0.1.0" "javaType": replace(trim(anyOf.elementName.namespaceURI, "http:// https://"), "/", "_") + replace(anyOf.elementName.localPart), "/", "_") "required": anyOf.properties.value.$ref.required
#Algorithmic Design Entities
##anyOf JSON schema objects are described by the «anyOf» object.
An elementName object generates a JSON schema object.
An attributeName object adds a property to a local JSON schema object.
###$ref A «$ref» object points to a definition object. A definition is isometric to an XML type. It contains the JSON schema object’s structural properties and constraints.
The «$ref» object may point to a local or remote definition object.
The following example is a remote reference:
"$ref":"http://release.niem.gov/niem/niem-core/3.0/#/definitions/TextType"
A remote reference is processed to obtain the schema file that contains the definition object. The schema file is identified by a match of the namespace part to a pre-configured mapping.
##definitions JSON schema object’s structural properties and constraints are defined by a «definitions» object.
- namespace format: http://mcsc.usmc.mil/mc2sa/tsoa/soi/[domain-object]/[version]
- namespace is a URL that contains only lower-case letters
- a hyphen seperates nouns, adjectives and other modifiers
- example: http://mcsc.usmc.mil/mc2sa/tsoa/soi/ObservedPlatformSystem/2.0
- upper-camel-case starts and seperates nouns, adjectives and other modifiers
- example: ObservedPlatformSystem.xsd
- example: xmlns:tst auto»>#workflow (no longer applicable) Every ‘anyOf’ and ‘definition’ referenced by an anyOf component gets a schema file generated. #To-Do
- narrow breadth of components converted from XML Schema to only those referenced
- implement relative path to external components
- keep component capitalization
- remove default schema require declarative that is empty
- capture enumeration values
- implement enumeration values
- capture facets (https://github.com/gmoyanollc/xml-schema-content-extractor)
- implement facets
- capture component documentation (https://github.com/gmoyanollc/xml-schema-content-extractor)
- implement component documentation
- capture substitution components
- re-implement substitution handler
- re-implement default facet handler
- ignore abstract container component
- ignore abstracts like augmentation point container, define and reference components or substitution components * augmentation point objects are listed in type definitions * the assocation between an augmentation point object and its containing is described in jsonix js module. ** descendent component may be identified by a substitutionHead property that associates it to an augmentation point object — [x] populate a lookup table containing substitutionHeads and their substitutions — [x] lookup substitutions for substitutionHeads and generate
- define substition components in augmentation point type
- allOf reference to a definition should define only the properties of the definition. The definition object should be ignored.
- include base definition in derived component, e.g., mo:Degree360Type —> nc:Degree360Type, Type —> SimpleType
- generate schema files recursively or remove filter for JSONIX compiler. The schema file for certain definition properties is never generated because the property is locally referenced by a definition but not defined in the local JSONIX schema file. This may be attributeable to filtered generation of JSONIX artifacts. Example Another case is a definition not referenced by a local ‘anyOf’ component.
- refactor global scope to include constants in generator object [X] halt execution when file not found [ ] $id needs to conform to json schema spec [ ] JSON-LD context builder [ ] enumeration Code List builder [ ] custom component representation, e.g., add a regex pattern
George Moyano @github/gmoyanollc version 0.5.9
About
Generate JSON schema for binding to Java classes from JSONIX generated JSON schema.
Generate a pojo from json schema in less than a minute
Siddhika Prajapati
19 Dec 2021What Is A Json Minifier? What Is The Benefit Of Compact Json Data?
Siddhika Prajapati
17 Dec 2021Which Problems Can Be Solved With Json Formatter?
Siddhika Prajapati
16 Dec 2021Yaml Or Xml Or Json? When To Use Each Of These Formats?
Siddhika Prajapati
13 Dec 2021What Are The Common Errors In Json? How To Catch Them Easily?
Siddhika Prajapati
11 Dec 2021What Are The Easy Ways To Beautify Json Data What Is The Need To Beautify Json Data
Siddhika Prajapati
08 Dec 2021
- XML Schema regular expressions are not compatible with JavaScript/ECMAScript regular expressions