cebe / cebe/php-openapi

CLI call to openapi-spec with security in path fails

オープン
#242 コメント 6 件 リアクション 1 件 担当者 0 名 GitHub で見る
主要言語
PHP
スター
500
フォーク
99
PR マージ指標
30日以内にマージされた PR はありません

説明

Type: Bug
Since: 1.8.0

Description:
The CLI call `php-openapi validate example.spec.json` fails due to the fact that the security in path is transformed to a list of arrays and not a list of objects in https://github.com/cebe/php-openapi/blob/893ab104be1f5dfe5a39766703f583584e43c6e1/src/spec/SecurityRequirements.php#L64

Minimal example.spec.json to reproduce:
```json
{
"openapi": "3.0.0",
"info": {
"title": "My API",
"version": "1, 2"
},
"paths": {
"/v1/users/profile": {
"get": {
"operationId": "V1GetUserProfile",
"summary": "Returns the user profile",
"responses": {
"200": {
"description": "dummy"
}
},
"security": [
{
"test_test": ["test:scope:foo"]
}
]
}
}
},
"components": {
"securitySchemes": {
"test_test": {
"type": "oauth2",
"flows": {
"authorizationCode": {
"authorizationUrl": "https://example.com/openid-connect/auth",
"tokenUrl": "https://example.com/openid-connect/token",
"scopes": {
"test:scope:foo": "test_scope"
}
}
}
}
}
}
}
```

I'll provide a MR with test case and a fix if you like.

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

調査の方向性

src/spec/SecurityRequirements.php の64行目付近から始め、issue にある最小の example.spec.json を php-openapi の validate CLI コマンドで使用して失敗を再現します。セキュリティ要件がどのように変換されるかを追跡し、次に言及されているテストケースを追加して、セキュリティエントリが正しく表現された状態でバリデーションが成功することを確認します。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
openapi, php
領域
api
issue の種類
バグ
難易度
3/5
見積もり時間
1〜2日
活発さ
停滞
明瞭さ
明確に書かれている
初心者へのやさしさ
52/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。