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

Function TestOrderedParamsFromUri

pkg/codegen/utils_test.go:466–477  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

464}
465
466func TestOrderedParamsFromUri(t *testing.T) {
467 result := OrderedParamsFromUri("/path/{param1}/{.param2}/{;param3*}/foo")
468 assert.EqualValues(t, []string{"param1", "param2", "param3"}, result)
469
470 result = OrderedParamsFromUri("/path/foo")
471 assert.EqualValues(t, []string{}, result)
472
473 // A parameter can appear more than once in the URI (e.g. Keycloak API).
474 // OrderedParamsFromUri faithfully returns all occurrences.
475 result = OrderedParamsFromUri("/admin/realms/{realm}/clients/{client-uuid}/roles/{role-name}/composites/clients/{client-uuid}")
476 assert.EqualValues(t, []string{"realm", "client-uuid", "role-name", "client-uuid"}, result)
477}
478
479func TestSortParamsByPath(t *testing.T) {
480 strSchema := &openapi3.Schema{Type: &openapi3.Types{"string"}}

Callers

nothing calls this directly

Calls 1

OrderedParamsFromUriFunction · 0.85

Tested by

no test coverage detected