Skip to content

Restore struct? default to false to suppress x-struct population#5

Closed
luisgabrielroldan wants to merge 1 commit into
masterfrom
restore-struct-x-struct-suppression
Closed

Restore struct? default to false to suppress x-struct population#5
luisgabrielroldan wants to merge 1 commit into
masterfrom
restore-struct-x-struct-suppression

Conversation

@luisgabrielroldan
Copy link
Copy Markdown
Member

What

Restore the ActiveProspect fork patch that defaults :struct? to false in build_schema/2 (lib/open_api_spex.ex).

Why

The upstream sync (#4, through v3.22.3) reverted this fork-specific default back to upstream's true. As a result, the x-struct vendor extension is now auto-populated with fully-qualified Elixir module names (e.g. Elixir.ClaimerWeb.Schemas.BadRequest) in generated OpenAPI specs, where the fork previously left it null.

This was surfaced while migrating trustedform-api's dependency reference from tf-changes-rebased to master (prep for Elixir 1.19 / OTP 28): regenerating make api-docs showed every schema's x-struct flip from null to a module name.

Effect

  • x-struct returns to null in generated specs (no internal module names leaked into published docs).
  • As before, no defstruct/@type t is generated for schema modules (gated on x-struct == __MODULE__). Verified trustedform-api does not construct or pattern-match these schema structs, so this is safe.

Diff

-        if Keyword.get(opts, :struct?, true) do
+        if Keyword.get(opts, :struct?, false) do

The upstream sync (#4, through v3.22.3) reverted the ActiveProspect fork
patch that defaulted :struct? to false in build_schema/2, causing the
x-struct vendor extension to be auto-populated with module names in
generated specs. This restores the prior behavior.
@luisgabrielroldan
Copy link
Copy Markdown
Member Author

Closing in favor of applying struct?: false per-schema in trustedform-api, to keep this fork aligned with upstream rather than re-introducing the divergence the upstream sync removed.

@luisgabrielroldan luisgabrielroldan deleted the restore-struct-x-struct-suppression branch May 21, 2026 21:00
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.

1 participant