Skip to content
This repository was archived by the owner on Oct 10, 2025. It is now read-only.

Commit 736fc85

Browse files
dbarrosopnunopato
andauthored
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>&nbsp; &nbsp; </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>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </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>&nbsp; &nbsp; &nbsp; </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>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </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>&nbsp; &nbsp; &nbsp; </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

File tree

docs/openapi.yaml

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -531,6 +531,8 @@ paths:
531531
in: query
532532
required: false
533533
description: Array of allowed roles for the user
534+
style: form
535+
explode: false
534536
schema:
535537
type: array
536538
items:
@@ -566,13 +568,15 @@ paths:
566568
- name: metadata
567569
in: query
568570
required: false
569-
description: Additional metadata for the user
570-
schema:
571-
type: object
572-
additionalProperties: true
573-
example:
574-
firstName: John
575-
lastName: Smith
571+
description: Additional metadata for the user (JSON encoded string)
572+
content:
573+
application/json:
574+
schema:
575+
type: object
576+
additionalProperties: true
577+
example:
578+
firstName: John
579+
lastName: Smith
576580
- name: redirectTo
577581
in: query
578582
required: false

0 commit comments

Comments
 (0)