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

Function getConditionOfResponseName

pkg/codegen/template_helpers.go:305–314  ·  view source on GitHub ↗

Return the statusCode comparison clause from the response name.

(statusCodeVar, responseName string)

Source from the content-addressed store, hash-verified

303
304// Return the statusCode comparison clause from the response name.
305func getConditionOfResponseName(statusCodeVar, responseName string) string {
306 switch responseName {
307 case "default":
308 return "true"
309 case "1XX", "2XX", "3XX", "4XX", "5XX":
310 return fmt.Sprintf("%s / 100 == %s", statusCodeVar, responseName[:1])
311 default:
312 return fmt.Sprintf("%s == %s", statusCodeVar, responseName)
313 }
314}
315
316// This outputs a string array
317func toStringArray(sarr []string) string {

Callers 3

genResponseUnmarshalFunction · 0.85
buildUnmarshalCaseFunction · 0.85
buildUnmarshalCaseStrictFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…