-
Notifications
You must be signed in to change notification settings - Fork 28
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
refactor: xml content type header renderer to be overridable #977
Conversation
renderContentTypeHeader(ctx, op, writer) | ||
} | ||
|
||
protected open fun renderContentTypeHeader(ctx: ProtocolGenerator.GenerationContext, op: OperationShape, writer: KotlinWriter) { | ||
val resolver = getProtocolHttpBindingResolver(ctx.model, ctx.service) |
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.
Nit: Pass resolver
through to renderContentTypeHeader
.
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.
We don't do that elsewhere FWIW (e.g.renderUri
below)
renderContentTypeHeader(ctx, op, writer) | ||
} | ||
|
||
protected open fun renderContentTypeHeader(ctx: ProtocolGenerator.GenerationContext, op: OperationShape, writer: KotlinWriter) { | ||
val resolver = getProtocolHttpBindingResolver(ctx.model, ctx.service) |
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.
We don't do that elsewhere FWIW (e.g.renderUri
below)
b21fee1
to
cae26c5
Compare
*/ | ||
fun OperationShape.inputIsUnionShape(model: Model): Boolean { | ||
val reqShape = model.expectShape<StructureShape>(input.get()) | ||
return reqShape.isUnionShape |
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.
fix: This is always false. (1) operation inputs MUST be a structure shape and (2) you've already pulled out a StructureShape
so it can't be a UnionShape
at this point.
I don't think you even need this function though as the other function introduced appears to do what you want/need.
@@ -193,6 +192,15 @@ val Shape.isSparse: Boolean | |||
val Shape.isStreaming: Boolean | |||
get() = hasTrait<StreamingTrait>() | |||
|
|||
/** | |||
* Returns boolean indicating if operation input is union shaped |
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.
fix: It returns true if the operation input has an explicit HTTP payload member that is a union shape.
The input shape itself can never be a union in smithy.
Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
Issue #
Description of changes
-The part of the code that renders the xml content type header is made overridable
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.