pedroassumpcao

pedroassumpcao

Is there an example for setting up authentication in the operations? I didn’t find in the example app. Thanks.

1
Post #11
mbuhot

mbuhot OP

Sorry no sample code for security yet, a PR to the example app would be most welcome!

It should be a matter of declaring the securitySchemes within the components section of your API spec, then referencing the schemes by name within each Operation.

Are you using something simple like API keys or more complex like OpenIdConnect?

1
Post #12
pedroassumpcao

pedroassumpcao

Thanks for getting back. to me, I am using simple authorization with a bearer token, the same level of simplicity of API key. I got that working and I can open a PR with some documentation updates to guide other users as the example app does not require authorization.

0
Post #13
moxley

moxley

Version 3.7.0 is released!

This release include some enhancements and important bug fixes:

  • Enhancement: Multiple bug fixes and edge case handling of ExDoc based operation specs
  • Enhancement: Upgrade Swagger UI to 3.24.2 (#210)
  • Enhancement: Improve oneOf casting (#227)
  • Docs: Add SecurityScheme usage and examples in the readme (#215)
  • Fix: References for query params and discriminators with mappings not working (#200)
  • Fix: Errors in parameter pattern validation (#206)
  • Fix example (#212)
  • Fix: CastAndValidate: incorrect content-type handling (#218)
  • Fix: Can’t cast and validate a JSON array as request body (#229)
4
Post #15
jennyjean8675309

jennyjean8675309

Hello,

I am wondering if it is possible to create a flag that uses the supportedSubmitMethods on the network configuration of SwaggerUI (https://github.com/swagger-api/swagger-ui/blob/master/docs/usage/configuration.md#user-content-supportedsubmitmethods) to disable the Try it Out feature for certain methods?

Great product btw!

0
Post #16
mbuhot

mbuhot OP

I think we can add support for the configUrl option, allowing users to have a JSON file in priv/static that can be used to configure most of the swaggerUI options with needing to add flags in OpenApiSpex.

Interested in sending a PR? There’s a similar feature in the PhoenixSwagger SwaggerUI Plug that can be used for reference :slightly_smiling_face:

0
Post #17
jennyjean8675309

jennyjean8675309

Thank you!

0
Post #18
mbuhot

mbuhot OP

Version 3.8.0 is released!

This release comes with a couple of new features alongs with lots of enhancements and fixes:

  • Feature: Custom validators (#243)
  • Feature: Swagger json generation Mix Task (#249)
  • Feature: Customizable cache adapter (#262)
  • Enhancement: Allow passsing false to @doc annotation to skip the warning. (#236)
  • Enhancement: Make @doc parameters declaration consistent with open api (#237)
  • Enhancement: Support security @doc string attribute on operations (#251)
  • Enhancement: Allow a Reference to be used for directly in the parameters definition (#258)
  • Enhancement: Allow a Reference to be used for an Operation’s request body (#260)
  • Docs: Fixes README.md responses example typo “unprocessible” (#248)
  • Docs: Fix security example to use correct types for the keys (#239)
  • Fix: Remove default pop value for :type shortcut in @doc specs (#238)
  • Fix: Nested parameters when served from file based schema (#241)
  • Fix: Error handling for oneOf (#246)
  • Fix: json:api compatible data shape option for JsonRenderError (#245)
  • Fix: ReferenceError: components.parameter missing s in CastParamters (#257)
  • Fix: struct def for custom validators (#263)

As always, a huge thank you to all the contributors and maintainers for keeping the project going :heart:

4
Post #19
mbuhot

mbuhot OP

Feel free to try out the swaggerui-config branch: Allow SwaggerUI to be configured via Plug opts by mbuhot · Pull Request #271 · open-api-spex/open_api_spex · GitHub

You can configure the supportedSubmitMethods (any many other options) like:

get "/swaggerui", OpenApiSpex.Plug.SwaggerUI,
      path: "/api/openapi",
      supported_submit_methods: [:get, :post],
      default_model_expand_depth: 3,
      display_operation_id: true
0
Post #20