首页 > 解决方案 > 标签的 API Swagger 定义

问题描述

查看元数据类型的 swagger 定义,我看到标签指定为字符串:

   "labels": {
          "additionalProperties": {
            "type": "string"
          },
          "description": "Map of string keys and values that can be used to organize and categorize (scope and select) objects. May match selectors of replication controllers and services. More info: http://kubernetes.io/docs/user-guide/labels",
          "type": "object"
        },

在查看 API 的代码时,似乎这需要是字符串对的映射:

    // Map of string keys and values that can be used to organize and categorize
    // (scope and select) objects. Some resources contain `selectors` which
    // can be linked with other resources by their labels
    map<string, string> labels = 5;

问题是,为什么 swagger.json 文件与代码不同步?

似乎所有“地图”所需的类型都被歪曲了......

标签: kubernetes-apiserver

解决方案


推荐阅读