-
Notifications
You must be signed in to change notification settings - Fork 426
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1166 from swagger-api/micronaut-3
Micronaut 3 update.
- Loading branch information
Showing
26 changed files
with
256 additions
and
201 deletions.
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
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
55 changes: 55 additions & 0 deletions
55
src/main/resources/handlebars/JavaMicronaut/apiController.mustache
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,55 @@ | ||
package {{package}}; | ||
|
||
{{#imports}} | ||
import {{import}}; | ||
|
||
{{/imports}} | ||
import io.micronaut.http.annotation.Controller; | ||
import io.micronaut.http.HttpResponse; | ||
{{#useRxJava3}} | ||
import io.reactivex.rxjava3.core.Single; | ||
{{/useRxJava3}} | ||
{{^useRxJava3}} | ||
{{#useRxJava2}} | ||
import io.reactivex.Single; | ||
{{/useRxJava2}} | ||
{{/useRxJava3}} | ||
{{#useReactor}} | ||
import org.reactivestreams.Publisher; | ||
import reactor.core.publisher.Mono; | ||
{{/useReactor}} | ||
|
||
{{#useBeanValidation}} | ||
import javax.annotation.Nullable; | ||
import javax.validation.Valid; | ||
import javax.validation.constraints.*; | ||
{{/useBeanValidation}} | ||
import java.util.List; | ||
import java.util.Map; | ||
{{#useOptional}} | ||
import java.util.Optional; | ||
{{/useOptional}} | ||
|
||
{{#operations}} | ||
@Controller | ||
public class {{classname}}Controller implements {{classname}} { | ||
{{#operation}} | ||
{{#contents}} | ||
|
||
@Override | ||
public Single<HttpResponse<{{>returnTypes}}>> {{operationId}}({{#parameters}}{{#useBeanValidation}}{{! | ||
Bean validation spec for path parameters (PathParam is always required) | ||
}}{{#isPathParam}}{{>beanValidationParams}}{{/isPathParam}}{{! | ||
Bean validation spec for any other parameters | ||
}}{{^isPathParam}}{{>nullableBeanValidationParams}}{{/isPathParam}}{{/useBeanValidation}}{{! | ||
Method argument type and name | ||
}}{{>optionalDataType}} {{paramName}}{{! | ||
Arguments separator, if required | ||
}}{{#hasMore}}, {{/hasMore}}{{/parameters}}) { | ||
// TODO: Implement me | ||
return {{classname}}.super.{{operationId}}({{#parameters}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/parameters}}); | ||
} | ||
{{/contents}} | ||
{{/operation}} | ||
} | ||
{{/operations}} |
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
1 change: 0 additions & 1 deletion
1
src/main/resources/handlebars/JavaMicronaut/beanValidationHeaderParams.mustache
This file was deleted.
Oops, something went wrong.
1 change: 1 addition & 0 deletions
1
src/main/resources/handlebars/JavaMicronaut/beanValidationParams.mustache
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 @@ | ||
{{#useBeanValidation}}{{>beanValidationParamsInner}}{{>beanValidationCore}}{{/useBeanValidation}} |
5 changes: 5 additions & 0 deletions
5
src/main/resources/handlebars/JavaMicronaut/beanValidationParamsInner.mustache
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,5 @@ | ||
{{^isPrimitiveType}}{{^isEnum}}{{! | ||
Non-container | ||
}}{{^isContainer}}@Valid {{/isContainer}}{{! | ||
Container | ||
}}{{#isContainer}}{{#items}}{{>beanValidationParamsInner}}{{/items}}{{/isContainer}}{{/isEnum}}{{/isPrimitiveType}} |
1 change: 0 additions & 1 deletion
1
src/main/resources/handlebars/JavaMicronaut/beanValidationPathParams.mustache
This file was deleted.
Oops, something went wrong.
1 change: 0 additions & 1 deletion
1
src/main/resources/handlebars/JavaMicronaut/beanValidationQueryParams.mustache
This file was deleted.
Oops, something went wrong.
2 changes: 1 addition & 1 deletion
2
src/main/resources/handlebars/JavaMicronaut/bodyParams.mustache
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 @@ | ||
{{#isBodyParam}}@Parameter(description = "{{{description}}}") {{#useBeanValidation}}@Valid {{/useBeanValidation}}@Body {{{dataType}}} {{paramName}}{{/isBodyParam}} | ||
{{#isBodyParam}}{{>nullableBeanValidationParams}}@Parameter(description = "{{{description}}}") @Body {{{dataType}}} {{paramName}}{{/isBodyParam}} |
1 change: 1 addition & 0 deletions
1
src/main/resources/handlebars/JavaMicronaut/cookieParams.mustache
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 @@ | ||
{{#isCookieParam}}{{>nullableBeanValidationParams}}@Parameter(description = "{{{description}}}") @CookieValue(value="{{baseName}}") {{>optionalDataType}} {{paramName}}{{/isCookieParam}} |
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
2 changes: 1 addition & 1 deletion
2
src/main/resources/handlebars/JavaMicronaut/formParams.mustache
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 @@ | ||
{{#isFormParam}}{{#notFile}}@Parameter(description = "{{{description}}}") @QueryValue(value = "{{baseName}}") {{{dataType}}} {{paramName}}{{/notFile}}{{#isFile}}@Parameter(description = "file detail") {{#useBeanValidation}}@Valid {{/useBeanValidation}}MultipartFile {{baseName}}{{/isFile}}{{/isFormParam}} | ||
{{#isFormParam}}{{#notFile}}{{>nullableBeanValidationParams}}@Parameter(description = "{{{description}}}") @Body(value = "{{baseName}}") {{{dataType}}} {{paramName}}{{/notFile}}{{#isFile}}@Parameter(description = "file detail") {{#useBeanValidation}}@Valid {{/useBeanValidation}}File {{baseName}}{{/isFile}}{{/isFormParam}} |
2 changes: 1 addition & 1 deletion
2
src/main/resources/handlebars/JavaMicronaut/headerParams.mustache
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 @@ | ||
{{#isHeaderParam}}{{#useBeanValidation}}{{>beanValidationHeaderParams}}{{/useBeanValidation}}@Parameter(description = "{{{description}}}") {{#useBeanValidation}}@Valid {{/useBeanValidation}}@Header(value = "{{baseName}}") {{>optionalDataType}} {{paramName}}{{/isHeaderParam}} | ||
{{#isHeaderParam}}{{>nullableBeanValidationParams}}@Parameter(description = "{{{description}}}") @Header(value = "{{baseName}}") {{>optionalDataType}} {{paramName}}{{/isHeaderParam}} |
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
1 change: 1 addition & 0 deletions
1
src/main/resources/handlebars/JavaMicronaut/nullableBeanValidationParams.mustache
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 @@ | ||
{{#useBeanValidation}}{{#required}}@NotNull {{/required}}{{^required}}@Nullable {{/required}}{{>beanValidationParams}}{{/useBeanValidation}} |
Oops, something went wrong.