# open_router: Fix tool_choice getting serialized to null \(\#34532\) · gitcafe/zed

[View on GitCafe](https://git.cafe/gitcafe/zed/commit/8ee5bf2c38528770620d33ead1d1042c6758287b)

Repository: [gitcafe/zed](https://git.cafe/gitcafe/zed)

Visibility: public

Requested revision: 8ee5bf2c38528770620d33ead1d1042c6758287b

Requested commit: 8ee5bf2c38528770620d33ead1d1042c6758287b

Commit: 8ee5bf2c38528770620d33ead1d1042c6758287b

Tree: 460317816d4a14dfd1602f9c8f8d1a68f8fd6f52

Author: Umesh Yadav

Committer: GitHub

## Message

```
open_router: Fix tool_choice getting serialized to null (#34532)

Closes #34314

This PR resolves an issue where serde(untagged) caused Rust None values
to serialize as null, which OpenRouter's Mistral API (when tool_choice
is present) incorrectly interprets as a defined value, leading to a 400
error. By replacing serde(untagged) with serde(snake_case), None values
are now correctly omitted from the serialized JSON, fixing the problem.
P.S. A separate PR will address serde(untagged) usage for other
providers, as null is not expected for them either.

Release Notes:

- Fix ToolChoice getting serialized to null on OpenRouter
```

## Parents

- [b0e0485b32e34b8416c010a6f0c86ed4e46759a0](https://git.cafe/gitcafe/zed/commit/b0e0485b32e34b8416c010a6f0c86ed4e46759a0?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zed/tree/8ee5bf2c38528770620d33ead1d1042c6758287b?format=markdown)
