Skip to main content

Crate apidoc

Crate apidoc 

Source
Expand description

apidoc runtime core: data model, distributed-slice fragment registry and endpoint aggregation. Attribute macros are re-exported from apidoc-macros.

Two things to know when consuming this crate:

  • Registration happens via linkme::distributed_slice, so crates that only register documentation (no other use of this crate) must be linked, not merely built; call any exported item from the crate root to force it.
  • The macros expand to paths like apidoc::DocFragment, so consumers must depend on linkme directly and re-export distributed_slice (this crate already re-exports it for convenience).

Modules§

auth
M6a: 密码鉴权(authcode token,对齐上游 apidoc-php)。 M6a 密码鉴权:逐行移植上游 apidoc-php 的 Auth.php(createToken / checkToken / verifyAuth / checkAuth)。
export
M5: markdown / typescript / swagger(OpenAPI3) 三种导出格式。 M5 导出:markdown / typescript / swagger(OpenAPI3)三种格式渲染。 各格式一个子模块,共享 helper 集中在本文件。

Structs§

ApiDoc
Final aggregated document (the shape of api.json).
ApidocConfig
Project-level configuration, combined with endpoints into the final output.
AppConfig
应用/版本配置树:key 为注解引用的唯一标识,title 为展示名,items 递归嵌套 版本,password 为该应用的独立访问密码(优先级高于全局密码,永不序列化)。
AppDoc
一个应用/版本节点:注解挂载的 endpoints + 递归子版本。
DocEndpoint
One documented HTTP endpoint, built by merging fragments with the same id.
DocExample
A documented example response body (shared by success / error).
DocFragmentEntry
One annotation: the endpoint id plus the annotated piece of documentation. seq is assigned by the macro at expansion time (source order) and is used by DocRegistry::collect to restore declaration order, since linkme’s linker-section iteration order is not source order.
DocHeader
Request header documentation, e.g. #[apidoc::header(name = "X-Token")].
DocParam
A documented parameter (body param, query string field or return field).
DocRegistry
Collects and merges all registered fragments into per-endpoint documents.

Enums§

DocFragment
A single annotation payload.

Constants§

UI_HTML
共享文档 UI(axum/actix 适配器 include_str! 自本 crate,发布打包安全)。 ui.html 为标记与样式、ui.js 为核心脚本、ui.debug.js 为在线调试面板, 编译期拼接为完整 HTML(同一