Trying to use the oauth2 annotations... getting this.. is there a better place to ask questions other than in github issues?
[WARN] [Semantical Error] The annotation "@SwaggerAnnotationsAuthorization" in application/controllers/api/api.php on line 3 does not exist, or could not be auto-loaded.
What are you trying to output?
You might find the security.php petstore.swagger.io example useful. As it contains an oauth2 example.
Trying to output a swagger.json.. (?) Maybe I misunderstand the question.
I used the petstore oauth2 example verbatim and replaced with my values.. am I using the wrong branch?
any update?
@peteclark3 I was able to do OAuth pretty easy with the new 2.0 release.
Here's how you do it for the swagger root definition:
/*
* @SWG\Swagger(
* @SWG\SecurityScheme(
* securityDefinition="oauth2", type="oauth2", description="OAuth2 Implicit Grant", flow="implicit",
* authorizationUrl="https://example.org/oauth/authorize",
* tokenUrl="https://example.org/oauth/token",
* scopes={"scope": "Description of scope."}
* )
* )
*/
Then for each of your routes/controller actions you do:
/*
* @SWG\Get(
* path="/resource", summary="List resource",
* @SWG\Response(response="200", description="List of resources"),
* security={{"oauth2": {"scope"}}}
* )
*/
Ok, so I shouldn't use the "Authorization" annotation?
Yeah you won't need to use that with the changes to the Swagger 2.0 specification it has been changed.
You can see a full list of the possible annotations you can use at:
https://github.com/zircote/swagger-php/tree/master/src/Annotations
It also might be helpful to reference the Swagger 2.0 specs when coding (it has been for me at least):
https://github.com/swagger-api/swagger-spec/blob/master/versions/2.0.md
Ok. I thought the example I was using was 2.0 pet store but I guess not. Thanks..
Most helpful comment
@peteclark3 I was able to do OAuth pretty easy with the new 2.0 release.
Here's how you do it for the swagger root definition:
Then for each of your routes/controller actions you do: