-
-
Notifications
You must be signed in to change notification settings - Fork 901
Ability to disable entrypoint and /api/docs #1580
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
Ability to disable entrypoint and /api/docs #1580
Conversation
athos7933
commented
Dec 20, 2017
Q | A |
---|---|
Bug fix? | no |
New feature? | yes |
BC breaks? | no |
Deprecations? | no |
Tests pass? | yes |
Fixed tickets | #1568 |
License | MIT |
Doc PR | api-platform/docs#365 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It currently doesn't disable the entrypoint. The route for the entrypoint is defined here:
<route id="api_entrypoint" path="/{index}.{_format}"> |
@@ -87,6 +87,7 @@ public function getConfigTreeBuilder() | |||
->end() | |||
->booleanNode('enable_swagger')->defaultValue(true)->info('Enable the Swagger documentation and export.')->end() | |||
->booleanNode('enable_swagger_ui')->defaultValue(class_exists(TwigBundle::class))->info('Enable Swagger ui.')->end() | |||
->booleanNode('enable_entrypoint')->defaultTrue()->info('Enable/disable the entry-point')->end() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Enable the entrypoint
for the shake of consistency
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would also create a separate flag for entrypoint and docs, (you may want the docs, but not the entrypoint for instance).
@@ -0,0 +1,14 @@ | |||
<?xml version="1.0" encoding="UTF-8" ?> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be docs.xml
.
7583dfc
to
2e30b6f
Compare
I dont't know why some behat failed ! My changes do not impact the tests. |
We need to merge 2.1, it's because of #1578 |
@athos7933 you need to rebase your work on master :) |
2e30b6f
to
25b27f1
Compare
Just merged 2.1, please rebase onn master :) |
@soyuka Yes, i'ts already done |
@athos7933 I don't know what you did wrong but what you did is not a rebase but a merge. |
@@ -146,6 +146,14 @@ private function loadExternalFiles(RouteCollection $routeCollection) | |||
{ | |||
$routeCollection->addCollection($this->fileLoader->load('api.xml')); | |||
|
|||
if ($this->container->getParameter('api_platform.enable_entrypoint')) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should not we inject these parameters in the constructor instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The constructor is already really huge. Also the container is already use at many places. This seems ok.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another option is to use… options, along with the option resolver. $graphqlEnabled
should go in there.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@greg0ire it's adding a dependency. Which is not awesome.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can use a simple array, that's possible too
80959ad
to
2b059e8
Compare
@dunglas I did the change you want. |
db1504a
to
6fb92ca
Compare
8171c0c
to
75ec721
Compare
Failure is not related to this patch, it's about Symfony4 and this new line of code: https://github.com/symfony/symfony/blame/master/src/Symfony/Component/HttpFoundation/Request.php#L1855 |
Hello @Nek- @athos7933, unit tests will be fixed in this PR: #1631 |
e824a56
to
f77ae7c
Compare
f77ae7c
to
7181269
Compare
@dunglas Hi ! Waiting for review. |
Thanks you very much @athos7933! Don't forget to open a docs PR against the master branch please :) |
@@ -146,6 +150,14 @@ private function loadExternalFiles(RouteCollection $routeCollection) | |||
{ | |||
$routeCollection->addCollection($this->fileLoader->load('api.xml')); | |||
|
|||
if ($this->entrypointEnabled) { | |||
$routeCollection->addCollection($this->fileLoader->load('api.xml')); | |||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
doesn't this add 2 times the api.xml
file ? :o
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(looking at the line above)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks
…o-disable-entrypoint Ability to disable entrypoint and /api/docs