Skip to content

184#186

Merged
RAprogramm merged 1 commit into
mainfrom
184
Jul 4, 2026
Merged

184#186
RAprogramm merged 1 commit into
mainfrom
184

Conversation

@RAprogramm

Copy link
Copy Markdown
Owner

Closes #184.

Generated code carried cfg_attr/cfg gates referencing facade feature names (api, validate, garde, tracing, postgres). Consumer crates that do not declare those features got unexpected_cfgs warnings on every entity — and, worse, a consumer without a postgres feature silently lost the repository impl. Found while validating the crate against a real backend.

Fix

  • Facade features now forward to matching entity-derive-impl features (postgres/api/validate/garde/tracing), so the macro knows at expansion time what is enabled
  • All emissions switch from consumer-side cfgs to expansion-time cfg! gating: ToSchema/Validate/garde derives, garde field rules, tracing::instrument, sqlx::FromRow, the repository impl block and the constraints mapper are emitted plainly when the feature is on and omitted entirely when off
  • Consumers no longer need to declare mirror features; no cfgs for foreign features ever reach their crates

Testing

  • Suites green in four feature combinations: default, --all-features, garde, garde+validate (precedence pinned: validator wins, zero garde tokens)
  • New CI step covers the garde-without-validate combination (previously untested in CI)
  • tracing/garde test modules gated to the features they exercise; clippy -D warnings clean across all targets

Notes

  • Release-plz will pick this up; consumer validation against a real project follows after publication

@codecov

codecov Bot commented Jul 4, 2026

Copy link
Copy Markdown

@RAprogramm RAprogramm merged commit ffc80a4 into main Jul 4, 2026
15 checks passed
@RAprogramm RAprogramm deleted the 184 branch July 4, 2026 07:40
@RAprogramm RAprogramm mentioned this pull request Jul 4, 2026
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.

fix(codegen): gate cross-feature cfg_attr emissions to avoid unexpected_cfgs warnings

1 participant