Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] open api 3 spec dynamic generation #1

Open
wants to merge 22 commits into
base: master
Choose a base branch
from

Conversation

stefanorosanelli
Copy link
Member

@stefanorosanelli stefanorosanelli commented Sep 22, 2017

URL to create dynamic spec is: /tools/open-api

Output format:

  • json on accept application.json in request
  • yaml otherwise with application/x-yaml as content type

Problems: to get an in browser response and avoid errors a brutal check in HtmlMiddleware has been done - to be improved.

Some endpoints like admin/ or model/ will be implemented later.

@codecov-io
Copy link

codecov-io commented Sep 22, 2017

Codecov Report

Merging #1 into master will not change coverage.
The diff coverage is 100%.

Impacted file tree graph

@@           Coverage Diff           @@
##             master     #1   +/-   ##
=======================================
  Coverage       100%   100%           
- Complexity        5     27   +22     
=======================================
  Files             2      3    +1     
  Lines            19     96   +77     
=======================================
+ Hits             19     96   +77
Impacted Files Coverage Δ Complexity Δ
src/Spec/OpenAPI.php 100% <100%> (ø) 19 <19> (?)
src/Controller/ToolsController.php 100% <100%> (ø) 3 <3> (?)
src/Middleware/HtmlMiddleware.php 100% <100%> (ø) 5 <0> (+1) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c2ab8b1...77c8eb9. Read the comment docs.

config/OpenAPI/_open_api.php Outdated Show resolved Hide resolved
*/
'OATemplates' => [
'paths' => [
'/{$resource}/{id}' => [
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how can we deal with special endpoints like admin and model, where $resource does not match exactly endpoint path? for instance: /admin/:op/:id. Would we accept $resource = 'admin/:op', or should we use some other pattern to handle these special endpoints?
however, it's fine for now, as long as we are dealing with roles and streams

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right, we could introduce a {$prefix} and have something like /{$prefix}{$resource}/{id} or use separate files like admin_endpoint.php without templates.

It depends on how consistent the API structure will be, hopefully a lot 😉

@codecov-commenter
Copy link

codecov-commenter commented Jun 26, 2020

Codecov Report

Merging #1 into master will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@             Coverage Diff             @@
##              master        #1   +/-   ##
===========================================
  Coverage     100.00%   100.00%           
- Complexity         5        27   +22     
===========================================
  Files              2         3    +1     
  Lines             19        96   +77     
===========================================
+ Hits              19        96   +77     
Impacted Files Coverage Δ Complexity Δ
src/Controller/ToolsController.php 100.00% <100.00%> (ø) 3.00 <3.00> (?)
src/Middleware/HtmlMiddleware.php 100.00% <100.00%> (ø) 5.00 <0.00> (+1.00)
src/Spec/OpenAPI.php 100.00% <100.00%> (ø) 19.00 <19.00> (?)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d9b58b7...864161e. Read the comment docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants