k8s-api icon indicating copy to clipboard operation
k8s-api copied to clipboard

Fix http ports coerced schema

Open marcossimoes opened this issue 3 years ago • 0 comments

Http ports should be allowed to be either the port number itself (integer) or a reference to a previously specified port number (string starting with a letter). Although the spec in the current schema is called int or string, the type is defaulting to a string. But passing the port number as a string is rejected by k8s api, as given a string it would expect it to start with a letter.

openapi v2 spec

curl -k https://staging-global-blue-kubernetes-api.nubank.com.br/openapi/v2 -H "Authorization: Bearer $(cat /tmp/token2)" | jq '.definitions["io.k8s.apimachinery.pkg.util.intstr.IntOrString"]'

{
  "description": "IntOrString is a type that can hold an int32 or a string.  When used in JSON or YAML marshalling and unmarshalling, it produces or consumes the inner type.  This allows you to have, for example, a JSON field that can accept a name or number.",
  "type": "string",
  "format": "int-or-string"
}

marcossimoes avatar May 05 '21 17:05 marcossimoes