-
Notifications
You must be signed in to change notification settings - Fork 94
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
Add parameter and response body mapping #1089
Merged
Merged
Conversation
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
yawkat
reviewed
Jun 29, 2023
} | ||
|
||
private static List<Map<String, String>> parseListOfMaps(String string) { | ||
System.out.println("json: " + string); |
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.
Suggested change
System.out.println("json: " + string); |
yawkat
approved these changes
Jun 29, 2023
melix
approved these changes
Jun 29, 2023
graemerocher
approved these changes
Jun 29, 2023
SonarCloud Quality Gate failed. 0 Bugs 0.0% Coverage Catch issues before they fail your Quality Gate with our IDE extension SonarLint |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
These changes are to allow the use of custom types for parameters and response bodies to utilize all Micronaut capabilities for code simplification.
Parameters mapping
As an example, if we add the following parameter mappings:
micronaut
Pageable
will be used forpage
,size
orsortOrder
headers:instead of each header being a separate parameter:
The spec in this case is :
Similarly to the example above, custom types can be created with
TypedRequestArgumentBinder
implementations. Parameters can be ignored by setting themappedType
tonull
, as some parameters may be consumed inside interceptors or filters.Response body mapping
The body mapping works in a similar way, but changes the return type of operation. Since server can only return header parameters, the mapping is done based on them.
For example, if we add the following body mapping:
the operation would be created as (if a
Last-Modified
header is specified):The custom
DatedResponse
object then would need aMessageBodyWriter
implementation and include the required header.The specification in the case above:
Note
We can make this interface available in gradle/maven plugins or keep available for extension generators only.