caicloud / nirvana

Golang Restful API Framework for Productivity

Home Page:https://caicloud.github.io/nirvana/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[api_docs]Fatal Error: the number of parameters and function args are not equal: len(params)=1, len(funcArgs)=2 exit status 1

Tomilla opened this issue · comments

Is this a BUG REPORT or FEATURE REQUEST?:
Bug Report

/kind bug

What happened:
After run nirvana init project_name, When I am trying to generate API document page with command nirvana api pkg/apis --serve="127.0.0.1:8081",just return two fatal error as follow:

FATAL 0121-09:35:09.937+08 main.go:28 | definitions of path /apis/v1/messages/{message}: func=face_api_test/pkg/handlers.GetMessage: the number of parameters and function args are not equal: len(params)=1, len(funcArgs)=2
exit status 1
FATAL 0121-09:35:09.942+08 api.go:54 | exit status 1

What you expected to happen:
Start a new server which serves an API document page with the host and the port that specified in command line

How to reproduce it (as minimally and precisely as possible):

  1. nirvana init $(project_name) && cd $(project_name)
  2. go mod tidy // download dependencies
  3. go mod tendor // make vendored copy of dependencies
  4. make build // local build
  5. ./bin/$(project_name) // API server, listening on :8080
  6. nirvana api pkg/apis --serve=":8081" // try to start api docs service
    exit with status 1
    Anything else we need to know?:
$ nirvana -v    
nirvana version v0.4.0-alpha.1
face_api_test
├── apis
├── bin
│   └── face_api_test
├── build
│   └── face_api_test
├── cmd
│   └── face_api_test
├── docs
│   └── README.md
├── go.mod
├── go.sum
├── hack
│   ├── read_cpus_available.sh
│   ├── README.md
│   ├── script.sh
│   └── tools.go
├── Makefile
├── nirvana.yaml
├── pkg
│   ├── apis
│   ├── filters
│   ├── handlers
│   ├── middlewares
│   ├── modifiers
│   └── version
├── README.md
├── test
│   └── test_make.sh
└── vendor
    ├── github.com
    ├── golang.org
    ├── google.golang.org
    ├── gopkg.in
    └── modules.txt

try nirvana api pkg

try nirvana api pkg

Thanks, It WORK!

However, according the source code of cmd/nirvana/api/api.go, the defaultAPIsPath is "pkg/apis" if user was not set, So is this a version in-compatible issue between v0.3 and v0.4?

However, according the source code of cmd/nirvana/api/api.go, the defaultAPIsPath is "pkg/apis" if user was not set, So is this a version in-compatible issue between v0.3 and v0.4?

Oh sorry, it should be pkg since v0.3, I will update it soon