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

Add --diff-path flag #302

Merged
merged 8 commits into from
May 21, 2024
Merged

Add --diff-path flag #302

merged 8 commits into from
May 21, 2024

Conversation

hahwul
Copy link
Member

@hahwul hahwul commented May 15, 2024

How

  • Compare in NoirRunner.
  • Compare through multiple NoirRunner.

More options?

  • --diff-path

@github-actions github-actions bot added the ⚙️ options Issue for options (flag) label May 15, 2024
@hahwul hahwul self-assigned this May 16, 2024
@github-actions github-actions bot added the 📦 output-builder Issue for output builder (format) label May 20, 2024
@hahwul
Copy link
Member Author

hahwul commented May 20, 2024

Sample - plain

./bin/noir -b ./spec/functional_test/fixtures/oas3 --diff-path ./spec/functional_test/fixtures/oas2

░█▄─░█ ░█▀▀▀█ ▀█▀ ░█▀▀█
░█░█░█ ░█──░█ ░█─ ░█▄▄▀
░█──▀█ ░█▄▄▄█ ▄█▄ ░█─░█ {v0.15.1}

[*] Running Noir with Diff mode.
[*] Detecting technologies to base directory.
[I] Detected 1 technologies.
    oas3
[*] Start code analysis based on the detected technology.
[*] Initializing analyzers
    27 Analyzers initialized
[*] Analysis Started
    Code Analyzer: 1 in use
    Found 15 endpoints
[*] Optimizing endpoints.
[I] Finally identified 10 endpoints.
[*] Diffing base and diff codebases.
[*] Generating Diff Report.
GET /gems_json?query=&sort=
  ○ cookies: cookie=
POST /gems_json?query=&sort=
  ○ cookies: cookie=
GET /gems
GET /gems_yml?query=&sort=
  ○ cookies: cookie=
PUT /gems_yml?query=&sort=
  ○ cookies: cookie=
GET /pets?query=&sort=
  ○ cookies: cookie=
POST /pets
  ○ body: {"name":""}
GET /pets/{petId}
PUT /pets/{petId}
  ○ body: {"name":"","breed":""}
GET /shards
[*] ============== DIFF ==============
[I] Added: /gems_json GET
[I] Added: /gems_json POST
[I] Added: /gems GET
[I] Added: /gems_yml GET
[I] Added: /gems_yml PUT
[I] Added: /pets GET
[I] Added: /pets POST
[I] Added: /pets/{petId} GET
[I] Added: /pets/{petId} PUT
[I] Added: /shards GET
[I] Removed: /v1/pets GET
[I] Removed: /v1/pets POST
[I] Removed: /v1/pets/{petId} GET
[I] Removed: /v1/pets/{petId} PUT

Sample - JSON/YAML

./bin/noir -b ./spec/functional_test/fixtures/oas3 --diff-path ./spec/functional_test/fixtures/oas2 -f json

{
  "added": [
    {
      "url": "/gems_json",
      "method": "GET",
      "params": [
        {
          "name": "query",
          "value": "",
          "param_type": "query",
          "tags": []
        },
        {
          "name": "sort",
          "value": "",
          "param_type": "query",
          "tags": []
        },
        {
          "name": "cookie",
          "value": "",
          "param_type": "cookie",
          "tags": []
        }
      ],
      "details": {
        "code_paths": [
          {
            "path": "./spec/functional_test/fixtures/oas3/param_in_path/doc_param_in_json.json"
          }
        ]
      },
      "protocol": "http",
      "tags": []
    },
    {
      "url": "/gems_json",
      "method": "POST",
      "params": [
        {
          "name": "query",
          "value": "",
          "param_type": "query",
          "tags": []
        },
        {
          "name": "sort",
          "value": "",
          "param_type": "query",
          "tags": []
        },
        {
          "name": "cookie",
          "value": "",
          "param_type": "cookie",
          "tags": []
        }
      ],
      "details": {
        "code_paths": [
          {
            "path": "./spec/functional_test/fixtures/oas3/param_in_path/doc_param_in_json.json"
          }
        ]
      },
      "protocol": "http",
      "tags": []
    },
    {
      "url": "/gems",
      "method": "GET",
      "params": [],
      "details": {
        "code_paths": [
          {
            "path": "./spec/functional_test/fixtures/oas3/no_servers/doc_no_servers.yml"
          }
        ]
      },
      "protocol": "http",
      "tags": []
    },
    {
      "url": "/gems_yml",
      "method": "GET",
      "params": [
        {
          "name": "query",
          "value": "",
          "param_type": "query",
          "tags": []
        },
        {
          "name": "sort",
          "value": "",
          "param_type": "query",
          "tags": []
        },
        {
          "name": "cookie",
          "value": "",
          "param_type": "cookie",
          "tags": []
        }
      ],
      "details": {
        "code_paths": [
          {
            "path": "./spec/functional_test/fixtures/oas3/param_in_path/doc_param_in_path.yml"
          }
        ]
      },
      "protocol": "http",
      "tags": []
    },
    {
      "url": "/gems_yml",
      "method": "PUT",
      "params": [
        {
          "name": "query",
          "value": "",
          "param_type": "query",
          "tags": []
        },
        {
          "name": "sort",
          "value": "",
          "param_type": "query",
          "tags": []
        },
        {
          "name": "cookie",
          "value": "",
          "param_type": "cookie",
          "tags": []
        }
      ],
      "details": {
        "code_paths": [
          {
            "path": "./spec/functional_test/fixtures/oas3/param_in_path/doc_param_in_path.yml"
          }
        ]
      },
      "protocol": "http",
      "tags": []
    },
    {
      "url": "/pets",
      "method": "GET",
      "params": [
        {
          "name": "query",
          "value": "",
          "param_type": "query",
          "tags": []
        },
        {
          "name": "sort",
          "value": "",
          "param_type": "query",
          "tags": []
        },
        {
          "name": "cookie",
          "value": "",
          "param_type": "cookie",
          "tags": []
        }
      ],
      "details": {
        "code_paths": [
          {
            "path": "./spec/functional_test/fixtures/oas3/common/doc.yml"
          }
        ]
      },
      "protocol": "http",
      "tags": []
    },
    {
      "url": "/pets",
      "method": "POST",
      "params": [
        {
          "name": "name",
          "value": "",
          "param_type": "json",
          "tags": []
        }
      ],
      "details": {
        "code_paths": [
          {
            "path": "./spec/functional_test/fixtures/oas3/common/doc.yml"
          }
        ]
      },
      "protocol": "http",
      "tags": []
    },
    {
      "url": "/pets/{petId}",
      "method": "GET",
      "params": [],
      "details": {
        "code_paths": [
          {
            "path": "./spec/functional_test/fixtures/oas3/common/doc.yml"
          }
        ]
      },
      "protocol": "http",
      "tags": []
    },
    {
      "url": "/pets/{petId}",
      "method": "PUT",
      "params": [
        {
          "name": "name",
          "value": "",
          "param_type": "json",
          "tags": []
        },
        {
          "name": "breed",
          "value": "",
          "param_type": "json",
          "tags": []
        }
      ],
      "details": {
        "code_paths": [
          {
            "path": "./spec/functional_test/fixtures/oas3/common/doc.yml"
          }
        ]
      },
      "protocol": "http",
      "tags": []
    },
    {
      "url": "/shards",
      "method": "GET",
      "params": [],
      "details": {
        "code_paths": [
          {
            "path": "./spec/functional_test/fixtures/oas3/multiple_docs/second.yml"
          }
        ]
      },
      "protocol": "http",
      "tags": []
    }
  ],
  "removed": [
    {
      "url": "/v1/pets",
      "method": "GET",
      "params": [],
      "details": {
        "code_paths": [
          {
            "path": "./spec/functional_test/fixtures/oas2/doc.yml"
          }
        ]
      },
      "protocol": "http",
      "tags": []
    },
    {
      "url": "/v1/pets",
      "method": "POST",
      "params": [],
      "details": {
        "code_paths": [
          {
            "path": "./spec/functional_test/fixtures/oas2/doc.yml"
          }
        ]
      },
      "protocol": "http",
      "tags": []
    },
    {
      "url": "/v1/pets/{petId}",
      "method": "GET",
      "params": [],
      "details": {
        "code_paths": [
          {
            "path": "./spec/functional_test/fixtures/oas2/doc.yml"
          }
        ]
      },
      "protocol": "http",
      "tags": []
    },
    {
      "url": "/v1/pets/{petId}",
      "method": "PUT",
      "params": [],
      "details": {
        "code_paths": [
          {
            "path": "./spec/functional_test/fixtures/oas2/doc.yml"
          }
        ]
      },
      "protocol": "http",
      "tags": []
    }
  ],
  "changed": []
}

./bin/noir -b ./spec/functional_test/fixtures/oas3 --diff-path ./spec/functional_test/fixtures/oas2 -f yaml

added:
- url: /gems_json
  method: GET
  params:
  - name: query
    value: ""
    param_type: query
    tags: &1 []
  - name: sort
    value: ""
    param_type: query
    tags: &2 []
  - name: cookie
    value: ""
    param_type: cookie
    tags: &3 []
  details:
    code_paths: &4
    - path: ./spec/functional_test/fixtures/oas3/param_in_path/doc_param_in_json.json
  protocol: http
  tags: []
- url: /gems_json
  method: POST
  params:
  - name: query
    value: ""
    param_type: query
    tags: *1
  - name: sort
    value: ""
    param_type: query
    tags: *2
  - name: cookie
    value: ""
    param_type: cookie
    tags: *3
  details:
    code_paths: *4
  protocol: http
  tags: []
- url: /gems
  method: GET
  params: []
  details:
    code_paths:
    - path: ./spec/functional_test/fixtures/oas3/no_servers/doc_no_servers.yml
  protocol: http
  tags: []
- url: /gems_yml
  method: GET
  params:
  - name: query
    value: ""
    param_type: query
    tags: &5 []
  - name: sort
    value: ""
    param_type: query
    tags: &6 []
  - name: cookie
    value: ""
    param_type: cookie
    tags: &7 []
  details:
    code_paths: &8
    - path: ./spec/functional_test/fixtures/oas3/param_in_path/doc_param_in_path.yml
  protocol: http
  tags: []
- url: /gems_yml
  method: PUT
  params:
  - name: query
    value: ""
    param_type: query
    tags: *5
  - name: sort
    value: ""
    param_type: query
    tags: *6
  - name: cookie
    value: ""
    param_type: cookie
    tags: *7
  details:
    code_paths: *8
  protocol: http
  tags: []
- url: /pets
  method: GET
  params:
  - name: query
    value: ""
    param_type: query
    tags: []
  - name: sort
    value: ""
    param_type: query
    tags: []
  - name: cookie
    value: ""
    param_type: cookie
    tags: []
  details:
    code_paths: &9
    - path: ./spec/functional_test/fixtures/oas3/common/doc.yml
  protocol: http
  tags: []
- url: /pets
  method: POST
  params:
  - name: name
    value: ""
    param_type: json
    tags: []
  details:
    code_paths: *9
  protocol: http
  tags: []
- url: /pets/{petId}
  method: GET
  params: []
  details:
    code_paths: *9
  protocol: http
  tags: []
- url: /pets/{petId}
  method: PUT
  params:
  - name: name
    value: ""
    param_type: json
    tags: []
  - name: breed
    value: ""
    param_type: json
    tags: []
  details:
    code_paths: *9
  protocol: http
  tags: []
- url: /shards
  method: GET
  params: []
  details:
    code_paths:
    - path: ./spec/functional_test/fixtures/oas3/multiple_docs/second.yml
  protocol: http
  tags: []
removed:
- url: /v1/pets
  method: GET
  params: []
  details:
    code_paths: &10
    - path: ./spec/functional_test/fixtures/oas2/doc.yml
  protocol: http
  tags: []
- url: /v1/pets
  method: POST
  params: []
  details:
    code_paths: *10
  protocol: http
  tags: []
- url: /v1/pets/{petId}
  method: GET
  params: []
  details:
    code_paths: *10
  protocol: http
  tags: []
- url: /v1/pets/{petId}
  method: PUT
  params: []
  details:
    code_paths: *10
  protocol: http
  tags: []
changed: []

@hahwul hahwul marked this pull request as ready for review May 20, 2024 14:34
@hahwul hahwul linked an issue May 20, 2024 that may be closed by this pull request
@hahwul hahwul added this to the NextVersion milestone May 20, 2024
@github-actions github-actions bot added the 💊 spec Issue for test codes label May 20, 2024
@github-actions github-actions bot added the 📑 documentation Improvements or additions to documentation label May 20, 2024
@hahwul hahwul merged commit 905f03a into dev May 21, 2024
8 checks passed
@hahwul hahwul deleted the add-diff-path-flag branch May 21, 2024 15:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
📑 documentation Improvements or additions to documentation ⚙️ options Issue for options (flag) 📦 output-builder Issue for output builder (format) 💊 spec Issue for test codes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Diff Mode
1 participant