{"id":25857754,"url":"https://github.com/calloc134/openapi2runn","last_synced_at":"2025-03-01T19:17:49.255Z","repository":{"id":151693793,"uuid":"620240156","full_name":"calloc134/openapi2runn","owner":"calloc134","description":"openapiスキーマからrunnのテストを生成するoss","archived":false,"fork":false,"pushed_at":"2024-04-16T05:02:17.000Z","size":55,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-28T02:48:47.061Z","etag":null,"topics":["api","api-rest","kin-openapi","runn"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/calloc134.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2023-03-28T09:50:29.000Z","updated_at":"2024-12-04T04:56:57.000Z","dependencies_parsed_at":"2023-06-04T04:45:38.819Z","dependency_job_id":null,"html_url":"https://github.com/calloc134/openapi2runn","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/calloc134%2Fopenapi2runn","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/calloc134%2Fopenapi2runn/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/calloc134%2Fopenapi2runn/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/calloc134%2Fopenapi2runn/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/calloc134","download_url":"https://codeload.github.com/calloc134/openapi2runn/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241411476,"owners_count":19958754,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api","api-rest","kin-openapi","runn"],"created_at":"2025-03-01T19:17:48.338Z","updated_at":"2025-03-01T19:17:49.224Z","avatar_url":"https://github.com/calloc134.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"```\n_____  _____  _____  _____  _____  _____  ___  _____  _____  __ __  _____  _____ \n/  _  \\/  _  \\/   __\\/  _  \\/  _  \\/  _  \\/___\\\u003c___  \\/  _  \\/  |  \\/  _  \\/  _  \\\n|  |  ||   __/|   __||  |  ||  _  ||   __/|   | /  __/|  _  \u003c|  |  ||  |  ||  |  |\n\\_____/\\__/   \\_____/\\__|__/\\__|__/\\__/   \\___/\u003c_____|\\__|\\_/\\_____/\\__|__/\\__|__/\n```\n\n## 概要 / General\n\nこのユーティリティは、openapiの定義からAPIテストツールである[runn](https://github.com/k1LoW/runn)のテストシナリオを生成するものです。\n\n## インストール / Install\n\nシングルバイナリで稼働するため、インストールは不要です。  \n[Releases](https://github.com/calloc134/openapi2runn)からダウンロードしてください。\n\n## 使い方 / Usage\n\n```bash\n$ openapi2runn gen -i (OpenAPI定義) -o (シナリオ保存ディレクトリ) -s (サーバのホスト)\n```\n\nこのコマンドを実行すると、`-o`で指定したディレクトリにシナリオが生成されます。\nなお、OpenAPI定義はjsonとyamlの両方が指定可能です。\n\nrunnの実行は以下のように行います。なお、カレントディレクトリは`-o`で指定したディレクトリにしてください。\n\n```bash\n$ runn run **/**/*.yml (対象サーバのホスト)\n```\n\n## 特徴 / Features\n\n### パスとメソッド毎に分けられたディレクトリ配置\n\n生成されるディレクトリ配置は以下のようになります。  \nなお、以下は一例です。\n\n```\n.\n├── /0_base/\n│   ├── /ApiProfileMe/\n|   |   ├── /GET/\n│   │   │   └── base.yml\n│   │   ├── /PUT/\n│   │   │   └── base.yml\n│   │   └── /DELETE/\n│   │       └── base.yml\n│   └── /ApiPostId/\n|       ├── /GET/\n│       │   └── base.yml\n│       ├── /PUT/\n│       │   └── base.yml\n│       └── /DELETE/\n│           └── base.yml\n└── /1_noAuth/\n    ├── /ApiProfileMe/\n    |   ├── /GET/\n    │   │   ├── base.yml\n    |   |   └── data.json\n    │   ├── /PUT/\n    │   │   ├── base.yml\n    |   |   └── data.json\n    │   └── /DELETE/\n    │       ├── base.yml\n    |       └── data.json\n    └── /ApiPostId/\n        ├── /GET/\n        │   ├── base.yml\n        |   └── data.json\n        ├── /PUT/\n        │   ├── base.yml\n        |   └── data.json\n        └── /DELETE/\n            ├── base.yml\n            ├── data.json\n            └── config.toml\n``` \nURL内のパラメータも、ディレクトリ名として扱われます。\n\n0_baseディレクトリには、APIのベースとなるテストシナリオが格納されます。\n\n以下に実例を示します。\n    \n```yaml\nif: included\nrunners:\n  req: http://localhost\nsteps:\n  first:\n    req:\n      /api/auth/login:\n        POST:\n          body: \n            application/json: \"{{ vars.req.body }}\"\n    test:\n      compare(steps.first.res.status, vars.res.status)\n```\n\n1_noAuthディレクトリには、認証が不要なAPIのテストシナリオが格納されます。\n\n以下に実例を示します。\n    \n```yaml\ndesc:\n  (POST) /api/auth/loginのテスト\nvars:\n  data: \"json://data.json\"\n\nsteps:\n  first:\n    loop: \n      count: len(vars.data)\n    include:\n      path:\n        ../../../0_base/ApiAuthLogin/POST/base.yml\n      vars:\n        req: '{{ vars.data[i].req }}'\n        res: '{{ vars.data[i].res }}'\n```\nまた、このディレクトリには、テストデータを格納するdata.jsonというファイルがあります。\n\n```json\n[\n    {\n        \"req\": {\n            \"body\": {\"password\":\"dummy\",\"screenName\":\"dummy\"},\n            \"query\": {}\n        },\n        \"res\": {\n            \"status\": 200\n        }\n    }\n]\n```\nこのjsonの配列にデータを追加することで、複数のデータをループしてテストすることが可能です。\n\n## 構成ファイル / Configuration\n\n1_noAuthディレクトリには、構成ファイルとしてconfig.tomlを配置することができます。\nこの構成ファイルは、既に1_noAuth以下にファイル群が存在する場合に有効です。\nこのtomlの書き方は以下の通りです。\n  \n```toml\nallowOverride = true\n```\n\nこの構成ファイルには、以下の項目を設定することができます。\n| 項目名 | 説明 | \n----|----\n| allowOverride | この項目がtrueの場合、当ディレクトリのdata.jsonを上書きすることができます。 |\n\n\n## 注意事項 / Caution\n- このツールは、現在開発中のため、バグが含まれている可能性があります。\n\n## 今後の予定 / Future Plans\n\n - [ ] Github Actionsでの自動ビルドとデプロイ\n - [ ] ログイン認証に対応したテストシナリオの生成\n - [ ] テストデータの自動生成(?)\n\n\n\n\n\n\n\n\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcalloc134%2Fopenapi2runn","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcalloc134%2Fopenapi2runn","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcalloc134%2Fopenapi2runn/lists"}