Skip to content

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
masterfrom
elixir-1.19-otp-28-compatibility
Closed

Fix Elixir 1.18+/OTP 28 compatibility; narrow CI to Elixir 1.16-1.19 / OTP 26-28#3
luisgabrielroldan wants to merge 77 commits into
masterfrom
elixir-1.19-otp-28-compatibility

Conversation

@luisgabrielroldan
Copy link
Copy Markdown
Member

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?/1 was removed in Elixir 1.18 (compile error). Replaced with is_struct(match, Regex).
  • @default_parsers was 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)

  • Replaced the old OTP 22–25 / Elixir 1.10–1.13 matrix with Elixir 1.16–1.19 × OTP 26–28 (8 valid combinations after excluding incompatible version pairs).
  • Bumped lint and test_examples jobs to Elixir 1.19 / OTP 28.
  • Switched test runner from ubuntu-20.04 to ubuntu-latest.

Type of change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • UI Change Only
  • Chore
  • Configuration change
  • Technical Debt
  • Documentation

Related tickets

N/A

Checklists

Development and Testing

  • Lint rules pass locally.
  • The code changed/added as part of this pull request has been covered with tests, or this PR does not alter production code.
  • All tests related to the changed code pass in development, or tests are not applicable.

Code Review

  • This pull request has a descriptive title and information useful to a reviewer. There may be a screenshot or screencast attached.
  • At least two engineers have been added as "Reviewers" on the pull request.
  • Changes have been reviewed by at least two other engineers who did not write the code.
  • This branch has been rebased off master to be current.

Tracking

  • Issue from Shortcut/Jira has a link to this pull request.
  • This PR has a link to the issue in Shortcut.

QA

  • This branch has been deployed to staging and tested.

thbar and others added 30 commits July 25, 2023 18:32
…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
…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
zorbash and others added 22 commits March 3, 2025 19:30
* 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.
@luisgabrielroldan luisgabrielroldan force-pushed the elixir-1.19-otp-28-compatibility branch from a24a481 to 9d4712a Compare May 21, 2026 18:33
kellym and others added 5 commits May 21, 2026 15:37
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.
@luisgabrielroldan luisgabrielroldan force-pushed the elixir-1.19-otp-28-compatibility branch from 9d4712a to 38a9b9a Compare May 21, 2026 18:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.