Skip to content

docs: document automatic enum generation in binding generator - #4973

Merged
leaanthony merged 4 commits into
v3-alphafrom
docs/enum-generation-4972
Feb 8, 2026
Merged

leaanthony merged 4 commits into
v3-alphafrom
docs/enum-generation-4972

Conversation

@leaanthony

@leaanthony leaanthony commented Feb 7, 2026 •

Copy link
Copy Markdown
Member

Summary

Closes #4972

  • Add dedicated Enums documentation page (docs/src/content/docs/features/bindings/enums.mdx) covering:
    • How to define enums (named type + const block)
    • What gets generated (JS/TS with $zero for Go zero values)
    • Struct field typing (enum type preserved, not primitive)
    • String, integer, and type alias enum patterns
    • Enums from imported packages
    • Supported underlying types table
    • Limitations (generics, custom marshalers, complex types)
    • Complete working example
  • Fix inaccurate enum subsection in Data Models page to show real generator output
  • Add Data Models and Enums to the sidebar navigation (both were missing)

Test plan

  • npm run build in docs/ completes with no errors (151 pages built)
  • Verify enum page renders correctly at /features/bindings/enums
  • Verify sidebar shows "Data Models" and "Enums" under "Bindings & Services"
  • Verify cross-reference link from Data Models → Enums page works

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Documentation
    • Added a dedicated Enums guide covering automatic enum generation, usage examples, limitations, and migration notes.
    • Updated Data Models docs to use TypeScript enum representation and adjusted examples accordingly.
    • Added sidebar navigation links for quick access to Data Models and Enums.
    • Added a changelog entry documenting the new Enums documentation.

Add dedicated Enums page covering string/integer/type-alias enums,
$zero values, struct field typing, imported package enums, supported
types, and limitations. Fix inaccurate enum section in Data Models
page and add both Data Models and Enums to sidebar navigation.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings February 7, 2026 20:36
@github-actions

github-actions Bot commented Feb 7, 2026

Copy link
Copy Markdown
Contributor

⚠️ Missing Changelog Update

Hi @leaanthony, please update v3/UNRELEASED_CHANGELOG.md with a description of your changes.

This helps us keep track of changes for the next release.

@coderabbitai

coderabbitai Bot commented Feb 7, 2026 •

Copy link
Copy Markdown
Contributor

Caution

Review failed

The pull request is closed.

Walkthrough

Adds a new Enums documentation page, updates the Models bindings page to show TypeScript enum output, adds sidebar navigation links for Models and Enums, and records the documentation addition in the v3 changelog.

Changes

Cohort / File(s) Summary
Site config / Navigation
docs/astro.config.mjs
Added two navigation items under "Bindings & Services": Data Models -> /features/bindings/models and Enums -> /features/bindings/enums.
New Enums doc
docs/src/content/docs/features/bindings/enums.mdx
Added a comprehensive Enums page describing automatic generation of TypeScript/JS enums from Go named-const types, $zero handling, usage in structs, supported underlying types, limitations, examples, and cross-package behavior.
Models doc update
docs/src/content/docs/features/bindings/models.mdx
Replaced prior JS object example with a TypeScript enum depiction, updated example usages to use UserRole.RoleAdmin, preserved JSDoc notes, and added a cross-reference to the new Enums page.
Changelog
v3/UNRELEASED_CHANGELOG.md
Added entry documenting the new Enums page and enum generation documentation for the binding generator.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

Suggested labels

Documentation, v3-alpha, size:L, lgtm

Poem

🐰 I hop through pages, tidy and keen,

Enums now visible, neat and seen.
From Go to TS they prance and play,
With a tiny $zero leading the way.
Hooray — the docs have saved the day!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically describes the main change: documenting automatic enum generation in the binding generator.
Description check ✅ Passed The description includes issue reference (#4972), comprehensive summary of changes, test plan, and fills the template sections effectively.
Linked Issues check ✅ Passed Changes fully address all linked issue #4972 requirements: enum definition explanation, generated output documentation, struct field typing, supported types, limitations, and working examples provided.
Out of Scope Changes check ✅ Passed All changes directly support the primary objective: adding enum documentation. Navigation updates and Data Models corrections are in-scope supporting changes.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch docs/enum-generation-4972

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

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Fix all issues with AI agents
In `@docs/src/content/docs/features/bindings/enums.mdx`:
- Around line 245-255: The `$zero` value table under the "The `$zero` Value"
section is missing the `bool` entry; update the table to add a row mapping
`bool` to `false` so the docs match the "Supported Underlying Types" list and
include the Go zero value for boolean enums; locate the "The `$zero` Value"
heading and the table showing Underlying Type → `$zero` Value and insert the
`bool` → `false` row.
- Around line 314-337: The example calls title.String() but services.Title has
no String method, causing a compile error; either add a String receiver on Title
in services/types.go (implement func (t Title) String() string that returns the
underlying string) or change the caller in GreetService.Greet to convert the
value directly (e.g., use string(title) when building the greeting). Update
either the Title type implementation (types.go) or the Greet method
(GreetService.Greet) so the call matches a defined symbol.
🧹 Nitpick comments (1)
docs/src/content/docs/features/bindings/enums.mdx (1)

396-403: Clarify iota limitation wording.

Line 402 says iota-only constants "without explicit values" are not supported, then immediately says "Standard iota patterns work fine since the compiler resolves them to concrete values." These two statements may confuse readers — if the compiler resolves iota to concrete values, what exactly is the unsupported case? Consider rephrasing to clarify the distinction (e.g., iota with non-representable expressions, or iota used with unsupported types).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adds documentation for Wails v3’s automatic enum detection/generation in the bindings generator, and updates navigation and existing model docs to reference the new material.

Changes:

  • Adds a new dedicated Enums docs page describing Go enum patterns and generated JS/TS output.
  • Updates the Data Models page’s enums subsection to reflect actual generator output and link to the new page.
  • Adds Data Models and Enums links to the “Bindings & Services” sidebar navigation.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.

File Description
docs/src/content/docs/features/bindings/models.mdx Updates/clarifies the existing enums subsection and adds a cross-link to the new Enums page.
docs/src/content/docs/features/bindings/enums.mdx New comprehensive documentation page for automatic enum generation, patterns, and limitations.
docs/astro.config.mjs Adds missing sidebar links for Data Models and Enums under “Bindings & Services”.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Feb 7, 2026 •

Copy link
Copy Markdown

Deploying wails with  Cloudflare Pages  Cloudflare Pages

Latest commit: 863b5de
Status:⚡️  Build in progress...

View logs

leaanthony and others added 2 commits February 8, 2026 07:42
- Add bool → false to $zero value table
- Fix title.String() → string(title) in imported package example
- Clarify $zero defaults apply to class output, not interfaces
- Improve iota limitation wording for clarity

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@leaanthony
leaanthony merged commit bbc4e53 into v3-alpha Feb 8, 2026
10 of 14 checks passed
@github-actions

github-actions Bot commented Feb 8, 2026

Copy link
Copy Markdown
Contributor

⚠️ Missing Changelog Update

Hi @leaanthony, please update v3/UNRELEASED_CHANGELOG.md with a description of your changes.

This helps us keep track of changes for the next release.

Grantmartin2002 pushed a commit to Grantmartin2002/wails that referenced this pull request Apr 29, 2026
…pp#4973)

* docs: document automatic enum generation in binding generator (wailsapp#4972)

Add dedicated Enums page covering string/integer/type-alias enums,
$zero values, struct field typing, imported package enums, supported
types, and limitations. Fix inaccurate enum section in Data Models
page and add both Data Models and Enums to sidebar navigation.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* docs: add enum generation changelog entry (wailsapp#4972)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* docs: address review feedback on enum documentation

- Add bool → false to $zero value table
- Fix title.String() → string(title) in imported package example
- Clarify $zero defaults apply to class output, not interfaces
- Improve iota limitation wording for clarity

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants