📒 docs: Auto generated framework documentation
Description
Updated new documentation generated using gomarkdoc and following the same consistency pattern for the issue
Fixes #2401
Old manually generated docs are stored in /docs/legacy/ for reference. We can remove it if required
Main changes are to /docs/addon/, /docs/api/ & /docs/middleware/.
Changes introduced
List the new features or adjustments introduced in this pull request. Provide details on benchmarks, documentation updates, changelog entries, and if applicable, the migration guide.
- [ ] Benchmarks: Describe any performance benchmarks and improvements related to the changes.
- [x] Documentation Update: Detail the updates made to the documentation and links to the changed files.
- [ ] Changelog/What's New: Include a summary of the additions for the upcoming release notes.
- [ ] Migration Guide: If necessary, provide a guide or steps for users to migrate their existing code to accommodate these changes.
- [ ] API Alignment with Express: Explain how the changes align with the Express API.
- [ ] API Longevity: Discuss the steps taken to ensure that the new or updated APIs are consistent and not prone to breaking changes.
- [ ] Examples: Provide examples demonstrating the new features or changes in action.
Type of change
Please delete options that are not relevant.
- [x] Documentation update (changes to documentation)
Checklist
Before you submit your pull request, please make sure you meet these requirements:
- [x] Followed the inspiration of the Express.js framework for new functionalities, making them similar in usage.
- [x] Conducted a self-review of the code and provided comments for complex or critical parts.
- [x] Updated the documentation in the
/docs/directory for Fiber's documentation. - [ ] Added or updated unit tests to validate the effectiveness of the changes or new features.
- [ ] Ensured that new and existing unit tests pass locally with the changes.
- [ ] Verified that any new dependencies are essential and have been agreed upon by the maintainers/community.
- [ ] Aimed for optimal performance with minimal allocations in the new code.
- [ ] Provided benchmarks for the new code to analyze and improve upon.
Thanks for opening this pull request! 🎉 Please check out our contributing guidelines. If you need help or want to chat with us, join us on Discord https://gofiber.io/discord
Walkthrough
Large-scale documentation reorganization and additions across addon, API, legacy API, and middleware docs, converting narrative pages into API-surface references with explicit types, functions, and defaults. Minor code comments/annotations updated. One behavioral change adjusts limiter’s default MaxFunc to return cfg.Max. Several config comments and docs corrected or clarified.
Changes
| Cohort / File(s) | Summary |
|---|---|
Retry addon docsdocs/addon/retry.md, addon/retry/README.md, docs/legacy/addon/retry.md |
Adds/rewrites retry docs to expose Config, ExponentialBackoff, DefaultConfig, NewExponentialBackoff, and Retry API; updates examples (imports/time usage). |
Log API docsdocs/api/log.md, log/fiberlog.go |
Reorganizes log package docs around public interfaces/functions; updates a comment for Panicf target without behavior change. |
Legacy API docs (new pages)docs/legacy/api/* (app.md, bind.md, constants.md, ctx.md, fiber.md, hooks.md, log.md, redirect.md, services.md, state.md) |
Adds comprehensive legacy API reference pages; no runtime code changes. |
Legacy middleware docs (new pages)docs/legacy/middleware/* (adaptor.md, basicauth.md, cache.md, compress.md, cors.md, csrf.md, earlydata.md, encryptcookie.md, envvar.md, etag.md, expvar.md, favicon.md, healthcheck.md, helmet.md, idempotency.md, keyauth.md, limiter.md, logger.md, pprof.md, proxy.md, recover.md, redirect.md, requestid.md, rewrite.md, session.md, skip.md, static.md, timeout.md) |
Adds detailed legacy middleware documentation: purpose, signatures, config, defaults, and examples. |
Middleware docs API refactordocs/middleware/* (basicauth.md, cache.md, compress.md, cors.md, csrf.md, earlydata.md, encryptcookie.md, envvar.md, etag.md, expvar.md, favicon.md, healthcheck.md, helmet.md, idempotency.md, keyauth.md, limiter.md, logger.md, pprof.md, proxy.md, recover.md, redirect.md, requestid.md, rewrite.md, session.md, skip.md, static.md, timeout.md) |
Converts pages to API-focused format: introduces/updates public Config types, defaults (ConfigDefault additions/removals), helpers, constants, and constructors; aligns docs with exported symbols. |
Minor source adjustmentsmiddleware/cors/config.go, middleware/csrf/config.go, middleware/keyauth/keyauth.go |
Tweaks comments/documentation: CORS default AllowOrigins comment, CSRF CookieSessionOnly comment removal, KeyAuth TokenFromContext description change. |
Limiter default behavior changemiddleware/limiter/config.go |
Changes default MaxFunc to return cfg.Max instead of c.Max; affects default limit computation when MaxFunc is not provided. |
Sequence Diagram(s)
sequenceDiagram
autonumber
actor Client
participant App
participant Limiter
participant Storage
Client->>App: HTTP Request
App->>Limiter: Invoke middleware
Note over Limiter: Compute max = MaxFunc(c, cfg)<br/>(default now uses cfg.Max)
Limiter->>Storage: Increment/Check counter
alt under limit
Limiter-->>App: Allow
App-->>Client: Handler response
else over limit
Limiter-->>Client: 429 Too Many Requests
end
Estimated code review effort
🎯 3 (Moderate) | ⏱️ ~25 minutes
Possibly related PRs
- gofiber/fiber#3070 — Adjusts limiter MaxFunc/behavior; directly related to the MaxFunc default change here.
- gofiber/fiber#3742 — KeyAuth RFC-aligned config and extractor changes; matches documented KeyAuth API surface updates.
- gofiber/fiber#3706 — CSRF API refactor adding TokenFromContext/HandlerFromContext and Config changes; aligns with CSRF docs updates.
Suggested reviewers
- gaby
- sixcolors
- ReneWerner87
Poem
In burrows deep I annotate,
New types and funcs I celebrate.
Docs now bloom like springtime clover,
Config fields all turned over.
One tiny hop for MaxFunc’s fate—
cfg.Max now sets the rate.
Thump-thump! Ship it—iterate. 🐇✨
Pre-merge checks and finishing touches
❌ Failed checks (3 warnings)
| Check name | Status | Explanation | Resolution |
|---|---|---|---|
| Linked Issues Check | ⚠️ Warning | The PR successfully integrates automated generation of documentation via gomarkdoc across the /docs directories, fulfilling the primary objective of issue #2401 to auto-generate all docs. However, it does not implement support for Go example tests that verify code examples as required by the linked issue, leaving that key requirement unaddressed. | Ensure that executable Go example tests are included or integrated into the documentation generation process so that code examples are verified as part of CI, fully satisfying the linked issue’s objectives. |
| Out of Scope Changes Check | ⚠️ Warning | Although the PR focuses on documentation generation, it also includes changes to core code files—such as modifications to middleware config defaults, comment edits in log/fiberlog.go, and default logic adjustments in limiter/config.go—that are unrelated to the linked issue’s objectives. These code updates risk unintended side effects and lie outside the intended scope of this documentation-only change. | Review and isolate code changes unrelated to documentation generation into separate pull requests, ensuring this PR contains only the documentation updates intended by the linked issue. |
| Description Check | ⚠️ Warning | The PR description begins with a high-level summary and references the linked issue and directories changed, but it leaves most checklist items as placeholders and does not detail the specific documentation updates or benefits. The template’s “Changes introduced” section remains mostly empty and lacks links to modified files, migration guidance, or examples. It omits any information on changelog entries, API alignment, and executable examples, failing to meet the template requirements. | The description should be revised to remove unused checklist items, provide concrete summaries of the documentation changes with links to affected files, and add any relevant sections for changelog entries, migration guides, and example tests to fully comply with the project’s description template. |
✅ Passed checks (2 passed)
| Check name | Status | Explanation |
|---|---|---|
| Title Check | ✅ Passed | The title succinctly indicates that documentation for the framework was auto-generated and aligns with the main change of updating /docs/addon, /docs/api, and /docs/middleware. It references the automated process via gomarkdoc, matching the linked issue’s objective. Although it includes an emoji, it is otherwise clear and specific. It avoids listing file details and remains concise. |
| Docstring Coverage | ✅ Passed | Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. |
✨ Finishing touches
- [ ] 📝 Generate docstrings
🧪 Generate unit tests (beta)
- [ ] Create PR with unit tests
- [ ] Post copyable unit tests in a comment
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.
Comment @coderabbitai help to get the list of available commands and usage tips.
Codecov Report
:white_check_mark: All modified and coverable lines are covered by tests.
:white_check_mark: Project coverage is 91.73%. Comparing base (c2062a2) to head (5315f9c).
:warning: Report is 7 commits behind head on main.
Additional details and impacted files
@@ Coverage Diff @@
## main #3793 +/- ##
=======================================
Coverage 91.73% 91.73%
=======================================
Files 113 113
Lines 11966 11966
=======================================
Hits 10977 10977
Misses 727 727
Partials 262 262
| Flag | Coverage Δ | |
|---|---|---|
| unittests | 91.73% <ø> (ø) |
Flags with carried forward coverage won't be shown. Click here to find out more.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
:rocket: New features to boost your workflow:
- :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
This is great as a first pass (though gomarkdown?), but even better would be having this integrate the way swaggo does so you get a nice web interface and interactive web interface to the api (example here, though mine is generated from swaggo and lotsa comment directives in the code).
https://coma.ifa.hawaii.edu/docs
Note this uses swagger under the hood, which I baked into the Go API with swaggo and the following in the docker build
# swagger doc
RUN go install github.com/swaggo/swag/cmd/swag@latest
RUN /go/bin/swag init --parseDependency --parseInternal --parseDepth 1 -g main.go
it is something that should be automated for all Go APIs (imho). This is actually a killer feature in FastAPI in Python.
@wakatara Unrelated, this is for generating documentation for the framework.
Old manually generated docs are stored in /docs/legacy/ for reference. We can remove it if required
@Ayanrocks Thanks for your efforts. Could you please overwrite the current documents with the generated ones, i.e. put them in the same folder and not in two separate folders? Otherwise, it is not easy to see what has changed in the pull request, and you have to laboriously compare the files from the legacy folder with the newly generated ones by hand.
We also need to make sure that we include the examples and additional information in the Go doc comments so that the final documentation is very very very close to the current one (as we have already optimised this for consumers over the years and a different structure would raise the old questions again).
Perhaps we could also do something with templates and thus bring the information for the various files into the same form.
Therefore, I would expect that the information from the current markdown files that is missing from the Go doc comments will be transferred to the Go files so that, in the end, there should be almost no changes visible in the markdown files in the pull request.
@ReneWerner87 We probably need a command in the Makefile.
Later on a CI workflow to run this automatically after each merged to main
@Ayanrocks Thank you for all your work. Could you try placing the output in the original folder so that we can compare the differences with your generation and move forward?