Skip to content

Conversation

jmshin92
Copy link

@jmshin92 jmshin92 commented Mar 8, 2019

  • Support NSRouter
    • As NSRouter doesn't need @router annotation, changed parserComments to parse comments of HTTP method functions(Get, Post, ...) without @router annotation
  • Support multi-level namespace
    • Traverse Namespace, NSRouter, NSInclude in a depth-first manner.
    • Set controller's tag as a concatenation of route path from root(NewNamespace) to leaf nodes(NSRouter, NSInclude)
package routers

import (
	"beetest/controllers"
	"github.com/astaxie/beego"
)

func init() {
	ns := beego.NewNamespace("/v1",
		beego.NSNamespace("/object",
			beego.NSNamespace("/multi-lvl",
				beego.NSInclude(
					&controllers.ObjectController{},
				),
				beego.NSRouter("/router",
					&controllers.UserController{},
				),
			),
		),
	)
	beego.AddNamespace(ns)
}
// controllers/user.go
package controllers

import "github.com/astaxie/beego"

// Operations about Users
type UserController struct {
	beego.Controller
}

// @Title getUser
// @Description get user
// @Success 200 {string} models.User
func (o *UserController) Get() {
}

* Support `NSRouter`
  * As `NSRouter` doesn't need `@router` annotation, changed `parserComments` to parse comments of HTTP method functions(Get, Post, ...) without `@router` annotation
* Support multi-level namespace
  * Traverse `Namespace`, `NSRouter`, `NSInclude` in a depth-first manner.
  * Set controller's tag as a concatenation of route path from root(`NewNamespace)` to leaf nodes(`NSRouter`, `NSInclude`)
@astaxie astaxie requested a review from amrfaissal March 8, 2019 12:09
@zy943453722
Copy link

请问下这个什么时候可以合呢?

Baihhh pushed a commit to Baihhh/bee that referenced this pull request Jul 5, 2023
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

Successfully merging this pull request may close these issues.

2 participants