Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

312 bug duplicate name object result in incorrect code generation #329

Conversation

rafaelgonzalezsimon
Copy link
Contributor

Fixed the storage of generated DTOS references when are in different packages.

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for collaborating with the project to help us improve!

@@ -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 = StringUtils.capitalize(FLOAT);
type = FLOAT;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rollback these changes please.

@@ -80,7 +78,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) || filePath.endsWith(YAML)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rollback these changes please.

@@ -1,6 +1,6 @@
<#assign words = ["abstract", "assert", "boolean", "break", "byte", "case", "catch", "char", "class", "const", "continue", "default", "double", "do", "else", "enum", "extends", "false", "final", "finally", "float", "for", "goto", "if", "implements", "import", "instanceof", "int", "interface", "long", "native", "new", "null", "package", "private", "protected", "public", "return", "short", "static", "strictfp", "super", "switch", "synchronized", "this", "throw", "throws", "transient", "true", "try", "void", "volatile", "while"]>
<#function calculateSafeName propertyName ender>
<#if words?seq_contains(propertyName?uncap_first) || propertyName?matches("[0-9].*")>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rollback these changes please.

@@ -130,7 +130,6 @@ 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");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rollback these changes please.

@@ -182,11 +182,7 @@ public class ${schema.className} {
private ${requireFinal (field)}${field.baseName?cap_first} ${calculateSafeName (field.baseName, hasConstValue(field.constValue))}
public enum ${field.baseName?cap_first} {
<#list field.enumValues as value>
<#if value?matches("[0-9].*")>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rollback these changes please.

@@ -125,11 +125,7 @@ public class ${schema.className} {

public enum ${field.baseName?cap_first} {
<#list field.enumValues as key, value>
<#if key?matches("[0-9].*")>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rollback these changes please.

}

@ParameterizedTest(name = "Test {index} - Process File Spec for case {0}")
@MethodSource("fileSpecToProcess")
void processFileSpecForTestFileGeneration(final String type, final List<SpecFile> specFileList, final Function<Path, Boolean> validation) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rollback these changes please.

@@ -22,29 +21,6 @@ public class UserSignedUpPayload {
@JsonProperty(value ="createdAt")
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss")
private LocalDateTime createdAt;
@JsonProperty(value ="numberEnum")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rollback these changes please.

@@ -40,12 +40,6 @@ components:
createdAt:
type: string
format: date-time
numberEnum:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rollback these changes please.

@@ -41,7 +41,7 @@ public class DataDTO {
@MinItems(minimum = 5)
@UniqueItems
@NotNull
private final List<Integer> test = new ArrayList<Integer>();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rollback these changes please.

Copy link

This pull request hasn't been labeled as release, gradle, maven nor documentation. Please ensure this is intentional before merging.

@jemacineiras jemacineiras added bug Something isn't working release Adding this tag to a PR will cause a release on merge labels Mar 27, 2024
Copy link

Project version has not been updated in pom.xml. Please, update your version using https://semver.org specifications

Copy link

Project version has not been updated in build.gradle. Please, update your version using https://semver.org specifications

1 similar comment
Copy link

Project version has not been updated in build.gradle. Please, update your version using https://semver.org specifications

Copy link

Project version has not been updated in pom.xml. Please, update your version using https://semver.org specifications

jemacineiras
jemacineiras previously approved these changes Aug 4, 2024
jemacineiras
jemacineiras previously approved these changes Aug 4, 2024
@jemacineiras jemacineiras merged commit 2f20b8d into main Aug 4, 2024
7 checks passed
@jemacineiras jemacineiras deleted the 312-bug-duplicate-name-object-result-in-incorrect-code-generation branch August 4, 2024 16:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working release Adding this tag to a PR will cause a release on merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bug: Duplicate name object result in incorrect code generation
3 participants