Skip to content

Fix http ports coerced schema #7

@marcossimoes

Description

@marcossimoes

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"
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions