MCPcopy Index your code
hub / github.com/oapi-codegen/oapi-codegen / buildUnmarshalCaseStrict

Function buildUnmarshalCaseStrict

pkg/codegen/template_helpers.go:278–284  ·  view source on GitHub ↗
(typeDefinition ResponseTypeDefinition, caseAction string, contentType string)

Source from the content-addressed store, hash-verified

276}
277
278func buildUnmarshalCaseStrict(typeDefinition ResponseTypeDefinition, caseAction string, contentType string) (caseKey string, caseClause string) {
279 caseKey = fmt.Sprintf("%s.%s.%s", prefixLeastSpecific, contentType, typeDefinition.ResponseName)
280 caseClauseKey := getConditionOfResponseName("rsp.StatusCode", typeDefinition.ResponseName)
281 contentTypeLiteral := StringToGoString(contentType)
282 caseClause = fmt.Sprintf("case rsp.Header.Get(\"%s\") == %s && %s:\n%s\n", "Content-Type", contentTypeLiteral, caseClauseKey, caseAction)
283 return caseKey, caseClause
284}
285
286// genResponseTypeName creates the name of generated response types (given the operationID).
287// It first checks if the multi-pass name resolver has assigned a name for this

Callers 1

genResponseUnmarshalFunction · 0.85

Calls 2

StringToGoStringFunction · 0.85

Tested by

no test coverage detected