Lunny Xiaoandbircni 3258717d62 fix(api): show the name of a type in the reference, document the gmail app password (#541)
Two unrelated but small fixes, closes #258 and closes #32.

**The reference does not name its types (#258)**

Since the api reference is rendered from the openapi 3.0 document, a field of type `ReviewStateType` is rendered as the bare string enum the `$ref` points at: starlight-openapi dereferences everything and the schema has no `title`, so the name of the type is nowhere on the page. Searching the current reference for `ReviewStateType` returns nothing, which is what the issue reports (the plugin also has no route for `components/schemas`, so there is no page per type either).

`normalizeSchema()` now titles every named schema of an openapi 3.0 document with its own name, which the plugin renders next to the type of a field:

- before: `state` · `string` · Allowed values: APPROVED …
- after: `state` · `ReviewStateType` · `string` · Allowed values: APPROVED …

The go doc comments start with the name of the type, so the description would repeat it ("ChangeFilesOptions — ChangeFilesOptions options for creating …"); a leading `<name> ` is stripped from the description.

For the record, how the three generations of documents describe that type:

| Versions | Type name | Allowed values |
| --- | --- | --- |
| 1.22 – 1.25 (swagger, `ReviewStateType` definition without `enum`) | shown | missing |
| 1.26 – 1.27 (swagger, enum inlined upstream) | missing | shown |
| 1.27, next (openapi 3.0, with this change) | shown | shown |

The released swagger documents are frozen, so 1.22 – 1.26 keep what they have; from 1.27 on the reference answers the question the issue asks.

**Gmail needs an app password (#32)**

The configuration in the guide is still correct after Google turned off password-only access, because it already asks for an app password. What was missing is why there is no alternative: Gitea's mailer authenticates with `CRAM-MD5`, `PLAIN` or `LOGIN` and has no XOAUTH2, so "Sign in with Google" is not an option. Added that, together with the two things people run into — an app password needs 2-step verification and a Workspace administrator can disable app passwords for the domain — and the `587` + `smtp+starttls` variant.

Verified by building the api and the next docs: the type names show up on the operation pages, the descriptions are not duplicated, and 1.26 and older are unchanged. `pnpm check` passes.

<!-- cloudflare-preview --> Preview: https://pr-541.docs-gitea-com.pages.dev

---------

Co-authored-by: bircni <[email protected]>
Reviewed-on: https://gitea.com/gitea/docs/pulls/541
Reviewed-by: bircni <[email protected]>
Co-authored-by: Lunny Xiao <[email protected]>
2026-09-12 11:27:21 +00:00
2023-07-28 05:52:35 +00:00
2026-08-29 19:59:27 +00:00

Gitea Docs badge

The sources of docs.gitea.com, built with Astro and Starlight.

The site covers three products, all served from this repository:

Product Content Versions Languages
Docs docs/, versioned_docs/, i18n/ next, 1.27 … 1.22 English, 简体中文, 繁體中文
API static/swagger-*.json, static/openapi3-*.json next, 1.27 … 1.22 English
Runner runner-docs/, runner-docs_versioned_docs/ develop, 3 … 0 English

The enterprise documentation is built and deployed from its own repository and reached through /enterprise/, which a Cloudflare worker maintained elsewhere routes to that deployment.

Development

make install       # pnpm install
make serve-fast    # english, the version served at the root, starts in seconds
make serve         # the whole matrix, every version and language
make build         # production build into sites/docs/dist
make check         # type checks the site and its components

Search is built by Pagefind while the site is built, so it only answers on the built site: use make serve-built to try it. With the Algolia credentials (PUBLIC_DOCSEARCH_APP_ID, PUBLIC_DOCSEARCH_API_KEY) set, DocSearch is used instead and works in make serve too.

GITEA_DOCS_PRODUCTS, GITEA_DOCS_VERSIONS and GITEA_DOCS_LOCALES (comma separated) restrict what is built, which is what make serve-fast uses. GITEA_DOCS_STRICT_LINKS=true turns the warnings about unresolved relative markdown links into a build error.

sites/docs/README.md documents how the sources are mapped onto the site.

Writing

Pages are plain markdown with the same frontmatter and admonitions as before: frontmatter slug, sidebar_position and sidebar_label keep working, and so do the :::note style admonitions and the @version@ style release variables. Relative *.md links are rewritten to urls while the site is built.

The order of the top level sidebar groups comes from sidebars.js (and versioned_sidebars/ for released versions), the label and order of every other group from the _category_.json of its directory.

Cutting a version

make cut-version PRODUCT=docs VERSION=1.28
make cut-version PRODUCT=runner VERSION=4

This freezes the current tree, its translations and its sidebar. The label of the version, its release variables (@version@, @dockerVersion@, ...) and which version is served at the root live in packages/content-loader/src/products.ts and are edited by hand afterwards. That file is the single source of truth for the product, version and language matrix.

API docs

The definitions rendered under /api/ live in static/: swagger-latest.json (gitea main) and swagger-<minor>.json (released versions) hold the swagger 2.0 document every gitea version ships, openapi3-latest.json and openapi3-<minor>.json the openapi 3.0 document gitea generates since 1.27. The openapi 3.0 document is what gets rendered where it exists, and both are offered for download on the overview page of the version, since code generators cannot read the rendered pages (and several of them reject swagger 2.0).

make update-api-docs         # refresh latest + every released version
make update-api-docs-latest  # refresh only the documents of gitea main

The documents of gitea main are refreshed automatically: the update api spec files workflow runs every 12 hours and opens a pull request whenever gitea main changed. Released versions are updated by hand when a new gitea version is documented.

Runner docs

Version Content URL
develop runner-docs/ /runner/develop/
current series runner-docs_versioned_docs/version-3/ /runner/
older series runner-docs_versioned_docs/version-2/ /runner/2/

A version directory covers a whole release series (version-3 documents every 3.x release), so a patch release only needs a content update, not a new folder. Use floating image tags (gitea/runner:3) and links to the runner's main branch in those pages to keep them valid across patch releases.

Its sidebar is written by hand: runner-sidebars.js for develop, and runner-docs_versioned_sidebars/version-<version>-sidebars.json per documented version.

The pages under reference/ are generated from the runner sources — the command line reference from --help, the example configuration from generate-config:

make update-runner-docs           # develop docs, from the main branch of gitea/runner
make update-runner-docs-released  # every series, from its newest stable tag
./update_runner_docs.sh v3.0.2 runner-docs_versioned_docs/version-3/reference

These are refreshed automatically as well: the update runner reference workflow runs weekly and opens a pull request whenever the runner's CLI or example configuration changed. Generating them needs Go, since the script builds the runner binary.

Deployment

main is built and published by the Build and Publish Docs site workflow, to S3/CloudFront and to Cloudflare Pages. cloudflare/_headers sets the cache policy and cloudflare/_redirects keeps the urls the site used to serve; both are copied next to the build output by that workflow. cloudflare/docsearch-crawler.json is the Algolia crawler configuration.

/enterprise/ is served by another deployment and routed to it by a Cloudflare worker that lives outside this repository.

S
Description
No description provided
Readme Apache-2.0
9.6 MiB
Languages
TypeScript 42.4%
MDX 30.9%
Astro 8.1%
JavaScript 6.4%
Shell 6%
Other 6.2%