-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(generator-plugin-transfertypes): add transfer type plugin for Mu…
…ltipartFile
- Loading branch information
Showing
36 changed files
with
7,613 additions
and
8,119 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
...nsfertypes/src/test/java/com/vaadin/hilla/parser/plugins/transfertypes/file/Endpoint.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package com.vaadin.hilla.parser.plugins.transfertypes.file; | ||
|
||
import java.lang.annotation.ElementType; | ||
import java.lang.annotation.Retention; | ||
import java.lang.annotation.RetentionPolicy; | ||
import java.lang.annotation.Target; | ||
|
||
@Retention(RetentionPolicy.RUNTIME) | ||
@Target(ElementType.TYPE) | ||
public @interface Endpoint { | ||
} |
9 changes: 9 additions & 0 deletions
9
...c/test/java/com/vaadin/hilla/parser/plugins/transfertypes/file/MultipartFileEndpoint.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package com.vaadin.hilla.parser.plugins.transfertypes.file; | ||
|
||
import org.springframework.web.multipart.MultipartFile; | ||
|
||
@Endpoint | ||
public class MultipartFileEndpoint { | ||
public void uploadFile(MultipartFile file) { | ||
} | ||
} |
30 changes: 30 additions & 0 deletions
30
...s/src/test/java/com/vaadin/hilla/parser/plugins/transfertypes/file/MultipartFileTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package com.vaadin.hilla.parser.plugins.transfertypes.file; | ||
|
||
import java.io.IOException; | ||
import java.net.URISyntaxException; | ||
import java.util.List; | ||
import java.util.Set; | ||
|
||
import org.junit.jupiter.api.Test; | ||
|
||
import com.vaadin.hilla.parser.core.Parser; | ||
import com.vaadin.hilla.parser.plugins.backbone.BackbonePlugin; | ||
import com.vaadin.hilla.parser.plugins.transfertypes.TransferTypesPlugin; | ||
import com.vaadin.hilla.parser.plugins.transfertypes.test.helpers.TestHelper; | ||
|
||
public class MultipartFileTest { | ||
private final TestHelper helper = new TestHelper(getClass()); | ||
|
||
@Test | ||
public void should_ReplaceMultipartFileClassWithLocalFileClass() | ||
throws IOException, URISyntaxException { | ||
var openAPI = new Parser() | ||
.classPath(Set.of(helper.getTargetDir().toString())) | ||
.endpointAnnotations(List.of(Endpoint.class)) | ||
.addPlugin(new BackbonePlugin()) | ||
.addPlugin(new TransferTypesPlugin()) | ||
.execute(List.of(MultipartFileEndpoint.class)); | ||
|
||
helper.executeParserWithConfig(openAPI); | ||
} | ||
} |
60 changes: 60 additions & 0 deletions
60
...rtypes/src/test/resources/com/vaadin/hilla/parser/plugins/transfertypes/file/openapi.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
{ | ||
"openapi" : "3.0.1", | ||
"info" : { | ||
"title" : "Hilla Application", | ||
"version" : "1.0.0" | ||
}, | ||
"servers" : [ | ||
{ | ||
"url" : "http://localhost:8080/connect", | ||
"description" : "Hilla Backend" | ||
} | ||
], | ||
"tags" : [ | ||
{ | ||
"name" : "MultipartFileEndpoint", | ||
"x-class-name" : "com.vaadin.hilla.parser.plugins.transfertypes.file.MultipartFileEndpoint" | ||
} | ||
], | ||
"paths" : { | ||
"/MultipartFileEndpoint/uploadFile" : { | ||
"post" : { | ||
"tags" : [ | ||
"MultipartFileEndpoint" | ||
], | ||
"operationId" : "MultipartFileEndpoint_uploadFile_POST", | ||
"requestBody" : { | ||
"content" : { | ||
"application/json" : { | ||
"schema" : { | ||
"type" : "object", | ||
"properties" : { | ||
"file" : { | ||
"nullable" : true, | ||
"anyOf" : [ | ||
{ | ||
"$ref" : "#/components/schemas/com.vaadin.hilla.runtime.transfertypes.File" | ||
} | ||
] | ||
} | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
"responses" : { | ||
"200" : { | ||
"description" : "" | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
"components" : { | ||
"schemas" : { | ||
"com.vaadin.hilla.runtime.transfertypes.File" : { | ||
"type" : "object" | ||
} | ||
} | ||
} | ||
} |
4 changes: 4 additions & 0 deletions
4
...ntime-plugin-transfertypes/src/main/java/com/vaadin/hilla/runtime/transfertypes/File.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
package com.vaadin.hilla.runtime.transfertypes; | ||
|
||
public record File() { | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.