Skip to content

gen-types and .prettierignore disagree about who owns manifest.generated.ts #182

Description

@thalida

just gen-types writes app/src/types/manifest.generated.ts in openapi-typescript's own style: 4-space indent, double quotes. The file committed in the repo is 2-space, single quotes — prettier output. So a plain regeneration rewrites the entire file:

$ just gen-types
$ git diff --stat app/src/types/manifest.generated.ts
 app/src/types/manifest.generated.ts | 2238 +++++++++++-----------------
 1 file changed, 1116 insertions(+), 1122 deletions(-)

The one real change (a wire field gaining a value) is buried in ~1,100 lines of formatting churn.

Why it doesn't self-correct

.prettierignore lists the file:

# Auto-generated from the OpenAPI schema by `just gen-types` (openapi-typescript).
# Edit api/models/*.py and regenerate; never hand-format this file.
app/src/types/manifest.generated.ts

So npx prettier --write . skips it and fmt-check passes either way. Nothing in the gate notices, and whoever regenerates last silently decides which style is in the repo. The ignore entry says the generator owns the file; the committed contents say prettier does.

It is not a version drift: openapi-typescript is pinned at ^7.13.0 in app/package.json and just gen-types runs the local binary.

What I did in #181

Force-formatted past the ignore, which collapsed the diff to the 8 lines that actually changed:

npx prettier --write --ignore-path /dev/null app/src/types/manifest.generated.ts

That works but it's a step nobody knows to run, and the next regeneration without it puts the churn back.

Options

  • Fold the format into the recipe (just gen-types runs prettier with --ignore-path /dev/null as its last step) and reword the .prettierignore comment to say the recipe formats it, not that it is never formatted.
  • Or accept the generator's output as canonical, reformat the committed file once to match, and leave the ignore entry as-is.

Either resolves it. The first keeps the file consistent with the rest of the tree and means a regeneration diff shows only the wire change.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P4cat:bugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions