Skip to content

Commit b3179bb

Browse files
committed
Merge branch 'develop' of github.com:polyapi/polyapi-java into develop
2 parents ca6e65a + 42c76e6 commit b3179bb

File tree

9 files changed

+44
-12
lines changed

9 files changed

+44
-12
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
# Java Client Library (beta)
22

3-
### Latest snapshot version v0.8.0-SNAPSHOT
43
### Latest released version v0.7.0
54

65
## Introduction
@@ -315,8 +314,9 @@ Comparing to its Typescript counterpart, the Java library is still missing the f
315314
These features will be added in the future releases.
316315

317316
## Changelog
318-
### v0.8.0
319-
- Added automatic update of API and Server functions option.
317+
### v0.7.1
318+
- Fixed bug about having duplicate schema types with the same name.
319+
- Improved minor code issues.
320320
### v0.7.0
321321
- Added ability to handle headers and params on webhook triggers.
322322
### v0.6.0

commons/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<parent>
55
<groupId>io.polyapi</groupId>
66
<artifactId>parent-pom</artifactId>
7-
<version>0.8.0-SNAPSHOT</version>
7+
<version>0.7.1-SNAPSHOT</version>
88
<relativePath>../parent-pom</relativePath>
99
</parent>
1010

library/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<parent>
55
<groupId>io.polyapi</groupId>
66
<artifactId>parent-pom</artifactId>
7-
<version>0.8.0-SNAPSHOT</version>
7+
<version>0.7.1-SNAPSHOT</version>
88
<relativePath>../parent-pom</relativePath>
99
</parent>
1010
<artifactId>library</artifactId>

parent-pom/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<modelVersion>4.0.0</modelVersion>
44
<groupId>io.polyapi</groupId>
55
<artifactId>parent-pom</artifactId>
6-
<version>0.8.0-SNAPSHOT</version>
6+
<version>0.7.1-SNAPSHOT</version>
77
<packaging>pom</packaging>
88
<name>Poly API Java parent POM</name>
99
<url>https://polyapi.io</url>

polyapi-maven-plugin/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<parent>
55
<groupId>io.polyapi</groupId>
66
<artifactId>parent-pom</artifactId>
7-
<version>0.8.0-SNAPSHOT</version>
7+
<version>0.7.1-SNAPSHOT</version>
88
<relativePath>../parent-pom</relativePath>
99
</parent>
1010
<artifactId>polyapi-maven-plugin</artifactId>

polyapi-maven-plugin/src/main/java/io/polyapi/plugin/utils/StringUtils.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,22 @@
11
package io.polyapi.plugin.utils;
22

3+
import java.util.Optional;
4+
35
import static java.util.function.Predicate.not;
46
import static org.apache.commons.text.WordUtils.capitalize;
57
import static org.apache.commons.text.WordUtils.uncapitalize;
68

7-
import java.util.Optional;
8-
99
public class StringUtils {
1010
private static final char[] DELIMITERS = new char[]{' ', '_', '-', '.'};
1111
private StringUtils() {
1212
// Do nothing.
1313
}
1414

1515
public static String toPascalCase(String input) {
16+
1617
return Optional.ofNullable(input)
1718
.filter(not(String::isBlank))
18-
.map(value -> capitalize(input, DELIMITERS).replaceAll("[_\\-\\.\s]", ""))
19+
.map(value -> capitalize(input, DELIMITERS).replaceAll("[\\-\\.\s]", ""))
1920
.orElse(input);
2021
}
2122

polyapi-maven-plugin/src/test/java/io/polyapi/plugin/service/JsonSchemaParserTest.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,10 @@ public static Stream<Arguments> generateSource() {
3838
createArguments(11, "Schema that uses allof."),
3939
createArguments(12, "Schema with enum with '-' in one of the options.", "Identifier", "TestResponse"),
4040
createArguments(13, "Schema with different types that have the same enum.", "Identifier", DEFAULT_RESPONSE_NAME, "Data"),
41-
createArguments(14, "Schema that is an Integer."));
41+
createArguments(14, "Schema that is an Integer."),
42+
createArguments(15, "Schema with multiple enums with the same name and properties.", DEFAULT_RESPONSE_NAME, "DashMinusstyle", "DashMinusstyle_", "Other"));
4243
}
44+
4345
public static Stream<Arguments> getTypeSource() {
4446
return Stream.of(Arguments.of(1, "Simple recursive schema with no base type.", createClassName(DEFAULT_RESPONSE_NAME)),
4547
Arguments.of(2, "Recursive schema with base type.", createClassName(DEFAULT_RESPONSE_NAME)),
@@ -80,6 +82,7 @@ public void generateTest(Integer caseNumber, String description, List<String> ex
8082
assertThat(customTypes.size(), equalTo(expectedNames.size()));
8183
var customTypeNames = customTypes.stream().map(CustomType::getName).toList();
8284
expectedNames.forEach(expectedName -> assertTrue(customTypeNames.contains(expectedName), format("Result should contain object with name %s. Result contains %s.", expectedName, customTypeNames)));
85+
customTypes.forEach(customType -> assertTrue(customType.getCode().contains(format("public class %s {", customType.getName())) || customType.getCode().contains(format("public enum %s {", customType.getName()))));
8386
}
8487

8588
@ParameterizedTest(name = "Case {0}: {1}")
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
{
2+
"$schema": "http://json-schema.org/draft-06/schema#",
3+
"type": "object",
4+
"additionalProperties": false,
5+
"properties": {
6+
"dash-style": {
7+
"type": "string",
8+
"enum": [
9+
"SOLID"
10+
]
11+
},
12+
"other": {
13+
"type": "object",
14+
"properties": {
15+
"dash-style": {
16+
"type": "string",
17+
"enum": [
18+
"SOLID"
19+
]
20+
}
21+
}
22+
}
23+
},
24+
"required": [
25+
"dashStyle"
26+
],
27+
"title": "Response Type"
28+
}

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<modelVersion>4.0.0</modelVersion>
44
<groupId>io.polyapi</groupId>
55
<artifactId>polyapi-java</artifactId>
6-
<version>0.8.0-SNAPSHOT</version>
6+
<version>0.7.1-SNAPSHOT</version>
77
<packaging>pom</packaging>
88
<modules>
99
<module>parent-pom</module>

0 commit comments

Comments
 (0)