Skip to content

CLI call to openapi-spec with security in path fails #242

Open
@dkreuer

Description

@dkreuer

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

$data[] = [$name => $securityRequirement->getSerializableData()];

Minimal example.spec.json to reproduce:

{
  "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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions