Questions tagged [jsonschema2pojo]

The jsonschema2pojo is a tool that takes a json schema document and generates DTO-style Java classes (in the form of .java source files).

The jsonschema2pojo is a tool that takes a JSON Schema or JSON document and generates DTO-style Java classes (in the form of .java source files).

There are currently six ways to use jsonschema2pojo:

  1. as a maven plugin
  2. via the command line
  3. as an ant task
  4. as a gradle plugin
  5. directly from your code (embedded) using jsonschema2pojo-core
  6. from the website
174 questions
2
votes
2 answers

jsonschema2pojo with URL doesn't works

I have problems with using jsonschema2pojo in my code. So, I use jsonschema2pojo generator(http://www.jsonschema2pojo.org/) to generate POJO's from this URL: http://store.steampowered.com/api/appdetails/?appids=10 Finally, I create all these class…
ullQuiorra
  • 31
  • 1
  • 6
2
votes
1 answer

Error in using ref in json schema to pojo

I am trying to using the jsonschema2pojo to generate Java classes. I am running into trouble in using the '$ref' tag to refer other schemas in my parent schema. Device.json { "$schema": "http://json-schema.org/draft-03/hyper-schema", …
zambro
  • 414
  • 1
  • 6
  • 17
2
votes
2 answers

Deserialization of Polymorphic types with Jersey default implementation: MOXy

All my entities inherit from a class named EntidadeBase: @MappedSuperclass public abstract class EntidadeBase implements Serializable { private static final long serialVersionUID =…
Marcos J.C Kichel
  • 6,887
  • 8
  • 38
  • 78
2
votes
1 answer

Make POJO class generated from JSON schema serializable

I am using the jsonschema2pojo-maven-plugin v0.4.7 to generate POJO classes from a JSON schema. A sample schema is as follows: "features": { "title": "Feature", "description": "Name and type of every feature in the model", …
Mihir Shinde
  • 657
  • 2
  • 8
  • 13
2
votes
0 answers

Preserve Generics when generating JSON schema

I'm using jackson-module-jsonSchema and jsonschema2pojo API. Brief explanation: I'm trying to json-schemify my server's Spring controller contract objects (objects that the controllers return and objects that they accept as parameters) and package…
StormeHawke
  • 5,987
  • 5
  • 45
  • 73
1
vote
1 answer

Gradle: sharing plugins with convention plugins cause build to fail due to missing classes

I have a Micronaut-based project written in Java with several sub-projects. My project-setup is as follows: |-> gradle | |-> plugins | |-> micronaut-plugins | | |-> src/main/kotlin | | | |-> my-app.gradle.kts | | | …
TheDentist
  • 103
  • 1
  • 7
1
vote
2 answers

jsonschema2pojo returns error when try to generate dto's using schema

There is a application on spring-boot and gradle and need to generate dto's using json schema. Try to use jsonschema2pojo plugin for do it and took example from here (changed only plugins block used plugins closure instead apply keyword build.gradle…
Roberto
  • 1,288
  • 5
  • 23
  • 47
1
vote
1 answer

jsonschema2pojo: type creation for list of objects

I am using jsonschema2pojo (via gradle) to generate pojo from an external json schema that has a property (inside another property of type "object") with the following definition (field names and values changed but all types are…
sprockets
  • 981
  • 1
  • 6
  • 16
1
vote
0 answers

How to exclude some fields from json schema

I am trying to generate POJO classes from JSON schema using jsonschema2pojo in java spring boot. I am using the maven plugin mode of it. I like to exclude some fields which are in the schema, but it seems this feature is not supported in the…
sub
  • 527
  • 1
  • 7
  • 24
1
vote
2 answers

Adding custom error messages in "anyOf" JSON Schema

I'm looking to add custom error messages to my JSON Schema on a bad validation in an "allOf". I have this which works (on a "not"): "not": { "anyOf": [ { "required": ["prop1"], "errorMessage": "Property 'prop1' is not…
BpY
  • 403
  • 5
  • 12
1
vote
1 answer

how to generate classes out of the json schema

I have a json schema from which I need to generate java classes { "$schema": "http://json-schema.org/draft-07/schema#", "$id": "https://schema.softsense.io/analysis/vulnerabilities/v1alpha1/vulnerabilities.json", "title":…
1
vote
1 answer

Avoid generating duplicated classes with jsonschema2pojo and sourceType "json"

Following the instructions here, I use the jsonschema2pojo Maven plugin to generate Java classes from JSON example files. My JSON example file has a structure like this { "coffeeTable": { "book": [ { "author": "Aldo Rossi", …
esel
  • 901
  • 9
  • 20
1
vote
0 answers

adding the class id field to jsonschema for enums

Is there a way to add the id property when generating jsonschema? Using the jackson databind, I am: ObjectMapper mapper = new ObjectMapper(); SchemaFactoryWrapper visitor = new SchemaFactoryWrapper(); JsonSchemaGenerator jsg = new…
delita
  • 1,571
  • 1
  • 19
  • 25
1
vote
1 answer

jsonSchema2Pojo how to generate HashMap with String as key and value as another class generated using schema

I wanted to generate POJO classes from json schema, in which one of the attribute in the generated class should be a map of type - Map. Here CustomClass should be a class generated using jsonnSchema2pojo plugin. How do we achieve this…
Geethu
  • 11
  • 3
1
vote
0 answers

json to pojo gives error that "Path not present: definitions" for self referencing definitions

I have a json schema that has nested references in the "definitions" property. What I mean is that I have one property defined say "PropertyA" then a second property is defined called "PropertyB" which references "PropertyA" When I use the preview…
capa_matrix
  • 115
  • 3
  • 10
1 2
3
11 12