-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
82 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
src/main/java/com/techatpark/sjson/generator/JsonSchemaGenerator.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package com.techatpark.sjson.generator; | ||
|
||
|
||
public class JsonSchemaGenerator { | ||
public String create(Class aClass) { | ||
return null; | ||
} | ||
} |
24 changes: 24 additions & 0 deletions
24
src/test/java/com/techatpark/sjson/schema/generator/GenartorTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package com.techatpark.sjson.schema.generator; | ||
|
||
import com.fasterxml.jackson.databind.JsonNode; | ||
import com.github.reinert.jjschema.v1.JsonSchemaFactory; | ||
import com.github.reinert.jjschema.v1.JsonSchemaV4Factory; | ||
import com.techatpark.sjson.generator.JsonSchemaGenerator; | ||
import com.techatpark.sjson.schema.generator.model.Product; | ||
import org.junit.jupiter.api.Test; | ||
|
||
public class GenartorTest { | ||
@Test | ||
void testGenerator() { | ||
JsonSchemaFactory schemaFactory = new JsonSchemaV4Factory(); | ||
schemaFactory.setAutoPutDollarSchema(true); | ||
JsonNode productSchema = schemaFactory.createSchema(Product.class); | ||
System.out.println(productSchema); | ||
|
||
JsonSchemaGenerator jsonSchemaGenerator = new JsonSchemaGenerator(); | ||
|
||
System.out.println("\n\n\nYour Output\n================\n"); | ||
|
||
System.out.println(jsonSchemaGenerator.create(Product.class)); | ||
} | ||
} |
43 changes: 43 additions & 0 deletions
43
src/test/java/com/techatpark/sjson/schema/generator/model/Product.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package com.techatpark.sjson.schema.generator.model; | ||
|
||
import java.math.BigDecimal; | ||
import java.util.List; | ||
|
||
public class Product { | ||
private long id; | ||
private String name; | ||
private BigDecimal price; | ||
private List<String> tags; | ||
|
||
public long getId() { | ||
return id; | ||
} | ||
|
||
public void setId(long id) { | ||
this.id = id; | ||
} | ||
|
||
public String getName() { | ||
return name; | ||
} | ||
|
||
public void setName(String name) { | ||
this.name = name; | ||
} | ||
|
||
public BigDecimal getPrice() { | ||
return price; | ||
} | ||
|
||
public void setPrice(BigDecimal price) { | ||
this.price = price; | ||
} | ||
|
||
public List<String> getTags() { | ||
return tags; | ||
} | ||
|
||
public void setTags(List<String> tags) { | ||
this.tags = tags; | ||
} | ||
} |