func serviceDoc(w http.ResponseWriter, r *http.Request, t auth.Token) error {
	serviceName := r.URL.Query().Get(":name")
	s, err := getService(serviceName)
	if err != nil {
		return err
	}
	if s.IsRestricted {
		allowed := permission.Check(t, permission.PermServiceReadDoc,
			contextsForService(&s)...,
		)
		if !allowed {
			return permission.ErrUnauthorized
		}
	}
	w.Write([]byte(s.Doc))
	return nil
}
func serviceDoc(w http.ResponseWriter, r *http.Request, t auth.Token) error {
	serviceName := r.URL.Query().Get(":name")
	s, err := getService(serviceName)
	if err != nil {
		return err
	}
	if s.IsRestricted {
		allowed := permission.Check(t, permission.PermServiceReadDoc,
			contextsForService(&s)...,
		)
		if !allowed {
			return permission.ErrUnauthorized
		}
	}
	w.Write([]byte(s.Doc))
	return nil
}
func serviceDoc ( w http . ResponseWriter , r * http . Request , t auth . Token ) error { serviceName := r . URL . Query ( ) . Get ( " " ) s , err := getService ( serviceName ) if err != nil { return err } if s . IsRestricted { allowed := permission . Check ( t , permission . PermServiceReadDoc , contextsForService ( & s ) ... , ) if ! allowed { return permission . ErrUnauthorized } } w . Write ( [ ] byte ( s . Doc ) ) return nil }
// title: service doc
// path: /services/{name}/doc
// method: GET
// responses:
//   200: OK
//   401: Unauthorized
//   404: Not found
title : service doc path : / services / { name } / doc method : GET responses : 200 : OK 401 : Unauthorized 404 : Not found