Skip to content

feat(openapi): form-data helpers#951

Merged
dinwwwh merged 2 commits intomainfrom
feat/openapi/helpers
Sep 1, 2025
Merged

feat(openapi): form-data helpers#951
dinwwwh merged 2 commits intomainfrom
feat/openapi/helpers

Conversation

@dinwwwh
Copy link
Copy Markdown
Member

@dinwwwh dinwwwh commented Aug 31, 2025

Summary by CodeRabbit

  • New Features

    • Exposed Form Data helpers in the OpenAPI client to parse nested form submissions and retrieve validation messages via bracket notation.
  • Documentation

    • Added a “Form Data” guide with usage examples and a sidebar link.
    • Streamlined server-action docs to reference the re-exported helpers.
    • Fixed formatting in the bracket-notation complex example.
  • Tests

    • Added a test to verify the helpers entry is available.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Aug 31, 2025

Note

Other AI code review bot(s) detected

CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.

Walkthrough

Adds a public helpers export in openapi-client that re-exports parseFormData and getIssueMessage from the standard adapter, adds documentation (new Form Data page and sidebar entry), updates server-action docs to reference the re-exported helpers, and fixes a duplicated trailing fragment in the bracket-notation docs.

Changes

Cohort / File(s) Summary
Docs navigation
apps/content/.vitepress/config.ts
Adds "Form Data" entry under Helpers linking to /docs/helpers/form-data.
Form Data docs
apps/content/docs/helpers/form-data.md, apps/content/docs/server-action.md
Adds a new Form Data helpers page with examples for parseFormData and getIssueMessage; renames/updates server-action section to reference re-exported Form Data Utilities.
Bracket-notation doc cleanup
apps/content/docs/openapi/bracket-notation.md
Removes duplicated trailing code fence/JSON fragment in the Complex Example (formatting cleanup only).
OpenAPI client helpers export
packages/openapi-client/package.json, packages/openapi-client/src/helpers/index.ts, packages/openapi-client/src/helpers/index.test.ts
Adds ./helpers export mapping in package.json (src and dist entries); new helpers index re-exports parseFormData and getIssueMessage from ../adapters/standard; adds a test asserting the export presence.

Sequence Diagram(s)

sequenceDiagram
    autonumber
    actor Dev as App/Developer
    participant Package as @orpc/openapi-client
    participant Helpers as package helpers index
    participant Std as adapters/standard

    Dev->>Package: import { parseFormData, getIssueMessage } from "@orpc/openapi-client/helpers"
    Note over Package,Helpers: New public export path "./helpers"
    Package->>Helpers: resolve helpers entry -> re-exported symbols
    Helpers->>Std: re-exports parseFormData & getIssueMessage
    Std-->>Dev: functions available for use
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • unnoq/orpc#509 — Introduces the same openapi-client "./helpers" export and matching docs/tests for these utilities.
  • unnoq/orpc#567 — Modifies bracket-notation deserialization in the adapters/standard module that these helpers re-export from.
  • unnoq/orpc#274 — Edits the Complex Example in the bracket-notation docs; related to the documentation cleanup here.

Poem

A hop, a nibble, docs all neat,
I fetched two helpers — small and fleet.
parseFormData sorts fields with care,
getIssueMessage finds errors there.
Sidebar set, tests in line — carrot cheer, all fine! 🥕

Tip

🔌 Remote MCP (Model Context Protocol) integration is now available!

Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats.

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/openapi/helpers

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore or @coderabbit ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@vercel
Copy link
Copy Markdown

vercel bot commented Aug 31, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
orpc Ready Ready Preview Comment Aug 31, 2025 9:24am

@dosubot dosubot bot added the size:L This PR changes 100-499 lines, ignoring generated files. label Aug 31, 2025
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Summary of Changes

Hello @unnoq, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request introduces new helper utilities for efficiently handling HTML form data and validation errors, specifically focusing on parsing complex nested structures using bracket notation. It includes comprehensive documentation for these new features and integrates them into the existing documentation structure, enhancing the developer experience for form processing.

Highlights

  • New Form Data Helpers Documentation: Introduced a new documentation page for parseFormData and getIssueMessage utilities, detailing their functionality and usage with examples.
  • parseFormData Utility: Added parseFormData to deserialize complex nested objects and arrays from HTML form data using bracket notation.
  • getIssueMessage Utility: Implemented getIssueMessage to extract validation error messages from standard schema issues based on bracket notation paths.
  • Package Export Update: The openapi-client package now exports these new form data helper utilities via a dedicated entry point (./helpers).
  • Documentation Cross-Referencing: Updated existing documentation to link to the new Form Data Helpers page and removed redundant explanations.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in issue comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@codecov
Copy link
Copy Markdown

codecov bot commented Aug 31, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a new, more semantic export path @orpc/openapi-client/helpers for the existing parseFormData and getIssueMessage utilities. It also adds a dedicated documentation page for these helpers and updates other documentation to reference it. The changes are well-structured and improve the developer experience. I've found a couple of issues in the code examples in the new documentation file that should be addressed to ensure they are correct and runnable. My feedback is in the review comments.

Comment thread apps/content/docs/helpers/form-data.md
Comment thread apps/content/docs/helpers/form-data.md
@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new bot commented Aug 31, 2025

More templates

@orpc/arktype

npm i https://pkg.pr.new/@orpc/arktype@951

@orpc/client

npm i https://pkg.pr.new/@orpc/client@951

@orpc/contract

npm i https://pkg.pr.new/@orpc/contract@951

@orpc/experimental-durable-event-iterator

npm i https://pkg.pr.new/@orpc/experimental-durable-event-iterator@951

@orpc/hey-api

npm i https://pkg.pr.new/@orpc/hey-api@951

@orpc/interop

npm i https://pkg.pr.new/@orpc/interop@951

@orpc/json-schema

npm i https://pkg.pr.new/@orpc/json-schema@951

@orpc/nest

npm i https://pkg.pr.new/@orpc/nest@951

@orpc/openapi

npm i https://pkg.pr.new/@orpc/openapi@951

@orpc/openapi-client

npm i https://pkg.pr.new/@orpc/openapi-client@951

@orpc/otel

npm i https://pkg.pr.new/@orpc/otel@951

@orpc/react

npm i https://pkg.pr.new/@orpc/react@951

@orpc/react-query

npm i https://pkg.pr.new/@orpc/react-query@951

@orpc/experimental-react-swr

npm i https://pkg.pr.new/@orpc/experimental-react-swr@951

@orpc/server

npm i https://pkg.pr.new/@orpc/server@951

@orpc/shared

npm i https://pkg.pr.new/@orpc/shared@951

@orpc/solid-query

npm i https://pkg.pr.new/@orpc/solid-query@951

@orpc/standard-server

npm i https://pkg.pr.new/@orpc/standard-server@951

@orpc/standard-server-aws-lambda

npm i https://pkg.pr.new/@orpc/standard-server-aws-lambda@951

@orpc/standard-server-fetch

npm i https://pkg.pr.new/@orpc/standard-server-fetch@951

@orpc/standard-server-node

npm i https://pkg.pr.new/@orpc/standard-server-node@951

@orpc/standard-server-peer

npm i https://pkg.pr.new/@orpc/standard-server-peer@951

@orpc/svelte-query

npm i https://pkg.pr.new/@orpc/svelte-query@951

@orpc/tanstack-query

npm i https://pkg.pr.new/@orpc/tanstack-query@951

@orpc/trpc

npm i https://pkg.pr.new/@orpc/trpc@951

@orpc/valibot

npm i https://pkg.pr.new/@orpc/valibot@951

@orpc/vue-colada

npm i https://pkg.pr.new/@orpc/vue-colada@951

@orpc/vue-query

npm i https://pkg.pr.new/@orpc/vue-query@951

@orpc/zod

npm i https://pkg.pr.new/@orpc/zod@951

commit: c9e184c

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (3)
packages/openapi-client/package.json (1)

40-45: Top-level TS export wiring is correct; consider a minor version bump

Adding a new public subpath export is a feature; plan a minor version bump (via your changeset flow) before publishing.

If you use Changesets, do you want me to draft the changeset note for this package?

apps/content/docs/helpers/form-data.md (2)

14-32: Add a short note on types returned by parseFormData

Clarify that values are strings or File/File[]; no automatic number/boolean coercion (use schema coercion).

Proposed addition after the example:

+::: note
+`parseFormData` preserves raw types: text fields become `string`, file fields become `File` or `File[]`. It does not coerce types (e.g., numbers/booleans) — use your schema (e.g., `z.coerce.number()`).
+:::

68-96: Optional: include a small file-input example

Since many forms include files, a brief snippet showing images[] -> File[] would help readers connect with the Server Action example.

Proposed addition:

+#### File inputs
+```ts
+const form = new FormData()
+form.append('images[]', new File(['a'], 'a.txt'))
+form.append('images[]', new File(['b'], 'b.txt'))
+const data = parseFormData(form)
+// data.images is File[]
+```
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between f437dcb and 95c2c1a.

📒 Files selected for processing (6)
  • apps/content/.vitepress/config.ts (1 hunks)
  • apps/content/docs/helpers/form-data.md (1 hunks)
  • apps/content/docs/openapi/bracket-notation.md (0 hunks)
  • apps/content/docs/server-action.md (1 hunks)
  • packages/openapi-client/package.json (2 hunks)
  • packages/openapi-client/src/helpers/index.ts (1 hunks)
💤 Files with no reviewable changes (1)
  • apps/content/docs/openapi/bracket-notation.md
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: publish-commit
  • GitHub Check: test
  • GitHub Check: lint
  • GitHub Check: Analyze (javascript-typescript)
🔇 Additional comments (6)
apps/content/.vitepress/config.ts (1)

151-159: Form Data sidebar entry verified
apps/content/docs/helpers/form-data.md exists and matches the link /docs/helpers/form-data in config.ts; route will build correctly.

packages/openapi-client/src/helpers/index.ts (1)

1-1: Approve: exports verified and accurately re-exported
Verified that getIssueMessage and parseFormData are exported from the standard adapter and correctly re-exported by the React package.

packages/openapi-client/package.json (1)

23-27: Export map for ./helpers is correct and matches dist layout

The publishConfig.exports["./helpers"] entries align with Unbuild output conventions.

apps/content/docs/server-action.md (1)

276-312: Docs claim @orpc/react re-exports helpers — verify import path

If @orpc/react doesn’t currently re-export getIssueMessage and parseFormData, switch the import to @orpc/openapi-client/helpers or add the re-export.

Apply this fallback if needed:

-import { getIssueMessage, parseFormData } from '@orpc/react'
+import { getIssueMessage, parseFormData } from '@orpc/openapi-client/helpers'
apps/content/docs/helpers/form-data.md (2)

36-60: Good coverage of bracket-notation paths

Examples read well; wildcard array selector note is helpful.


62-64: Warning is accurate; link targets are correct

Nice guardrails about the expected issue format.

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
packages/openapi-client/src/helpers/index.test.ts (1)

1-3: Strengthen the test: assert both helpers and their types

Also validate parseFormData and ensure both exports are functions. Rename the test to be descriptive.

Apply this diff:

-it('exports something', async () => {
-  expect(await import('./index')).toHaveProperty('getIssueMessage')
-})
+it('re-exports helpers: getIssueMessage and parseFormData', async () => {
+  const mod = await import('./index')
+  expect(typeof mod.getIssueMessage).toBe('function')
+  expect(typeof mod.parseFormData).toBe('function')
+})
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 95c2c1a and c9e184c.

📒 Files selected for processing (1)
  • packages/openapi-client/src/helpers/index.test.ts (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: publish-commit
  • GitHub Check: test
  • GitHub Check: lint
  • GitHub Check: Analyze (javascript-typescript)
🔇 Additional comments (2)
packages/openapi-client/src/helpers/index.test.ts (2)

1-3: LGTM: minimal smoke test for the new helpers surface

The async dynamic import + property check is a reasonable smoke test for the public re-export.


1-3: Exports correctly configured for ./helpers
Found exports["./helpers"] in package.json and both getIssueMessage and parseFormData are re-exported in packages/openapi-client/src/helpers/index.ts.

@dinwwwh dinwwwh merged commit 4b3a4c5 into main Sep 1, 2025
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L This PR changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant