Skip to content

Commit

Permalink
Sketch for Generator
Browse files Browse the repository at this point in the history
  • Loading branch information
sathishk committed Jan 19, 2024
1 parent a579824 commit 8f48caf
Show file tree
Hide file tree
Showing 4 changed files with 82 additions and 0 deletions.
7 changes: 7 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,13 @@
<scope>test</scope>
</dependency>

<dependency>
<groupId>com.github.reinert</groupId>
<artifactId>jjschema</artifactId>
<version>1.16</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>com.tngtech.archunit</groupId>
<artifactId>archunit</artifactId>
Expand Down
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;
}
}
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));
}
}
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;
}
}

0 comments on commit 8f48caf

Please sign in to comment.