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

doc格式支持更宽松的写法 #4

Open
fishbar opened this issue Dec 29, 2017 · 1 comment
Open

doc格式支持更宽松的写法 #4

fishbar opened this issue Dec 29, 2017 · 1 comment

Comments

@fishbar
Copy link
Owner

fishbar commented Dec 29, 2017

以下case需要跑通

/**
 * description
 * @api /tset
 *       description
 * @query
 *        description
 * @body
 *        description
 * @success
 * @error
 **/
@baqian
Copy link

baqian commented Jan 27, 2018

建议支持schema描述 params、query和body

@api {POST|GET} /api/${version}/user/:id
@name 获取用户信息
@description 获取用户信息
@params
  id {String} 用户ID
  status {Boolean} 用户状态
@query
   limit {Object} se
     {
       search {String[]} must be urlencoded
       search1 {String} must be urlencoded
     }
   createTime:dataTime {String} must be urlencoded

@body:json
   name {Object} s

@success:json
   search {String[]} must be urlencoded
@success
   description
@failure
   description
@example
@private
@public
@internal

解析后

[
   {
      "token": "api",
      "methods": [
         "post",
         "get"
      ],
      "url": "/api/${version}/user/:id"
   },
   {
      "token": "name",
      "value": "获取用户信息"
   },
   {
      "token": "desc",
      "value": " 获取用户信息
"
   },
   {
      "token": "params",
      "type": null,
      "value": [
         {
            "name": "id",
            "type": "String",
            "format": null,
            "desc": "用户ID"
         },
         {
            "name": "status",
            "type": "Boolean",
            "format": null,
            "desc": "用户状态"
         }
      ]
   },
   {
      "token": "query",
      "type": null,
      "value": [
         {
            "name": "limit",
            "type": "Object",
            "format": null,
            "desc": "se",
            "properties": [
               {
                  "name": "search",
                  "type": "Array",
                  "format": null,
                  "desc": "must be urlencoded",
                  "items": {
                     "type": "String"
                  }
               },
               {
                  "name": "search1",
                  "type": "String",
                  "format": null,
                  "desc": "must be urlencoded"
               }
            ]
         },
         {
            "name": "createTime",
            "type": "String",
            "format": "dataTime",
            "desc": "must be urlencoded"
         }
      ]
   },
   {
      "token": "body",
      "type": "json",
      "value": [
         {
            "name": "name",
            "type": "Object",
            "format": null,
            "desc": "s",
            "properties": null
         }
      ]
   },
   {
      "token": "success",
      "type": "json",
      "value": [
         {
            "name": "search",
            "type": "Array",
            "format": null,
            "desc": "must be urlencoded",
            "items": {
               "type": "String"
            }
         }
      ]
   },
   {
      "token": "success",
      "type": "json",
      "value": "
   description
"
   },
   {
      "token": "failure",
      "type": "json",
      "value": "
   description
"
   },
   {
      "token": "example",
      "value": ""
   },
   {
      "token": "private",
      "value": true
   },
   {
      "token": "public",
      "value": true
   },
   {
      "token": "internal",
      "value": true
   }
]

baqian added a commit to baqian/api-annotation that referenced this issue Jan 27, 2018
baqian added a commit to baqian/api-annotation that referenced this issue Jan 28, 2018
baqian added a commit to baqian/api-annotation that referenced this issue Jan 29, 2018
baqian added a commit to baqian/api-annotation that referenced this issue Jan 29, 2018
baqian added a commit to baqian/api-annotation that referenced this issue Jan 30, 2018
baqian added a commit to baqian/api-annotation that referenced this issue Jan 31, 2018
fishbar added a commit that referenced this issue Feb 1, 2018
annoation pegjs support schemaJSON #4
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

2 participants