negreanucalin/multidoc-parser

0.1.5 2021-11-24 11:48 UTC

This package is auto-updated.

Last update: 2024-09-24 23:21:15 UTC


README

查看 Multidoc viewer

你说的是 Laravel?

测试

目前只提供在 demo_files 文件夹中运行的 index.php 的手动功能测试,并检查输出结果

待办事项列表

  • 通过添加示例文件来定义必需和可选参数
  • 验证路由参数
    1. 如果存在 FILE 和 JSON 或命名 POST 变量,抛出错误(只能选择其中之一)
    2. 参数类型验证(从列表:uri,post,get)
    3. GET 不能有 JSON 和 FILE
    4. 路由验证:I. 如果参数存在于路由中,检查它是否存在于列表中 II. 如果参数存在,检查它是否是 uri
  • 解析 *.yaml 文件并生成包含应用程序文档的单一代文

注意

  • 不需要文件名约定

  • 你可以按任何方式组织

  • 建议使用多个文件

    • _project.yaml - 项目描述
    • _categories.yaml - 菜单项和子项
    • user_route.yaml - 路由示例
    • another_route.yaml - 路由示例
  • 项目

    • 文件名 _my_awesome_project.yaml
project:
  name: My Awesome project
  version: 1
  description: Some awesome description
  environments:
    default: https://wwww.myproductionurl.com
    preprod: https://www.mypreproductionurl.com
  • 分类
    • 文件名 _my_awesome_categories.yaml
categories:
  cat1:
    name: Cat 1
    categories:
      cat2:
        name: Cat 2
  cat3:
      name: Cat 3
  cat4:
      name: Cat 4
  • 路由示例
    • 文件名 user_route.yaml
route:
  name: Some route 1
  description: Some desc 1
  tags: [tag1, tag2, tag3, tag4, tag5]
  category: cat1
  request:
      url: '{{environment}}/[:typeEntity][/:page]/comments'
      method: GET
      params:
        - name: typeEntity
          type: uri
          data_type: string
          description: Some desc
          optional: false
          example: posts
        - name: page
          type: uri
          data_type: int
          description: Some desc
          optional: true
          example: 1
  • 多个路由示例
    • 文件名 some_routes.yaml
route_list:
  - name: Some route 2
    description: Some desc 2
    tags: [tag1, tag2, tag3, tag4, tag 5]
    category: cat1
    request:
        url: '{{environment}}/[:typeEntity][/:page]/comments'
        method: GET
        params:
          - name: typeEntity
            type: uri
            data_type: string
            description: Some desc
            optional: false
            example: posts
          - name: page
            type: uri
            data_type: int
            description: Some desc
            optional: true
            example: 1
  - name: Some route 3
    description: Some desc 3
    request:
        url: '{{environment}}/users/2/comments'
        method: GET
    tags: [tag3, tag4]
    category: cat2
  - name: Some route 4
    description: Some desc 4
    tags: [tag3, tag4]
    category: cat2
    request:
        url: '{{environment}}/[:typeEntity][/:page]/comments'
        method: GET
    params:
      - name: typeEntity
        type: uri
        data_type: string
        description: Some desc
        optional: false
        example: posts
        possible_values: [posts,test]