Skip to content

Ambigous path and query parameters #56

@soujiro32167

Description

@soujiro32167

Hey Devon!

I'm back to the crazy plan to generate a client for the Kubernetes API. Thanks again for all the help last Lambdaconf =]

Here is a snippet of the generated client that does not compile:

Core_v1Client.scala

 def connectCoreV1PostNamespacedPodProxyWithPath(traceBuilder: TraceBuilder[F], name: String, namespace: String, path: String, path: Option[String] = None, methodName: String = "connect-core-v1-post-namespaced-pod-proxy-with-path", headers: List[Header] = List.empty): F[ConnectCoreV1PostNamespacedPodProxyWithPathResponse] = {
    val tracingHttpClient = traceBuilder(s"$clientName:$methodName")(httpClient)
    val allHeaders = headers ++ List[Option[Header]]().flatten
    val req = Request[F](method = Method.POST, uri = Uri.unsafeFromString(host + basePath + "/api/v1/namespaces/" + Formatter.addPath(namespace) + "/pods/" + Formatter.addPath(name) + "/proxy/" + Formatter.addPath(path) + "?" + Formatter.addArg("path", path)), headers = Headers(allHeaders))
...

The path parameter appears twice, as both String and Option[String]. It is used both as a path parameter and query parameter.

Below is the corresponding OpenAPI snippet. What happens is that they define a path parameter with the same name as a query parameter:

/api/v1/namespaces/{namespace}/pods/{name}/proxy/{path}
...
  "parameters": [
   ...
   {
          "description": "Path is the URL path to use for the current proxy request to pod.",
          "in": "query",
          "name": "path",
          "type": "string",
          "uniqueItems": true
        }

I'd be happy to help with resolution, given some direction

Cheers,

Eli

"/api/v1/namespaces/{namespace}/pods/{name}/proxy/{path}": {
      "delete": {
        "consumes": [
          "*/*"
        ],
        "description": "connect DELETE requests to proxy of Pod",
        "operationId": "connectCoreV1DeleteNamespacedPodProxyWithPath",
        "produces": [
          "*/*"
        ],
        "responses": {
          "200": {
            "description": "OK",
            "schema": {
              "type": "string"
            }
          },
          "401": {
            "description": "Unauthorized"
          }
        },
        "schemes": [
          "https"
        ],
        "tags": [
          "core_v1"
        ],
        "x-kubernetes-action": "connect",
        "x-kubernetes-group-version-kind": {
          "group": "",
          "kind": "PodProxyOptions",
          "version": "v1"
        }
      },
      "get": {
        "consumes": [
          "*/*"
        ],
        "description": "connect GET requests to proxy of Pod",
        "operationId": "connectCoreV1GetNamespacedPodProxyWithPath",
        "produces": [
          "*/*"
        ],
        "responses": {
          "200": {
            "description": "OK",
            "schema": {
              "type": "string"
            }
          },
          "401": {
            "description": "Unauthorized"
          }
        },
        "schemes": [
          "https"
        ],
        "tags": [
          "core_v1"
        ],
        "x-kubernetes-action": "connect",
        "x-kubernetes-group-version-kind": {
          "group": "",
          "kind": "PodProxyOptions",
          "version": "v1"
        }
      },
      "head": {
        "consumes": [
          "*/*"
        ],
        "description": "connect HEAD requests to proxy of Pod",
        "operationId": "connectCoreV1HeadNamespacedPodProxyWithPath",
        "produces": [
          "*/*"
        ],
        "responses": {
          "200": {
            "description": "OK",
            "schema": {
              "type": "string"
            }
          },
          "401": {
            "description": "Unauthorized"
          }
        },
        "schemes": [
          "https"
        ],
        "tags": [
          "core_v1"
        ],
        "x-kubernetes-action": "connect",
        "x-kubernetes-group-version-kind": {
          "group": "",
          "kind": "PodProxyOptions",
          "version": "v1"
        }
      },
      "options": {
        "consumes": [
          "*/*"
        ],
        "description": "connect OPTIONS requests to proxy of Pod",
        "operationId": "connectCoreV1OptionsNamespacedPodProxyWithPath",
        "produces": [
          "*/*"
        ],
        "responses": {
          "200": {
            "description": "OK",
            "schema": {
              "type": "string"
            }
          },
          "401": {
            "description": "Unauthorized"
          }
        },
        "schemes": [
          "https"
        ],
        "tags": [
          "core_v1"
        ],
        "x-kubernetes-action": "connect",
        "x-kubernetes-group-version-kind": {
          "group": "",
          "kind": "PodProxyOptions",
          "version": "v1"
        }
      },
      "parameters": [
        {
          "description": "name of the PodProxyOptions",
          "in": "path",
          "name": "name",
          "required": true,
          "type": "string",
          "uniqueItems": true
        },
        {
          "description": "object name and auth scope, such as for teams and projects",
          "in": "path",
          "name": "namespace",
          "required": true,
          "type": "string",
          "uniqueItems": true
        },
        {
          "description": "path to the resource",
          "in": "path",
          "name": "path",
          "required": true,
          "type": "string",
          "uniqueItems": true
        },
        {
          "description": "Path is the URL path to use for the current proxy request to pod.",
          "in": "query",
          "name": "path",
          "type": "string",
          "uniqueItems": true
        }
      ],
      "patch": {
        "consumes": [
          "*/*"
        ],
        "description": "connect PATCH requests to proxy of Pod",
        "operationId": "connectCoreV1PatchNamespacedPodProxyWithPath",
        "produces": [
          "*/*"
        ],
        "responses": {
          "200": {
            "description": "OK",
            "schema": {
              "type": "string"
            }
          },
          "401": {
            "description": "Unauthorized"
          }
        },
        "schemes": [
          "https"
        ],
        "tags": [
          "core_v1"
        ],
        "x-kubernetes-action": "connect",
        "x-kubernetes-group-version-kind": {
          "group": "",
          "kind": "PodProxyOptions",
          "version": "v1"
        }
      },
      "post": {
        "consumes": [
          "*/*"
        ],
        "description": "connect POST requests to proxy of Pod",
        "operationId": "connectCoreV1PostNamespacedPodProxyWithPath",
        "produces": [
          "*/*"
        ],
        "responses": {
          "200": {
            "description": "OK",
            "schema": {
              "type": "string"
            }
          },
          "401": {
            "description": "Unauthorized"
          }
        },
        "schemes": [
          "https"
        ],
        "tags": [
          "core_v1"
        ],
        "x-kubernetes-action": "connect",
        "x-kubernetes-group-version-kind": {
          "group": "",
          "kind": "PodProxyOptions",
          "version": "v1"
        }
      },
      "put": {
        "consumes": [
          "*/*"
        ],
        "description": "connect PUT requests to proxy of Pod",
        "operationId": "connectCoreV1PutNamespacedPodProxyWithPath",
        "produces": [
          "*/*"
        ],
        "responses": {
          "200": {
            "description": "OK",
            "schema": {
              "type": "string"
            }
          },
          "401": {
            "description": "Unauthorized"
          }
        },
        "schemes": [
          "https"
        ],
        "tags": [
          "core_v1"
        ],
        "x-kubernetes-action": "connect",
        "x-kubernetes-group-version-kind": {
          "group": "",
          "kind": "PodProxyOptions",
          "version": "v1"
        }
      }
    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions