-
-
Notifications
You must be signed in to change notification settings - Fork 895
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
Add swagger_ui_extra_configuration
to Swagger configuration
#3731
Conversation
dvc
commented
Sep 21, 2020
•
edited
Loading
edited
Q | A |
---|---|
Bug fix? | no |
New feature? | yes |
BC breaks? | no |
Deprecations? | no |
Tickets | fixes #3730 |
License | MIT |
Doc PR | api-platform/docs/pull/1168 |
Code quality breaks in other files: https://insight.symfony.com/projects/92d78899-946c-4282-89a3-ac92344f9a93/analyses/6895 Do i need to fix it? And how? :) |
Nice work, as it's a new feature could you target the I'll add some comments. Don't worry about the symfony insight. |
@@ -300,6 +300,20 @@ private function addSwaggerSection(ArrayNodeDefinition $rootNode): void | |||
->end() | |||
->end() | |||
->end() | |||
->arrayNode('display') |
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.
What do you think about using ui
instead of display
?
swagger:
ui:
doc_expansion: 'full'
@@ -344,6 +344,8 @@ private function registerSwaggerConfiguration(ContainerBuilder $container, array | |||
$container->setParameter('api_platform.enable_swagger_ui', $config['enable_swagger_ui']); | |||
$container->setParameter('api_platform.enable_re_doc', $config['enable_re_doc']); | |||
$container->setParameter('api_platform.swagger.api_keys', $config['swagger']['api_keys']); | |||
$container->setParameter('api_platform.swagger.doc_expansion', $config['swagger']['display']['doc_expansion']); |
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.
$container->setParameter('api_platform.swagger.doc_expansion', $config['swagger']['display']['doc_expansion']); | |
$container->setParameter('api_platform.swagger_ui.doc_expansion', $config['swagger']['display']['doc_expansion']); |
@@ -344,6 +344,8 @@ private function registerSwaggerConfiguration(ContainerBuilder $container, array | |||
$container->setParameter('api_platform.enable_swagger_ui', $config['enable_swagger_ui']); | |||
$container->setParameter('api_platform.enable_re_doc', $config['enable_re_doc']); | |||
$container->setParameter('api_platform.swagger.api_keys', $config['swagger']['api_keys']); | |||
$container->setParameter('api_platform.swagger.doc_expansion', $config['swagger']['display']['doc_expansion']); | |||
$container->setParameter('api_platform.swagger.filter', $config['swagger']['display']['filter']); |
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.
$container->setParameter('api_platform.swagger.filter', $config['swagger']['display']['filter']); | |
$container->setParameter('api_platform.swagger_ui.filter', $config['swagger']['display']['filter']); |
@soyuka , thank you for review. I've fix it.
|
@soyuka , hello! I've update this PR. Can you review it? |
@@ -139,6 +151,8 @@ private function getContext(Request $request, Documentation $documentation): arr | |||
|
|||
$swaggerData = [ | |||
'url' => $this->urlGenerator->generate('api_doc', ['format' => 'json']), | |||
'docExpansion' => $this->swaggerDocExpansion, |
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.
Shouldn't we just add an extra_config
key or something like this allowing to pass a variable map to Swagger UI. So we'll support all possible options and we will be future-proof.
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'm not shure.
There are some already used config values. Merging testing required.
What about config validation? Is it user's responsibility? Should any options to be blacklisted for any reason?
8147cfb
to
a0b9149
Compare
ui_extra_configuration
to Swagger configuration
Now uses a api_platform:
swagger:
versions: [3, 2]
api_keys:
apiKey:
name: Authorization
type: header
swagger_ui_extra_configuration:
filter: true
docExpansion: none |
ui_extra_configuration
to Swagger configurationswagger_ui_extra_configuration
to Swagger configuration
Thank you @dvc! |
…atform#3731) (cherry picked from commit 930c930)
…atform#3731) (cherry picked from commit 930c930)
…atform#3731) (cherry picked from commit 930c930)
…atform#3731) (cherry picked from commit 930c930)
…atform#3731) (cherry picked from commit 930c930)
…atform#3731) (cherry picked from commit 930c930)