Skip to content

Use /orgs instead of /org to match GitHub v3 API #2639

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

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion routers/api/v1/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ func RegisterRoutes(m *macaron.Macaron) {
}, reqToken())

// Repositories
m.Post("/org/:org/repos", reqToken(), bind(api.CreateRepoOption{}), repo.CreateOrgRepo)
m.Post("/orgs/:orgname/repos", reqToken(), bind(api.CreateRepoOption{}), repo.CreateOrgRepo)

m.Group("/repos", func() {
m.Get("/search", repo.Search)
Expand Down
4 changes: 2 additions & 2 deletions routers/api/v1/repo/repo.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ func Create(ctx *context.APIContext, opt api.CreateRepoOption) {

// CreateOrgRepo create one repository of the organization
func CreateOrgRepo(ctx *context.APIContext, opt api.CreateRepoOption) {
// swagger:route POST /org/{org}/repos organization createOrgRepo
// swagger:route POST /orgs/{orgname}/repos organization createOrgRepo
//
// Consumes:
// - application/json
Expand All @@ -173,7 +173,7 @@ func CreateOrgRepo(ctx *context.APIContext, opt api.CreateRepoOption) {
// 403: forbidden
// 500: error
Copy link
Member

@sapk sapk Oct 2, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You need to update the swagger:route (the url part) also. You can even edit {org} since in url params in swagger are not yet configured.


org, err := models.GetOrgByName(ctx.Params(":org"))
org, err := models.GetOrgByName(ctx.Params(":orgname"))
if err != nil {
if models.IsErrOrgNotExist(err) {
ctx.Error(422, "", err)
Expand Down