๐—ฆ๐—ฐ๐—ฎ๐—ฟ๐—ฎ๐—ฏ ๐——๐—ถ๐—ฎ๐—ด๐—ป๐—ผ๐˜€๐˜๐—ถ๐—ฐ ๐—™๐—ถ๐—ฒ๐—น๐—ฑ ๐—ง๐—ฒ๐˜€๐˜ #๐Ÿฌ๐Ÿฎ๐Ÿด

A generator must keep its promises.

We found a bug in the OpenAPI Generator Rust server. The generator creates code, but it failed to provide the tools that code needs to run.

The Problem: The generator produced Rust code for shared models. These models used pattern validation. This validation required two specific crates: lazy_static and regex.

However, when a user enabled only the "client" feature, the generator forgot to include those two crates in the build settings. This caused the build to fail.

This is a generator contract problem. If the generator emits code that needs a dependency, the generator must also emit the instructions to include that dependency.

The Fix: We did not suggest adding every dependency to every build. That is messy. We also did not tell users to fix it manually. That is not the generator's job.

Instead, we tightened the feature wiring. Now, if the client feature compiles shared models that use validation, the build automatically includes the required crates.

The Results:

When generated code and build metadata disagree, you must repair the seam where the contract breaks.

Source: https://dev.to/scarab-systems/scarab-diagnostic-field-test-028-openapi-generator-rust-server-client-feature-boundary-2c0n

Optional learning community: https://t.me/GyaanSetuAi