Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Swagger represents all maps as type "any" #4700

Closed
thockin opened this issue Feb 21, 2015 · 8 comments
Closed

Swagger represents all maps as type "any" #4700

thockin opened this issue Feb 21, 2015 · 8 comments
Assignees
Labels
area/api Indicates an issue on api area. area/swagger area/usability kind/documentation Categorizes issue or PR as related to documentation. priority/backlog Higher priority than priority/awaiting-more-evidence. sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery.

Comments

@thockin
Copy link
Member

thockin commented Feb 21, 2015

"labels": "v1beta3.ObjectMeta.labels",

Not sure what that means...

@vmarmol vmarmol added kind/documentation Categorizes issue or PR as related to documentation. area/api Indicates an issue on api area. team/master labels Feb 22, 2015
@bgrant0607 bgrant0607 added area/usability sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. priority/backlog Higher priority than priority/awaiting-more-evidence. and removed team/master labels Feb 23, 2015
@bgrant0607
Copy link
Member

cc @nikhiljindal

@bgrant0607 bgrant0607 changed the title Swagger UI show weirdly for labels Swagger represents all maps as type "any" Apr 7, 2015
@bgrant0607
Copy link
Member

All maps currently show as type "any", which I think was done as a workaround for undefined custom types (#2971).

@wing328
Copy link

wing328 commented Jul 23, 2015

FYI. In the future, when the spec is upgraded to 2.0, the map can be documented using additionalProperties, e.g. string to model mapping

{
  "type": "object",
  "additionalProperties": {
    "$ref": "#/definitions/ComplexModel"
  }
}

Ref: https://github.com/swagger-api/swagger-spec/blob/master/versions/2.0.md#model-with-mapdictionary-properties

@wing328
Copy link

wing328 commented Mar 10, 2016

@thockin @nikhiljindal Before the spec gets upgraded to OpenAPI/Swagger spec 2.0, can we replace "type": "any" with "type": "object" for the time being so as to avoid compilation error related to missing model "Any" ?

@nikhiljindal
Copy link
Contributor

Does "type": "object" have any special meaning?
I think we chose "type":"any" arbitrarily to represent custom types.
It should be fine to change it.

@wing328
Copy link

wing328 commented Mar 10, 2016

"type": "object" means arbitrary JSON/XML.

@nikhiljindal
Copy link
Contributor

emicklei/go-restful#270 replaces "any" by "object".
Thanks @wing328

k8s-github-robot pushed a commit that referenced this issue Apr 9, 2016
Automatic merge from submit-queue

Allowing type object in kubectl swagger validation

Allowing `"type": "object"` in kubectl swagger validation.

We will cherrypick this in 1.2
This allows 1.2 kubectl to work with 1.3 api server which will use `"type":"object"` instead of `"type":"any"`.
Ref #4700 (comment)

cc @bgrant0607
k8s-github-robot pushed a commit that referenced this issue Apr 15, 2016
Automatic merge from submit-queue

Updating go-restful to generate "type":"object" instead of "type":"any" in swagger-spec (breaks kubectl 1.1)

Updating go-restful to include emicklei/go-restful#270 (replacing type "any" by type "object". Ref swagger-api/swagger-codegen#2347 on why we want to do that)
Ref #4700 (comment)

First commit generated using:
```
godep restore
go get -u github.com/emicklei/go-restful
godep update github.com/emicklei/go-restful
```

Second commit generated by running 
```
./hack/update-swagger-spec.sh
```

Third commit generated by running:
```
./hack/update-api-reference-docs.sh
```

cc @kubernetes/sig-api-machinery @bgrant0607
@mbohlool
Copy link
Contributor

Maps are represented correctly in swagger 2.0/OpenAPI now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/api Indicates an issue on api area. area/swagger area/usability kind/documentation Categorizes issue or PR as related to documentation. priority/backlog Higher priority than priority/awaiting-more-evidence. sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery.
Projects
None yet
Development

No branches or pull requests

6 participants