zircote / swagger-php

A php swagger annotation and parsing library
http://zircote.github.io/swagger-php/
Apache License 2.0
5.08k stars 934 forks source link

Swagger generator stopped working once upgraded to Laminas from ZendFramework #868

Closed gurpreetbhatoa closed 4 years ago

gurpreetbhatoa commented 4 years ago

We updated our application to use Laminas instead of Zend Expressive and we started getting following error: Unexpected @OA\Schema(), expected to be inside @OA\Components, @OA\Parameter, @OA\MediaType, @OA\Header

Any help regarding this will really be appreciated. PHP 7.2.8 . Composer 1.10 swagger-github

Doqnach commented 4 years ago

Can you maybe provide a minimal reproduction case? Some minimal Laminas install in a repo that shows this problem?

The screenshot does not really provide enough context to really say anything about it.

DerManoMann commented 4 years ago

If your swagger-php dep in composer is ^3.0 then you are most likely using 3.0.5. You could try using 3.1.0 or dev-master. Or if that feels too risky fix the version at 3.0.4 which should not have this bug.

gurpreetbhatoa commented 4 years ago

Can you maybe provide a minimal reproduction case? Some minimal Laminas install in a repo that shows this problem?

The screenshot does not really provide enough context to really say anything about it.

@Doqnach Thanks a lot for getting back. This is part of a big project and was hard to get it out in a separate repo. Composer packages in the project looks like below if that helps:

"require": { "php": "^7.2", "ext-json": "*", "fig/http-message-util": "^1.1", "psr/http-server-handler": "^1.0", "laminas/laminas-config": "^3.2", "laminas/laminas-config-aggregator": "^1.0", "laminas/laminas-diactoros": "^2.2", "mezzio/mezzio": "^3.2", "laminas/laminas-servicemanager": "^3.3", "zircote/swagger-php": "3.0.4", "laminas/laminas-dependency-plugin": "^1.0" }, "require-dev": { "phpunit/phpunit": "^7", "roave/security-advisories": "dev-master", "symfony/yaml": "^4.0" },

gurpreetbhatoa commented 4 years ago

If your swagger-php dep in composer is ^3.0 then you are most likely using 3.0.5. You could try using 3.1.0 or dev-master. Or if that feels too risky fix the version at 3.0.4 which should not have this bug.

@DerManoMann Composer has ^3.0 so the version that was installed was 3.1.0. I downgraded it to 3.0.4 and everything seems to work again. Will this issue be fixed again in newer version as latest stable version 3.1.0 doesn't seems to have this fix? Thanks a ton for your help here. Much appreciated.

DerManoMann commented 4 years ago

@gurpreetbhatoa I should hope that we'll fix that. Could I ask you to try master and see if that helps? I know a similar regression has been fixed recently but I am not sure where. master is 20 commits ahead of 3.1.0...

gurpreetbhatoa commented 4 years ago

@gurpreetbhatoa I should hope that we'll fix that. Could I ask you to try master and see if that helps? I know a similar regression has been fixed recently but I am not sure where. master is 20 commits ahead of 3.1.0...

@DerManoMann Tried on latest master (160bdab) and it works. Thanks again.