Skip to content

Commit

Permalink
325 bug processreference method unable to process references to files…
Browse files Browse the repository at this point in the history
… ending in yaml (#326)

* Fix generation Issue
  • Loading branch information
jemacineiras committed Feb 16, 2024
1 parent bc705d6 commit 824fad3
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 21 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ As commented above, they both could be used at the same time, setting a double
<plugin>
<groupId>com.sngular</groupId>
<artifactId>scs-multiapi-maven-plugin</artifactId>
<version>5.3.4</version>
<version>5.3.5</version>
<executions>
<execution>
<id>asyncapi</id>
Expand Down Expand Up @@ -114,7 +114,7 @@ Apply the plugin in the `build.gradle` file and invoke the task.
```groovy
plugins {
id "java"
id "com.sngular.scs-multiapi-gradle-plugin' version '5.3.4"
id "com.sngular.scs-multiapi-gradle-plugin' version '5.3.5"
openapimodel {
Expand Down Expand Up @@ -153,7 +153,7 @@ which the plugin is designed.
<plugin>
<groupId>com.sngular</groupId>
<artifactId>scs-multiapi-maven-plugin</artifactId>
<version>5.3.4</version>
<version>5.3.5</version>
<executions>
<execution>
<phase>generate-sources</phase>
Expand Down Expand Up @@ -584,7 +584,7 @@ file. Here is an example of a basic configuration:
<plugin>
<groupId>com.sngular</groupId>
<artifactId>scs-multiapi-maven-plugin</artifactId>
<version>5.3.4</version>
<version>5.3.5</version>
<executions>
<execution>
<goals>
Expand Down
2 changes: 1 addition & 1 deletion multiapi-engine/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<groupId>com.sngular</groupId>
<artifactId>multiapi-engine</artifactId>
<version>5.3.4</version>
<version>5.3.5</version>
<packaging>jar</packaging>

<properties>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,17 +64,17 @@ public static String getSimpleType(final JsonNode schema, final String prefix, f
type = formatTypeOfString(format, useTimeType);
} else if (NUMBER.equalsIgnoreCase(type)) {
if (FLOAT.equalsIgnoreCase(format)) {
type = FLOAT;
type = StringUtils.capitalize(FLOAT);
} else if (DOUBLE.equalsIgnoreCase(format)) {
type = DOUBLE;
type = StringUtils.capitalize(DOUBLE);
} else {
type = BIG_DECIMAL;
type = StringUtils.capitalize(BIG_DECIMAL);
}
} else if (INTEGER.equalsIgnoreCase(type)) {
if (INT_64.equalsIgnoreCase(format)) {
type = LONG;
type = StringUtils.capitalize(LONG);
} else {
type = INTEGER;
type = StringUtils.capitalize(INTEGER);
}
}
} else if (schema.has(REF)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ public final class ReferenceProcessor {

private static final String YML = "yml";

private static final String YAML = "yaml";

private static final String REF = "$ref";

private static final String AVSC = "avsc";
Expand Down Expand Up @@ -78,7 +80,7 @@ private JsonNode solveRef(final FileLocation ymlParent, final String[] path, fin
final String filePath = pathToFile[0];
JsonNode returnNode = null;

if (filePath.endsWith(YML) || filePath.endsWith(JSON)) {
if (filePath.endsWith(YML) || filePath.endsWith(JSON) || filePath.endsWith(YAML)) {
final JsonNode node = ApiTool.nodeFromFile(ymlParent, filePath, FactoryTypeEnum.YML);
if (node.findValue(path[path.length - 2]).has(path[path.length - 1])) {
returnNode = node.findValue(path[path.length - 2]).get(path[path.length - 1]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ private static List<OperationObject> mapOperationObject(final SpecFile specFile,
private static OperationObject createOperation(
final JsonNode operation, final String operationType, final SpecFile specFile, final GlobalObject globalObject,
final List<String> operationIdList, final Path baseDir) {
Objects.requireNonNull(operation.get("tags"), "Tags element is required");
return OperationObject.builder()
.operationId(mapOperationId(getOperationId(operation), operationIdList))
.operationType(operationType)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public class DataDTO {
@MinItems(minimum = 5)
@UniqueItems
@NotNull
private final List<integer> test = new ArrayList<integer>();
private final List<Integer> test = new ArrayList<Integer>();

private DataDTO(DataDTOBuilder builder) {
this.clientId = builder.clientId;
Expand All @@ -65,7 +65,7 @@ public static class DataDTOBuilder {

private String flightNumber;

private List<integer> test = new ArrayList<integer>();
private List<Integer> test = new ArrayList<Integer>();

public DataDTO.DataDTOBuilder clientId(Integer clientId) {
this.clientId = clientId;
Expand All @@ -82,14 +82,14 @@ public DataDTO.DataDTOBuilder flightNumber(String flightNumber) {
return this;
}

public DataDTO.DataDTOBuilder test(List<integer> test) {
public DataDTO.DataDTOBuilder test(List<Integer> test) {
if (!test.isEmpty()) {
this.test.addAll(test);
}
return this;
}

public DataDTO.DataDTOBuilder test(integer test) {
public DataDTO.DataDTOBuilder test(Integer test) {
if (test != null) {
this.test.add(test);
}
Expand Down Expand Up @@ -134,7 +134,7 @@ public String getFlightNumber() {
* @return test
*/
@Schema(name = "test", required = true)
public List<integer> getTest() {
public List<Integer> getTest() {
return test;
}

Expand Down
6 changes: 3 additions & 3 deletions scs-multiapi-gradle-plugin/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ repositories {
}

group = 'com.sngular'
version = '5.3.4'
version = '5.3.5'

def SCSMultiApiPluginGroupId = group
def SCSMultiApiPluginVersion = version
Expand All @@ -30,7 +30,7 @@ dependencies {
shadow localGroovy()
shadow gradleApi()

implementation 'com.sngular:multiapi-engine:5.3.4'
implementation 'com.sngular:multiapi-engine:5.3.5'
testImplementation 'org.assertj:assertj-core:3.24.2'
testImplementation 'com.puppycrawl.tools:checkstyle:10.12.3'
}
Expand Down Expand Up @@ -98,7 +98,7 @@ testing {

integrationTest(JvmTestSuite) {
dependencies {
implementation 'com.sngular:scs-multiapi-gradle-plugin:5.3.4'
implementation 'com.sngular:scs-multiapi-gradle-plugin:5.3.5'
implementation 'org.assertj:assertj-core:3.24.2'
}

Expand Down
4 changes: 2 additions & 2 deletions scs-multiapi-maven-plugin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<groupId>com.sngular</groupId>
<artifactId>scs-multiapi-maven-plugin</artifactId>
<version>5.3.4</version>
<version>5.3.5</version>
<packaging>maven-plugin</packaging>

<name>AsyncApi - OpenApi Code Generator Maven Plugin</name>
Expand Down Expand Up @@ -243,7 +243,7 @@
<dependency>
<groupId>com.sngular</groupId>
<artifactId>multiapi-engine</artifactId>
<version>5.3.4</version>
<version>5.3.5</version>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
Expand Down

0 comments on commit 824fad3

Please sign in to comment.