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

go-swagger route can't handle Chinese characters properly #1116

Closed
nlimpid opened this issue Aug 1, 2017 · 1 comment
Closed

go-swagger route can't handle Chinese characters properly #1116

nlimpid opened this issue Aug 1, 2017 · 1 comment

Comments

@nlimpid
Copy link

nlimpid commented Aug 1, 2017

Problem statement

go-swagger will ignore swagger:route section when there is Chinese character in it.

Swagger specification

code to generate swagger.json

package swagger

// swagger:route GET /online get room list 中
//
// Lists pets filtered by some parameters.
//
// This will show all available pets by default.
// You can get the pets that are out of stock
//
//     Responses:
//       default: test
//
func getOnline() {}

result

{
  "consumes": [
    "application/json"
  ],
  "produces": [
    "application/json"
  ],
  "schemes": [
    "http",
    "https"
  ],
  "swagger": "2.0",
  "info": {
    "title": "Ksweb API.",
    "version": "1.0.0"
  },
  "basePath": "/api",
  "paths": {},
  "definitions": {
...
// others

but if remove the '中' character in the go code, the swagger.json will have the router.

{
  "consumes": [
    "application/json"
  ],
  "produces": [
    "application/json"
  ],
  "schemes": [
    "http",
    "https"
  ],
  "swagger": "2.0",
  "info": {
    "title": "Ksweb API.",
    "version": "1.0.0"
  },
  "basePath": "/api",
  "paths": {
    "/online": {
      "get": {
        "description": "This will show all available pets by default.\nYou can get the pets that are out of stock",
        "tags": [
          "get",
          "room"
        ],
        "summary": "Lists pets filtered by some parameters.",
        "operationId": "list",
        "responses": {
          "default": {
            "$ref": "#/responses/test"
          }
        }
      }
    }
  },
  "definitions": {
...
// abbreviate details

Steps to reproduce

swagger generate spec -o ./swagger.json -m

generate the swagger.json, ignore the model definition here.

Environment

swagger version: 0.10.0
go version: go.1.8.3 darwin/amd64
OS: macOS 10.12.5

@nlimpid
Copy link
Author

nlimpid commented Aug 4, 2017

I am sorry that I am wrong. The problem remains and can be reproduction with which I mention, but the real problem is "operationId" can't be Chinese characters.

It's a problem but I think it is not important, so I choose to close this issue.

@nlimpid nlimpid closed this as completed Aug 4, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant