-
-
Notifications
You must be signed in to change notification settings - Fork 6.6k
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
[kotlin-spring] use spring resource for file handling #2455
Merged
Merged
Changes from 2 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
0a51378
[kotlin-spring] use org.springframework.core.io.Resource for file han…
sylvainmoindron fa0aaab
run ./bin/kotlin-springboot-petstore-server.sh
sylvainmoindron d198be8
run ./bin/kotlin-springboot-petstore-server.sh after building the CLI
sylvainmoindron d3d100c
use MultipartFile for file in form and the specified type otherwise
sylvainmoindron 69a2359
remplace tab with space
sylvainmoindron 7dab7e8
[kotlin-springboot] replace all instance of MultipartFile by Resource
sylvainmoindron e12a86a
Merge remote-tracking branch 'openapi/master'
sylvainmoindron b282f18
run ./bin/kotlin-springboot-petstore-server.sh
sylvainmoindron 4f8a555
Merge branch 'master' into master
wing328 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
2 changes: 1 addition & 1 deletion
2
samples/server/petstore/kotlin-springboot/.openapi-generator/VERSION
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 |
---|---|---|
@@ -1 +1 @@ | ||
3.3.0-SNAPSHOT | ||
4.0.0-SNAPSHOT |
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
7 changes: 4 additions & 3 deletions
7
...s/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/PetApiService.kt
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -39,8 +39,8 @@ class UserApiController(@Autowired(required = true) val service: UserApiService) | |
@RequestMapping( | ||
value = ["/user"], | ||
method = [RequestMethod.POST]) | ||
fun createUser(@ApiParam(value = "Created user object" ,required=true ) @Valid @RequestBody user: User): ResponseEntity<Unit> { | ||
return ResponseEntity(service.createUser(user), HttpStatus.OK) | ||
fun createUser(@ApiParam(value = "Created user object" ,required=true ) @Valid @RequestBody body: User): ResponseEntity<Unit> { | ||
return ResponseEntity(service.createUser(body), HttpStatus.OK) | ||
} | ||
|
||
@ApiOperation( | ||
|
@@ -52,8 +52,8 @@ class UserApiController(@Autowired(required = true) val service: UserApiService) | |
@RequestMapping( | ||
value = ["/user/createWithArray"], | ||
method = [RequestMethod.POST]) | ||
fun createUsersWithArrayInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody user: List<User>): ResponseEntity<Unit> { | ||
return ResponseEntity(service.createUsersWithArrayInput(user), HttpStatus.OK) | ||
fun createUsersWithArrayInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody body: List<User>): ResponseEntity<Unit> { | ||
return ResponseEntity(service.createUsersWithArrayInput(body), HttpStatus.OK) | ||
} | ||
|
||
@ApiOperation( | ||
|
@@ -65,8 +65,8 @@ class UserApiController(@Autowired(required = true) val service: UserApiService) | |
@RequestMapping( | ||
value = ["/user/createWithList"], | ||
method = [RequestMethod.POST]) | ||
fun createUsersWithListInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody user: List<User>): ResponseEntity<Unit> { | ||
return ResponseEntity(service.createUsersWithListInput(user), HttpStatus.OK) | ||
fun createUsersWithListInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody body: List<User>): ResponseEntity<Unit> { | ||
return ResponseEntity(service.createUsersWithListInput(body), HttpStatus.OK) | ||
} | ||
|
||
@ApiOperation( | ||
|
@@ -78,7 +78,7 @@ class UserApiController(@Autowired(required = true) val service: UserApiService) | |
@RequestMapping( | ||
value = ["/user/{username}"], | ||
method = [RequestMethod.DELETE]) | ||
fun deleteUser(@ApiParam(value = "The name that needs to be deleted", required=true) @PathVariable("username") username: String): ResponseEntity<Unit> { | ||
fun deleteUser(@ApiParam(value = "The name that needs to be deleted", required=true, defaultValue="null") @PathVariable("username") username: String): ResponseEntity<Unit> { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This looks unrelated to this PR, but I don't think passing a |
||
return ResponseEntity(service.deleteUser(username), HttpStatus.OK) | ||
} | ||
|
||
|
@@ -93,7 +93,7 @@ class UserApiController(@Autowired(required = true) val service: UserApiService) | |
value = ["/user/{username}"], | ||
produces = ["application/xml", "application/json"], | ||
method = [RequestMethod.GET]) | ||
fun getUserByName(@ApiParam(value = "The name that needs to be fetched. Use user1 for testing.", required=true) @PathVariable("username") username: String): ResponseEntity<User> { | ||
fun getUserByName(@ApiParam(value = "The name that needs to be fetched. Use user1 for testing.", required=true, defaultValue="null") @PathVariable("username") username: String): ResponseEntity<User> { | ||
return ResponseEntity(service.getUserByName(username), HttpStatus.OK) | ||
} | ||
|
||
|
@@ -108,7 +108,7 @@ class UserApiController(@Autowired(required = true) val service: UserApiService) | |
value = ["/user/login"], | ||
produces = ["application/xml", "application/json"], | ||
method = [RequestMethod.GET]) | ||
fun loginUser(@NotNull @ApiParam(value = "The user name for login", required = true) @Valid @RequestParam(value = "username", required = true) username: String,@NotNull @ApiParam(value = "The password for login in clear text", required = true) @Valid @RequestParam(value = "password", required = true) password: String): ResponseEntity<String> { | ||
fun loginUser(@NotNull @ApiParam(value = "The user name for login", required = true, defaultValue = "null") @Valid @RequestParam(value = "username", required = true, defaultValue="null") username: String,@NotNull @ApiParam(value = "The password for login in clear text", required = true, defaultValue = "null") @Valid @RequestParam(value = "password", required = true, defaultValue="null") password: String): ResponseEntity<String> { | ||
return ResponseEntity(service.loginUser(username, password), HttpStatus.OK) | ||
} | ||
|
||
|
@@ -134,7 +134,7 @@ class UserApiController(@Autowired(required = true) val service: UserApiService) | |
@RequestMapping( | ||
value = ["/user/{username}"], | ||
method = [RequestMethod.PUT]) | ||
fun updateUser(@ApiParam(value = "name that need to be deleted", required=true) @PathVariable("username") username: String,@ApiParam(value = "Updated user object" ,required=true ) @Valid @RequestBody user: User): ResponseEntity<Unit> { | ||
return ResponseEntity(service.updateUser(username, user), HttpStatus.OK) | ||
fun updateUser(@ApiParam(value = "name that need to be deleted", required=true, defaultValue="null") @PathVariable("username") username: String,@ApiParam(value = "Updated user object" ,required=true ) @Valid @RequestBody body: User): ResponseEntity<Unit> { | ||
return ResponseEntity(service.updateUser(username, body), HttpStatus.OK) | ||
} | ||
} |
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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like the default should be
null
(without double quotes) or should be omitted.I don't think it's related to this change so we will need to fix it later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I saw lot of change in the gérérated code (last time it was générated was 3.3.9 on Sep 2018).
i alsa saw a change in the body parameter name
(@Valid
@RequestBody pet: Petchanged to
@Valid
@RequestBody body: PetThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@wing328 This looks like it's probably an issue with the spec document? An id path parameter, by definition, can't be null otherwise the request won't match the path definition.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there is another PR for this problem i think
#2487