CLI call to openapi-spec with security in path fails
- Vorherrschende Sprache
- PHP
- Sterne
- 500
- Forks
- 99
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Beschreibung
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.
Beitragsleitfaden
Für dieses Repository ist kein Beitragsleitfaden indexiert
Rechercherichtung
Beginne bei src/spec/SecurityRequirements.php ungefähr in Zeile 64 und reproduziere den Fehler mit der minimalen example.spec.json aus dem Issue mithilfe des php-openapi-validate-CLI-Befehls. Verfolge, wie die Sicherheitsanforderung transformiert wird, füge anschließend den erwähnten Testfall hinzu und überprüfe, dass die Validierung mit dem korrekt dargestellten Sicherheitseintrag erfolgreich ist.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- openapi, php
- Bereich
- api
- Issue-Typ
- Bug
- Schwierigkeit
- 3/5
- Geschätzter Aufwand
- 1-2 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Klar beschrieben
- Anfängerfreundlichkeit
- 52/100