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

Function urlPlaceholders

pkg/codegen/server_urls.go:27–37  ·  view source on GitHub ↗

urlPlaceholders returns the set of variable names referenced as `{name}` placeholders in a Server URL template, deduplicated.

(url string)

Source from the content-addressed store, hash-verified

25// urlPlaceholders returns the set of variable names referenced as
26// `{name}` placeholders in a Server URL template, deduplicated.
27func urlPlaceholders(url string) map[string]struct{} {
28 matches := serverURLPlaceholderRE.FindAllStringSubmatch(url, -1)
29 if len(matches) == 0 {
30 return nil
31 }
32 set := make(map[string]struct{}, len(matches))
33 for _, m := range matches {
34 set[m[1]] = struct{}{}
35 }
36 return set
37}
38
39// ServerObjectDefinition defines the definition of an OpenAPI Server object (https://spec.openapis.org/oas/v3.0.3#server-object) as it is provided to code generation in `oapi-codegen`
40type ServerObjectDefinition struct {

Callers 3

TestURLPlaceholdersFunction · 0.85
UsedVariablesMethod · 0.85

Calls

no outgoing calls

Tested by 1

TestURLPlaceholdersFunction · 0.68