Skip to content

Commit da9b43b

Browse files
author
gcornacchia
committed
Merge branch 'release/1.0.5'
2 parents c25d08c + 9d253c2 commit da9b43b

9 files changed

Lines changed: 15 additions & 136 deletions

File tree

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# CHANGELOG
22

3+
1.0.5 - 13/04/2023
4+
- removed additional "jsonSchema" field from json schema files when reading a swagger 2.0 file
5+
36
1.0.4 - 02/03/2023
47
- fix bug handling additionalProperties if already defined with false value
58

assembly/assembly.xml

Lines changed: 0 additions & 38 deletions
This file was deleted.

assembly/dist/conf/environment.properties

Lines changed: 0 additions & 37 deletions
This file was deleted.

assembly/dist/conf/logback.xml

Lines changed: 0 additions & 25 deletions
This file was deleted.

assembly/dist/frontend-api-definition-adapter-imola.sh

Lines changed: 0 additions & 5 deletions
This file was deleted.

assembly/dist/frontend-api-definition-adapter.sh

Lines changed: 0 additions & 8 deletions
This file was deleted.

pom.xml

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<modelVersion>4.0.0</modelVersion>
44
<groupId>it.imolinfo.maven.plugins</groupId>
55
<artifactId>openapi2jsonschema4j</artifactId>
6-
<version>1.0.4</version>
6+
<version>1.0.5</version>
77
<packaging>maven-plugin</packaging>
88

99
<name>OpenAPI2JsonSchema4J</name>
@@ -158,27 +158,6 @@
158158
</execution>
159159
</executions>
160160
</plugin>
161-
<plugin>
162-
<artifactId>maven-assembly-plugin</artifactId>
163-
<executions>
164-
<execution>
165-
<id>make-assembly-tipi-comuni</id>
166-
<!-- this is used for inheritance merges -->
167-
<phase>package</phase>
168-
<!-- bind to the packaging phase -->
169-
<goals>
170-
<goal>single</goal>
171-
</goals>
172-
<configuration>
173-
<finalName>${project.name}-${project.version}</finalName>
174-
<appendAssemblyId>true</appendAssemblyId>
175-
<descriptors>
176-
<descriptor>assembly/assembly.xml</descriptor>
177-
</descriptors>
178-
</configuration>
179-
</execution>
180-
</executions>
181-
</plugin>
182161
<plugin>
183162
<groupId>org.codehaus.mojo</groupId>
184163
<artifactId>build-helper-maven-plugin</artifactId>

src/main/java/it/imolainformatica/openapi2jsonschema4j/impl/DraftV4JsonSchemaGenerator.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ public class DraftV4JsonSchemaGenerator extends BaseJsonSchemaGenerator implemen
3838
private static final String WRITEONLY = "writeOnly";
3939
private static final String EXTERNALDOCS = "externalDocs";
4040
private static final String DEPRECATED = "deprecated";
41+
42+
private static final String JSONSCHEMA = "jsonSchema";
4143
private static final String[] ignoreProperties = {ORIGINAL_REF,
4244
EXAMPLESETFLAG,
4345
EXAMPLE,
@@ -48,7 +50,8 @@ public class DraftV4JsonSchemaGenerator extends BaseJsonSchemaGenerator implemen
4850
READONLY,
4951
WRITEONLY,
5052
EXTERNALDOCS,
51-
DEPRECATED};
53+
DEPRECATED,
54+
JSONSCHEMA};
5255
private static final List<String> ignorePropertiesList = Arrays.asList(ignoreProperties);
5356
public static final String NULL = "null";
5457
private boolean strict;

src/test/java/it/imolainformatica/openapi2jsonschema4j/base/AbstractIT.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
import com.github.fge.jsonschema.core.report.ProcessingReport;
1111
import com.github.fge.jsonschema.main.JsonSchema;
1212
import com.github.fge.jsonschema.main.JsonSchemaFactory;
13+
import com.github.fge.jsonschema.processors.syntax.SyntaxValidator;
1314
import io.swagger.oas.inflector.examples.ExampleBuilder;
1415
import io.swagger.oas.inflector.examples.models.Example;
1516
import io.swagger.oas.inflector.processors.JsonNodeExampleSerializer;
@@ -74,6 +75,7 @@ private void testGeneratedJsonSchema(File f, Map<String, JsonNode> gen) throws P
7475
log.info("jsonExample={}",jsonExample);
7576
JsonSchemaFactory schemaFactory = JsonSchemaFactory.byDefault();
7677
JsonSchema jsonSchema = schemaFactory.getJsonSchema(jsonSchemaNode);
78+
validateJsonSchemaSyntax(schemaFactory.getSyntaxValidator(), jsonSchemaNode);
7779
ProcessingReport rep = jsonSchema.validate(new ObjectMapper().readTree(jsonExample));
7880
log.info("processing report for model {} = {}",objName,rep);
7981
Assert.assertTrue("Il json generato non è valido in base al json schema per l'oggetto "+objName, rep.isSuccess());
@@ -83,5 +85,10 @@ private void testGeneratedJsonSchema(File f, Map<String, JsonNode> gen) throws P
8385

8486

8587

88+
}
89+
90+
private void validateJsonSchemaSyntax(SyntaxValidator syntaxValidator, JsonNode node) {
91+
ProcessingReport rep = syntaxValidator.validateSchema(node);
92+
Assert.assertTrue(rep.isSuccess());
8693
}
8794
}

0 commit comments

Comments
 (0)