Support multiple apps in Plug.SwaggerUI#676
Merged
Merged
Conversation
luisgabrielroldan
added a commit
to activeprospect/open_api_spex
that referenced
this pull request
May 21, 2026
* Fix deprecation warning on Elixir 1.15, require Elixir 1.11, adapt CI (open-api-spex#550) * Fix deprecation warning on Elixir 1.15 * Stop testing against Elixir 1.10 * Require Elixir 1.11+ now * Update CHANGELOG.md * Add `--quiet` option for spec generation (open-api-spex#557) * Fix casting non-objects against discriminator open-api-spex#551 (open-api-spex#552) Co-authored-by: Gianluca Nitti <gianluca.nitti@voismart.it> * Bump credo version to 1.7.0 * Bump dialyxir to 1.3.0 * feat: add assert_operation_response, assert_raw_schema (open-api-spex#545) * feat: add assert_operation_response, assert_raw_schema * make assert_operation_response pipeable * fix return type * automagically infer operationId in assertion * don't need to resolve a %Schema{} * ignore 204s * use OpenApiSpex.OpenApi.json_encoder() * rename test to match fn * reorganize json_encoder check per feedback * update json_encoder message for :jason or :poison * use a regex to match json content types in validate_operation_response * 💅 feedback - types, error message, module attrib for regex * add doc for content_type_from_header * remove no_return from spec * Release version 3.18.0 * Document the spec export task `--filename` option * Docstest Operation.parameter/5 * Cast discriminator when no title present (open-api-spex#574) Co-authored-by: Alberto Sartori <alberto.sartori@hpe.com> * Exclude empty paths from spec (open-api-spex#583) * Exclude empty paths from spec * fix: assert_operation_response header lookup (open-api-spex#584) * fix: assert_operation_response header lookup * Release version 3.18.1 * Fix 'AllOf cast returns a map, but I expected a struct' (open-api-spex#592) * Add failing test * Cast result of AllOf cast into a struct * Shorter module name * Add missing NoneCache test * Release version 3.18.2 * Relax dependency constraint on ymlr to allow version ~> 5.0 (open-api-spex#586) * relax dependency on ymlr, and fix some tests * test with more elixir versions * Update Elixir version test matrix (open-api-spex#602) * Update Elixir version test matrix * Fix map key order dependent test * Release version 3.18.3 * Support response code ranges See: https://swagger.io/docs/specification/describing-responses/ * Release version 3.19.0 * Add notice that body params are not merged into Conn.params whne using cast and validate plug (open-api-spex#589) * Set nonces on <script> and <style> elements if configured (open-api-spex#593) * Allow script and style nonces * Allow nonces on the SwaggerUIOAuth2Redirect plug as well * fix: ensure operation_id is always set on conn.private (open-api-spex#606) * fix: ensure operation_id is always set on conn.private when an operation is known * Fix grammer (open-api-spex#607) * Release version 3.19.1 * Respect minLength when generating string examples (open-api-spex#608) * sets read_write_scope from opts, this will permit to comply to readOnly (open-api-spex#572) * Allow Poison v6 to be used (open-api-spex#616) * chore: Drop build matrix support for elixir 1.11, 1.12, 1.13 and OTP 22 (open-api-spex#619) * improvement: use struct spec to avoid double `%` in struct inspect (open-api-spex#613) * improvement: use struct spec to avoid double `%` in struct inspect currently, inspecting an `OpenApiSpex.Schema` looks like this: `%OpenApiSpex.Schema%{type: :object}` with the new change, it looks like this: `%OpenApiSpex.Schema{type: :object}` which allows copy/pasting the struct * Feat: add --check option in Mix tasks to compare generated spec w/ file (open-api-spex#618) Add a --check option to run Mix tasks and compare the generated spec with a previously generated file. This is useful for scenarios where a CI check is desirable to catch unwanted drifts from a validated OpenAPI spec: e.g. the OpenAPI spec is committed and reviewed, and should not change without additional review. Fixes open-api-spex#617 Signed-off-by: Davide Briani <davide@briani.dev> * fix: cast numbers as floats (open-api-spex#611) * Release version 3.20.0 * Update Elixir version in release action * Set otp-version to 25 in release.yml * Support custom error messages in custom validators (open-api-spex#621) * Add custom message for custom validators * Update Schema.example/2 typespec to allow references * Release version 3.20.1 * Update dev dependencies and example apps (open-api-spex#624) * Support casting decimals (open-api-spex#634) * Update decode.ex to support servers in operations (open-api-spex#635) Fix typo * Update spec fixture to test open-api-spex#635 * Release version 3.21.0 * Fix schema inspect argument error in IEx * Release version 3.21.1 * Upgrade SwaggerUI to version 5.17.14 and allow assets URLs to be configured via Plug options (open-api-spex#628) * fix: Exporting to YAML preserves nil values in examples * Release version 3.21.2 * Fix cast x-validate when decoded schema (open-api-spex#647) * Fix cast x-validate when decoded schema * fix credo complain when using apply/3 --------- Co-authored-by: Giorgio Torres <giorgio.torres@hpe.com> * Bump CI dependencies (open-api-spex#655) * Add examples property to Schema (open-api-spex#654) Fixes open-api-spex#653 * Document schema resolver duplicate titles behaviour (open-api-spex#656) * Add spec.yaml tasks to example applications (open-api-spex#657) * Add mix spec.yaml tasks in example applications * Update example application dependencies * Fix 1.18 compilation warnings (open-api-spex#665) * Fix Elixir 1.18 compilation warnings * Test against 1.18 * Check for ex_doc warnings in CI and bump devtest deps (open-api-spex#666) * Test array query params in example phoenix app (open-api-spex#667) * Release 3.21.3 * Fix OTP-28 support (open-api-spex#672) * Refactor: Update default parsers and schema pattern definitions This commit introduces changes to `OpenApiSpex.CastParameters` and `OpenApiSpexTest.Schemas`. - Moved `@default_parsers` to a private function `default_parsers/0` in `OpenApiSpex.CastParameters` to ensure it's evaluated at runtime, preventing potential compilation issues with `OpenApi.json_encoder()`. - Updated the `pattern` definition in `OpenApiSpexTest.Schemas` to use a string literal instead of a regex literal for consistency and to avoid potential issues with regex compilation. Fix: Adjust string pattern test assertion Following the refactoring, a test in `OpenApiSpex.CastStringTest` failed due to a change in how regex patterns were handled. This fix corrects the assertion for string pattern matching to compare the `source` of the regex instead of the regex struct directly, resolving the test failure. * Fix formatting --------- Co-authored-by: Dimitris Zorbas <dimitrisplusplus@gmail.com> * Release version 3.21.4 * Fix assert_operation_response/2 references (open-api-spex#673) * Support references in assert_operation_response/2 * fixup! Support references in assert_operation_response/2 * Release version 3.21.5 * Support multiple apps in Plug.SwaggerUI (open-api-spex#676) * Validate keys given to operation/2 macro (open-api-spex#675) * Release version 3.22.0 * Fix elixir 1.19 support (open-api-spex#685) * Release version 3.22.1 * fix: type warnings Elixir 1.19 (open-api-spex#693) Thanks @davydog187 ! * Release version 3.22.2 * chore: removed unused require(s) (open-api-spex#700) * Relax decimal requirement (open-api-spex#702) A new release will be out soon, this will allow users to migrate if desired. The new version is compatible with OpenAPISpex. * Release version 3.22.3 --------- Signed-off-by: Davide Briani <davide@briani.dev> Co-authored-by: Thibaut Barrère <thibaut.barrere@gmail.com> Co-authored-by: Brice Thomas <brice.p.thomas@gmail.com> Co-authored-by: Gianluca Nitti <gianluca.nitti96@gmail.com> Co-authored-by: Gianluca Nitti <gianluca.nitti@voismart.it> Co-authored-by: Dimitris Zorbas <dimitrisplusplus@gmail.com> Co-authored-by: Matt Sutkowski <msutkowski@gmail.com> Co-authored-by: Alberto Sartori <alberto.sartori@athonet.com> Co-authored-by: Alberto Sartori <alberto.sartori@hpe.com> Co-authored-by: Alisina Bahadori <alisina.bm@gmail.com> Co-authored-by: Angelika Tyborska <angelikatyborska@fastmail.com> Co-authored-by: Aleksandr Lossenko <aleksandr.lossenko@memsource.com> Co-authored-by: Amir Hasanbasic <43892661+hamir-suspect@users.noreply.github.com> Co-authored-by: Nathan Alderson <me@nathanalderson.com> Co-authored-by: E. Sambo <news@emmanuelsambo.com> Co-authored-by: Alberto Sartori <alberto.sartori.as@gmail.com> Co-authored-by: Hans Krutzer <git@pixelspaceships.com> Co-authored-by: Mike Buhot <m.buhot@gmail.com> Co-authored-by: Zach Daniel <zachary.s.daniel@gmail.com> Co-authored-by: Davide Briani <60540759+davidebriani@users.noreply.github.com> Co-authored-by: David-Klemenc <44705886+David-Klemenc@users.noreply.github.com> Co-authored-by: GregorGrasselli <GregorGrasselli@users.noreply.github.com> Co-authored-by: Sergey Loguntsov <loguntsov@list.ru> Co-authored-by: Jarmo Pertman <jarmo@jarmopertman.com> Co-authored-by: Giorgio Primola <torres.giorgio@icloud.com> Co-authored-by: Giorgio Torres <giorgio.torres@hpe.com> Co-authored-by: Georges Dubus <georges.dubus@gmail.com> Co-authored-by: Sergey Moiseev <moiseev.sergey@gmail.com> Co-authored-by: David Pavlík <pavlik.d@seznam.cz> Co-authored-by: Adam C. Stephens <2071575+adamcstephens@users.noreply.github.com> Co-authored-by: Dave Lucia <dave@tvlabs.ai> Co-authored-by: José Valim <jose.valim@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Currently the
OpenApiSpex.Plug.SwaggerUIdoes not support multiple URLs and to preview more than a single spec one has to add the plug n times.The SwaggerUI supports this already docs through the topbar plugin which is loaded in the
SwaggerUIStandalonePresetpreset open_api_spex uses.This PR allows setting a
pathskeyword instead of apathstring.Which renders as seen in the screenshot below:
It does not affect routers not using the new
pathsoption.