This repository was archived by the owner on Oct 10, 2025. It is now read-only.
Commit 736fc85
fix: define properly query parameters (#660)
### **PR Type**
Bug fix, Enhancement
___
### **Description**
- Fix handling of `allowedRoles` and `metadata` query parameters.
- Update OpenAPI spec for correct query parameter definitions.
- Parse `metadata` as JSON-encoded string in API handler.
- Update tests to use JSON string for `metadata`.
___
### **Changes diagram**
```mermaid
flowchart LR
openapi["OpenAPI spec (openapi.yaml)"]
server["Server handler (server.gen.go)"]
types["API types (types.gen.go)"]
tests["SignInProvider tests (sign_in_provider_test.go)"]
openapi -- "Clarify allowedRoles/metadata param types" --> server
openapi -- "Clarify allowedRoles/metadata param types" --> types
server -- "Parse metadata as JSON string" --> types
types -- "Update Metadata docstring" --> tests
tests -- "Test metadata as JSON string" --> server
```
___
### **Changes walkthrough** 📝
<table><thead><tr><th></th><th align="left">Relevant
files</th></tr></thead><tbody><tr><td><strong>Enhancement</strong></td><td><table>
<tr>
<td>
<details>
<summary><strong>openapi.yaml</strong><dd><code>Update OpenAPI spec for
allowedRoles and metadata query params</code></dd></summary>
<hr>
docs/openapi.yaml
<li>Add <code>style: form</code> and <code>explode: false</code> for
<code>allowedRoles</code>.<br> <li> Change <code>metadata</code> to a
JSON-encoded string in query parameters.<br> <li> Update
<code>metadata</code> description and schema to reflect JSON encoding.
</details>
</td>
<td><a
href="https://github.com/nhost/hasura-auth/pull/660/files#diff-6e0796423f18517e4c44819722b39c2c5ab9999f9dfb37598288ea041d1db2b0">+11/-7</a>
</td>
</tr>
</table></td></tr><tr><td><strong>Bug fix</strong></td><td><table>
<tr>
<td>
<details>
<summary><strong>server.gen.go</strong><dd><code>Fix and parse
allowedRoles/metadata query parameters in handler</code></dd></summary>
<hr>
go/api/server.gen.go
<li>Fix <code>allowedRoles</code> to not require parameter and not
explode.<br> <li> Parse <code>metadata</code> query param as JSON string
and unmarshal into map.<br> <li> Improve error handling for invalid
<code>metadata</code> JSON.
</details>
</td>
<td><a
href="https://github.com/nhost/hasura-auth/pull/660/files#diff-ebca0209f464067ebb38f8fad9dd352058e15702563f575d649434a1e7722b3d">+177/-169</a></td>
</tr>
</table></td></tr><tr><td><strong>Documentation</strong></td><td><table>
<tr>
<td>
<details>
<summary><strong>types.gen.go</strong><dd><code>Clarify Metadata field
as JSON-encoded string</code>
</dd></summary>
<hr>
go/api/types.gen.go
- Update `Metadata` field comment to specify JSON-encoded string.
</details>
</td>
<td><a
href="https://github.com/nhost/hasura-auth/pull/660/files#diff-086764bd76c1416b0d0ddedcc804c3e6983907886215f9bb51162df91e823254">+1/-1</a>
</td>
</tr>
</table></td></tr><tr><td><strong>Tests</strong></td><td><table>
<tr>
<td>
<details>
<summary><strong>sign_in_provider_test.go</strong><dd><code>Update test
to use JSON string for metadata param</code>
</dd></summary>
<hr>
go/controller/sign_in_provider_test.go
- Update test to provide `metadata` as JSON string.
</details>
</td>
<td><a
href="https://github.com/nhost/hasura-auth/pull/660/files#diff-a0673feaf4e6575a6193d136e11b1a0c87cc33fb1ca1eb78ebd2d2f3d9ad8f94">+1/-1</a>
</td>
</tr>
</table></td></tr></tr></tbody></table>
___
> <details> <summary> Need help?</summary><li>Type <code>/help how to
...</code> in the comments thread for any questions about PR-Agent
usage.</li><li>Check out the <a
href="https://qodo-merge-docs.qodo.ai/usage-guide/">documentation</a>
for more information.</li></details>
---------
Co-authored-by: Nuno Pato <nunopato@gmail.com>1 parent ea15371 commit 736fc85
4 files changed
Lines changed: 190 additions & 178 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
531 | 531 | | |
532 | 532 | | |
533 | 533 | | |
| 534 | + | |
| 535 | + | |
534 | 536 | | |
535 | 537 | | |
536 | 538 | | |
| |||
566 | 568 | | |
567 | 569 | | |
568 | 570 | | |
569 | | - | |
570 | | - | |
571 | | - | |
572 | | - | |
573 | | - | |
574 | | - | |
575 | | - | |
| 571 | + | |
| 572 | + | |
| 573 | + | |
| 574 | + | |
| 575 | + | |
| 576 | + | |
| 577 | + | |
| 578 | + | |
| 579 | + | |
576 | 580 | | |
577 | 581 | | |
578 | 582 | | |
| |||
0 commit comments