# `jadpo fix`

Fix a standard type's finding.

When a Jadpo release adds a standard type the application already names for its own, jadpo check reports the clash (type.standard_clash), and a type with a standard type's shape under another name is type.standard_exists. With no arguments, fix lists each such finding and the fixes it takes. `swap` makes every reference use the standard type, reading each matched field by the standard field's name, and deletes the declaration. `rename` gives the application's declaration a new name, at the declaration, every reference that can see it and the file named after it. A fix whose result would have an error the project didn't have changes nothing and shows that error. The editor's quick fix makes the same swap.

```text
jadpo fix [name] [fix] [new-name]
```

## Arguments

- `name` (optional): The declaration to fix, as its finding names it
- `fix` (optional): How to fix it: swap or rename
- `new-name` (optional): The new name, for rename

## On every command

- `--json`: Print data for tools instead of text
- `--full`: Show everything a report shortens
- `--help`: Show every flag, with examples
- `--color <when>`: Choose when to use colour

`jadpo fix --json` writes one JSON document to standard output instead of text, with the same exit code. The document has `schemaVersion`, `command` (`"fix"`), `ok`, `data` (what the command produced, `null` when it failed) and `diagnostics` (each error with its `rule`, `reason`, `next` and `help`). A command that needs a terminal refuses `--json` and names the flags that do the same job.

## Examples

```text
# See what can be fixed after an upgrade
jadpo fix
# Use the standard Uuid instead of the app's own
jadpo fix Uuid swap
# Keep the app's own type under another name
jadpo fix Uuid rename RoomReference
```

## Errors

- [`cli.fix_arguments`](/docs/errors/cli.fix_arguments.md): A `jadpo fix` command names a declaration with nothing to fix, or a fix it doesn't have
- [`type.standard_clash`](/docs/errors/type.standard_clash.md): Declaration has a standard type's name
- [`type.standard_exists`](/docs/errors/type.standard_exists.md): You declared a type with the same fields as a standard type, such as a start and an end, under a name of your own
- [`toolchain.artifact_write_failed`](/docs/errors/toolchain.artifact_write_failed.md): A file Jadpo writes for you, such as a record, couldn't be written, usually because it or its folder is read-only
- [`toolchain.project_not_found`](/docs/errors/toolchain.project_not_found.md): You ran a command that works on a project in a folder with no `app.jadpo`, in it or in any folder above it
