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

328 support for multipart #351

Merged
merged 39 commits into from
Nov 2, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
4eae2e0
Updated lombok version
oscar-ares Mar 1, 2024
b3dfaf7
328 added removal of @RequestBody anotation when requestBody is multi…
oscar-ares Mar 5, 2024
e51827e
Fix test
jemacineiras Aug 6, 2024
9fd58de
Refactor
jemacineiras Aug 12, 2024
f300445
Refactor
jemacineiras Aug 16, 2024
f2da2de
Fix test
jemacineiras Aug 20, 2024
035893c
Fix AsyncApi Schema Generator
jemacineiras Aug 20, 2024
8bed01b
Fix OpenApi generator
jemacineiras Aug 23, 2024
582c4c3
Fix OpenApi generator
jemacineiras Aug 26, 2024
bef65c4
Fix OpenApi generator
jemacineiras Aug 28, 2024
2c7315f
Fix OpenApi generator
jemacineiras Sep 4, 2024
61f9325
Fix OpenApi generator
jemacineiras Sep 9, 2024
3c0eed9
Rework staff
jemacineiras Sep 9, 2024
61c7012
Rework things
jemacineiras Sep 21, 2024
11082b2
Fix OpenApi generator
jemacineiras Sep 21, 2024
e047fd2
Fix things
jemacineiras Sep 21, 2024
adbbcb6
Fix OpenApi generator
jemacineiras Sep 22, 2024
2baa29d
Fix Async Generator
jemacineiras Sep 23, 2024
ae5b07d
Fix Openapi Generator
jemacineiras Sep 23, 2024
6c35935
Fix Engine
jemacineiras Sep 23, 2024
fe66078
Fix Test
jemacineiras Sep 23, 2024
e44a9b5
Fix Test
jemacineiras Sep 25, 2024
6e3bc79
Improve test
jemacineiras Sep 26, 2024
37aeaf7
improve code style
jemacineiras Sep 30, 2024
05d0543
Fix github comments
jemacineiras Sep 30, 2024
ef22e5f
Fix Codacy comments
jemacineiras Oct 13, 2024
ce80741
Fix Codacy comments
jemacineiras Oct 13, 2024
341dd00
Codacy comments
jemacineiras Oct 16, 2024
1e5b130
Maven Publish
jemacineiras Oct 22, 2024
6bc3354
Merge branch 'main' into 255-openapiasyncapi-homogenize-mappercontent…
jemacineiras Oct 22, 2024
7c94bb8
Maven Publish
jemacineiras Oct 22, 2024
83cea15
328 added removal of @RequestBody anotation when requestBody is multi…
oscar-ares Mar 5, 2024
14af860
Maven Publish
jemacineiras Oct 22, 2024
c48a706
Merge branch '328-support-for-multipart' of sngular.github.com:sngula…
jemacineiras Oct 22, 2024
5bfba23
Maven Publish
jemacineiras Oct 22, 2024
893f66e
Fix Multipart
jemacineiras Oct 22, 2024
e2fa955
Fix test path problems
jemacineiras Nov 2, 2024
4c1e774
Fix test path problems
jemacineiras Nov 2, 2024
4a97f5c
Fix test path problems
jemacineiras Nov 2, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Rework things
  • Loading branch information
jemacineiras committed Sep 21, 2024
commit 61c7012e4cd1cf4cc4861e6fa1e27d47be9fe527
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,7 @@ private void fillTemplateFactory(
schemaObjectIt.forEachRemaining(schemaObj -> writeSchemaObject(operationObject.isUseLombokModelAnnotation(), operationObject.getModelPackage(), null, schemaObj));

if (Boolean.TRUE.equals(generateExceptionTemplate)) {
templateFactory.fillTemplateModelClassException(filePath, modelPackage);
templateFactory.fillTemplateModelClassException(operationObject.getApiPackage(), modelPackage);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ public final void fillTemplateWrapper(
"className", className,
"keyNamespace", keyClassFullName,
"keyClassName", keyClassName));
writeTemplateToFile(TemplateIndexConstants.TEMPLATE_MESSAGE_WRAPPER, filePath.resolve("MessageWrapper.java").toAbsolutePath().toString());
writeTemplateToFile(TemplateIndexConstants.TEMPLATE_MESSAGE_WRAPPER, filePath, "MessageWrapper");
clearData();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -193,11 +193,11 @@ private Set<String> fillTemplateSchema(final ClassTemplate classTemplate, final
return propertiesSet;
}

public final void fillTemplateModelClassException(final Path filePathToSave, final String modelPackage) throws IOException {
final Path pathToExceptionPackage = filePathToSave.resolve("exception");
public final void fillTemplateModelClassException(final String filePathToSave, final String modelPackage) throws IOException {
final Path pathToExceptionPackage = Paths.get(filePathToSave).resolve("exception");
pathToExceptionPackage.toFile().mkdirs();
addToRoot(EXCEPTION_PACKAGE, modelPackage);
writeTemplateToFile(TemplateIndexConstants.TEMPLATE_MODEL_EXCEPTION, filePathToSave, "ModelClassException");
writeTemplateToFile(CommonTemplateIndexConstants.TEMPLATE_MODEL_EXCEPTION, filePathToSave, "ModelClassException");
}

private void fillTemplateCustom(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,4 +66,6 @@ public abstract class CommonTemplateIndexConstants {

public static final String TEMPLATE_UNIQUE_ITEMS_VALIDATOR_ANNOTATION = "templateUniqueItemsValidator.ftlh";

private CommonTemplateIndexConstants() {
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -295,16 +295,16 @@ private Map<String, SchemaObject> writeSchemaObject(
try {
final Set<String> propertiesSet = new HashSet<>();
templateFactory.fillTemplateSchema(fileModelToSave, specFile.isUseLombokModelAnnotation(), schemaObject, propertiesSet);
fillTemplates(fileModelToSave, propertiesSet);
fillTempla(fileModelToSave, propertiesSet);
} catch (IOException | TemplateException e) {
throw new GeneratedSourcesException(schemaObject.getClassName(), e);
}
});

if (Boolean.TRUE.equals(generateExceptionTemplate)) {
try {
templateFactory.fillTemplateModelClassException(fileModelToSave, true, modelPackage);
} catch (IOException | TemplateException e) {
templateFactory.fillTemplateModelClassException(fileModelToSave, modelPackage);
} catch (IOException e) {
throw new GeneratedSourcesException(fileModelToSave, e);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.List;
import java.util.Map;
import java.util.Objects;
Expand Down Expand Up @@ -44,7 +45,7 @@ public final void fillTemplateSchema(
TemplateException {
if (Objects.nonNull(schemaObject.getFieldObjectList()) && !schemaObject.getFieldObjectList().isEmpty()) {
addToRoot("schema", schemaObject);
writeTemplateToFile(templateSelector(useLombok, schemaObject), filePathToSave, schemaObject.getClassName());
writeTemplateToFile(templateSelector(useLombok), filePathToSave, schemaObject.getClassName());
for (SchemaFieldObject fieldObject : schemaObject.getFieldObjectList()) {
propertiesSet.addAll(fieldObject.getRestrictions().getProperties());
if (fieldObject.isRequired() && Boolean.FALSE.equals(useLombok)) {
Expand All @@ -58,7 +59,7 @@ public final void clearData() {
cleanData();
}

private static String templateSelector(final Boolean useLombok, final SchemaObject schemaObject) {
private static String templateSelector(final Boolean useLombok) {
final var shouldUseLombok = Objects.requireNonNullElse(useLombok, false);
final String template;

Expand All @@ -71,44 +72,18 @@ private static String templateSelector(final Boolean useLombok, final SchemaObje
return template;
}

public final void fillTemplateModelClassException(final String filePathToSave) throws IOException, TemplateException {
final File fileToSave = new File(filePathToSave);
final Path pathToExceptionPackage = fileToSave.toPath().resolve("exception");
pathToExceptionPackage.toFile().mkdirs();
writeTemplateToFile(TemplateIndexConstants.TEMPLATE_MODEL_EXCEPTION, pathToExceptionPackage, "ModelClassException");

}

public final void fillTemplateWebClient(final String filePathToSave) throws IOException, TemplateException {
writeTemplateToFile(TemplateIndexConstants.TEMPLATE_WEB_CLIENT, pathToSaveMainClass, "ApiWebClient");
writeTemplateToFile(TemplateIndexConstants.TEMPLATE_WEB_CLIENT, filePathToSave, "ApiWebClient");
}

public final void fillTemplateRestClient(final String filePathToSave) throws IOException, TemplateException {
final File fileToSave = new File(filePathToSave);

final String pathToSaveMainClass = fileToSave.toPath().resolve("ApiRestClient.java").toString();
writeTemplateToFile(TemplateIndexConstants.TEMPLATE_REST_CLIENT, pathToSaveMainClass);
writeTemplateToFile(TemplateIndexConstants.TEMPLATE_REST_CLIENT, Paths.get(filePathToSave), "ApiRestClient");

}

public final void fillTemplateAuth(final String filePathToSave, final String authName) throws IOException {
final File fileToSave = new File(filePathToSave);
final var nameAuthClass = authName + JAVA_EXTENSION;
final String pathToSaveMainClass = fileToSave.toPath().resolve(nameAuthClass).toString();
writeTemplateToFile(createNameTemplate(authName), pathToSaveMainClass);

}

public final void fillTemplateCustom(
final String filePathToSave, final String annotationFileName, final String validatorFileName, final String annotationTemplate,
final String validatorTemplate) throws IOException {
final File fileToSave = new File(filePathToSave);
final Path pathToValidatorPackage = fileToSave.toPath().resolve("customvalidator");
pathToValidatorPackage.toFile().mkdirs();
final String pathToSaveMainClass = pathToValidatorPackage.resolve(annotationFileName).toString();
writeTemplateToFile(annotationTemplate, pathToSaveMainClass);
final String pathToSaveMainClassValidator = pathToValidatorPackage.resolve(validatorFileName).toString();
writeTemplateToFile(validatorTemplate, pathToSaveMainClassValidator);
writeTemplateToFile(createNameTemplate(authName), Paths.get(filePathToSave), authName);

}

public final void fillTemplate(
Expand Down