Fix Elixir 1.18+/OTP 28 compatibility; narrow CI to Elixir 1.16-1.19 / OTP 26-28#3
Closed
luisgabrielroldan wants to merge 77 commits into
Closed
Fix Elixir 1.18+/OTP 28 compatibility; narrow CI to Elixir 1.16-1.19 / OTP 26-28#3luisgabrielroldan wants to merge 77 commits into
luisgabrielroldan wants to merge 77 commits into
Conversation
…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
…-api-spex#552) Co-authored-by: Gianluca Nitti <gianluca.nitti@voismart.it>
…#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
Co-authored-by: Alberto Sartori <alberto.sartori@hpe.com>
* Exclude empty paths from spec
* fix: assert_operation_response header lookup
…x#592) * Add failing test * Cast result of AllOf cast into a struct * Shorter module name
…-spex#586) * relax dependency on ymlr, and fix some tests * test with more elixir versions
* Update Elixir version test matrix * Fix map key order dependent test
…g cast and validate plug (open-api-spex#589)
…pex#593) * Allow script and style nonces * Allow nonces on the SwaggerUIOAuth2Redirect plug as well
…#606) * fix: ensure operation_id is always set on conn.private when an operation is known
* Add mix spec.yaml tasks in example applications * Update example application dependencies
* Fix Elixir 1.18 compilation warnings * Test against 1.18
* 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>
* Support references in assert_operation_response/2 * fixup! Support references in assert_operation_response/2
A new release will be out soon, this will allow users to migrate if desired. The new version is compatible with OpenAPISpex.
a24a481 to
9d4712a
Compare
Replaces the old OTP 22–25 / Elixir 1.10–1.13 coverage with the current supported range. Results in 8 valid combinations: 1.16 × 26 1.17 × 26, 27 1.18 × 26, 27 1.19 × 26, 27, 28 Excluded pairs follow the official Elixir/OTP compatibility matrix: 1.16 tops out at OTP 26; 1.17 and 1.18 top out at OTP 27; only 1.19 supports OTP 28.
credo 1.6.4 stores compiled regexes in module attributes, which is an error under OTP 28's PCRE2 engine. 1.7.18 ships with that fixed.
paths.ex: sort all_operations by {path, verb} before grouping so the
operationId deduplication always picks the same verb as the base
occurrence. Previously Map.from_struct/1 iteration was hash-ordered,
making the winner non-deterministic.
object_test.exs: cast returns property errors in map iteration order,
which is non-deterministic. Sort errors by path before asserting so
the test is order-independent.
elixir.yml: add `mix deps.compile` before `mix compile
--warnings-as-errors` in the lint job. With no build cache, Mix
compiles deps inside the --warnings-as-errors invocation and promotes
their deprecation warnings (charlist syntax, ~R sigil, use Bitwise,
etc. from old deps) to errors. Pre-compiling deps separately avoids
this.
9d4712a to
38a9b9a
Compare
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.
Description of the change
Two changes to make the library compatible with Elixir 1.18+ and OTP 28.
Source fix (
lib/open_api_spex/cast_parameters.ex)Regex.regex?/1was removed in Elixir 1.18 (compile error). Replaced withis_struct(match, Regex).@default_parserswas a module attribute holding a compiled~r/.../literal. Storing compiled regexes in module attributes is deprecated in Elixir 1.19 / OTP 28 because the PCRE→PCRE2 engine change means pre-compiled patterns differ across OTP versions. Converted to a private function so the regex is compiled at call time.CI matrix (
.github/workflows/elixir.yml)ubuntu-20.04toubuntu-latest.Type of change
Related tickets
Checklists
Development and Testing
Code Review
Tracking
QA