Skip to content

Commit

Permalink
Remove jsonschema2pojo-scalagen and remove targetLanguage support
Browse files Browse the repository at this point in the history
Closes #1199
  • Loading branch information
joelittlejohn committed Feb 25, 2021
1 parent a6eb2fe commit a3d3934
Show file tree
Hide file tree
Showing 157 changed files with 12 additions and 10,321 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@
import org.jsonschema2pojo.GenerationConfig;
import org.jsonschema2pojo.InclusionLevel;
import org.jsonschema2pojo.Jsonschema2Pojo;
import org.jsonschema2pojo.Language;
import org.jsonschema2pojo.NoopAnnotator;
import org.jsonschema2pojo.RuleLogger;
import org.jsonschema2pojo.SourceSortOrder;
Expand Down Expand Up @@ -192,8 +191,6 @@ public class Jsonschema2PojoTask extends Task implements GenerationConfig {

private SourceSortOrder sourceSortOrder = SourceSortOrder.OS;

private Language targetLanguage = Language.JAVA;

private Map<String, String> formatTypeMapping = new HashMap<>();

/**
Expand Down Expand Up @@ -955,10 +952,6 @@ public void setSourceSortOrder(SourceSortOrder sourceSortOrder) {
this.sourceSortOrder = sourceSortOrder;
}

public void setTargetLanguage(Language targetLanguage) {
this.targetLanguage = targetLanguage;
}

/**
* Sets the 'useInnerClassBuilders' property of this class
*
Expand Down Expand Up @@ -1305,11 +1298,6 @@ public SourceSortOrder getSourceSortOrder() {
return sourceSortOrder;
}

@Override
public Language getTargetLanguage() {
return targetLanguage;
}

@Override
public Map<String, String> getFormatTypeMapping() {
return formatTypeMapping;
Expand Down
12 changes: 0 additions & 12 deletions jsonschema2pojo-ant/src/site/Jsonschema2PojoTask.html
Original file line number Diff line number Diff line change
Expand Up @@ -433,18 +433,6 @@ <h3>Parameters</h3>
</td>
<td align="center" valign="top">No (default <code>JSONSCHEMA</code>)</td>
</tr>
<tr>
<td valign="top">targetLanguage</td>
<td valign="top">The type of code that will be generated.
<p>
Supported values:
<ul>
<li><code>JAVA</code></li>
<li><code>SCALA</code></li>
</ul>
</td>
<td align="center" valign="top">No</td>
</tr>
<tr>
<td valign="top">targetPackage</td>
<td valign="top">Package name used for generated Java classes (for types where a fully qualified
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
import org.jsonschema2pojo.Annotator;
import org.jsonschema2pojo.GenerationConfig;
import org.jsonschema2pojo.InclusionLevel;
import org.jsonschema2pojo.Language;
import org.jsonschema2pojo.NoopAnnotator;
import org.jsonschema2pojo.SourceSortOrder;
import org.jsonschema2pojo.SourceType;
Expand Down Expand Up @@ -236,9 +235,6 @@ public class Arguments implements GenerationConfig {
@Parameter(names = { "-sso", "--source-sort-order" }, description = "The sort order to be applied to the source files. Available options are: OS, FILES_FIRST or SUBDIRS_FIRST")
private SourceSortOrder sourceSortOrder = SourceSortOrder.OS;

@Parameter(names = { "-tl", "--target-language" }, description = "The type of code that will be generated. Available options are: JAVA or SCALA")
private Language targetLanguage = Language.JAVA;

@Parameter(names = { "-ftm", "--format-type-mapping" }, description = "Mapping from format identifier to type: <format>:<fully.qualified.Type>.", variableArity = true)
private List<String> formatTypeMapping = new ArrayList<>();

Expand Down Expand Up @@ -597,11 +593,6 @@ public SourceSortOrder getSourceSortOrder() {
return sourceSortOrder;
}

@Override
public Language getTargetLanguage() {
return targetLanguage;
}

@Override
public Map<String, String> getFormatTypeMapping() {
return formatTypeMapping
Expand Down
13 changes: 4 additions & 9 deletions jsonschema2pojo-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,6 @@
<name>jsonschema2pojo-core</name>

<dependencies>
<dependency>
<groupId>org.jsonschema2pojo</groupId>
<artifactId>jsonschema2pojo-scalagen</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
Expand All @@ -26,10 +21,6 @@
<groupId>com.fasterxml.jackson.dataformat</groupId>
<artifactId>jackson-dataformat-yaml</artifactId>
</dependency>
<dependency>
<groupId>org.scala-lang</groupId>
<artifactId>scala-library</artifactId>
</dependency>
<dependency>
<groupId>com.google.code.javaparser</groupId>
<artifactId>javaparser</artifactId>
Expand Down Expand Up @@ -82,6 +73,10 @@
<groupId>com.github.tomakehurst</groupId>
<artifactId>wiremock</artifactId>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -457,14 +457,6 @@ public SourceSortOrder getSourceSortOrder() {
return SourceSortOrder.OS;
}

/**
* @return {@link Language#JAVA}
*/
@Override
public Language getTargetLanguage() {
return Language.JAVA;
}

/**
* @return {@link Collections#emptyMap}
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -594,19 +594,6 @@ public interface GenerationConfig {
*/
SourceSortOrder getSourceSortOrder();

/**
* Gets the 'targetLanguage' configuration option.
*
* @return The type of code that will be generated.
* <p>
* Supported values:
* <ul>
* <li><code>JAVA</code> (Generate .java source files)</li>
* <li><code>SCALA</code> (Generate .scala source files, using scalagen)</li>
* </ul>
*/
Language getTargetLanguage();

/**
* Gets the 'formatTypeMapping' configuration option.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,15 +81,9 @@ public static void generate(GenerationConfig config, RuleLogger logger) throws I
}

if (config.getTargetDirectory().exists() || config.getTargetDirectory().mkdirs()) {
if (config.getTargetLanguage() == Language.SCALA) {
CodeWriter sourcesWriter = new ScalaFileCodeWriter(config.getTargetDirectory(), config.getOutputEncoding());
CodeWriter resourcesWriter = new FileCodeWriterWithEncoding(config.getTargetDirectory(), config.getOutputEncoding());
codeModel.build(sourcesWriter, resourcesWriter);
} else {
CodeWriter sourcesWriter = new FileCodeWriterWithEncoding(config.getTargetDirectory(), config.getOutputEncoding());
CodeWriter resourcesWriter = new FileCodeWriterWithEncoding(config.getTargetDirectory(), config.getOutputEncoding());
codeModel.build(sourcesWriter, resourcesWriter);
}
CodeWriter sourcesWriter = new FileCodeWriterWithEncoding(config.getTargetDirectory(), config.getOutputEncoding());
CodeWriter resourcesWriter = new FileCodeWriterWithEncoding(config.getTargetDirectory(), config.getOutputEncoding());
codeModel.build(sourcesWriter, resourcesWriter);
} else {
throw new GenerationException("Could not create or access target directory " + config.getTargetDirectory().getAbsolutePath());
}
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@
import com.sun.codemodel.JFieldVar;
import com.sun.codemodel.JInvocation;
import com.sun.codemodel.JType;
import scala.annotation.meta.field;

/**
* Applies the "default" schema rule.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import com.fasterxml.jackson.databind.JsonNode;
import org.jsonschema2pojo.Schema;
import com.sun.codemodel.JFieldVar;
import scala.annotation.meta.field;

public class ValidRule implements Rule<JFieldVar, JFieldVar> {

Expand Down
Loading

0 comments on commit a3d3934

Please sign in to comment.