Documentation
¶
Index ¶
- Constants
- func RenderJSON(w io.Writer, report Report, pretty bool) error
- func RenderMarkdown(w io.Writer, report Report) error
- func RenderPDF(w io.Writer, report Report, options PDFOptions) error
- func RenderText(w io.Writer, report Report) error
- type CheckResult
- type InputInfo
- type Issue
- type Mode
- type Option
- func WithCheckDigest(value bool) Option
- func WithFailOnWarning(value bool) Option
- func WithMaxEntries(value int) Option
- func WithMaxErrors(value int) Option
- func WithMaxFileSize(value int64) Option
- func WithMaxInputSize(value int64) Option
- func WithMaxTotalSize(value int64) Option
- func WithMaxXMLBytes(value int64) Option
- func WithMaxXMLDepth(value int) Option
- func WithMaxXMLNodes(value int) Option
- func WithMode(value Mode) Option
- func WithScanXML(value bool) Option
- func WithSchemas(value *schema.Set) Option
- func WithSkipXSD(value bool) Option
- type Options
- type PDFOptions
- type Report
- type Severity
- type Stage
- type Status
- type Summary
- type ToolInfo
- type Validator
Constants ¶
View Source
const ToolVersion = "0.1.0"
ToolVersion 是校验器报告中的工具版本。
Variables ¶
This section is empty.
Functions ¶
func RenderJSON ¶
RenderJSON 将报告编码为 JSON;英文枚举用于机器处理,*_zh 字段提供中文标签。
func RenderMarkdown ¶
RenderMarkdown 将报告输出为中文 Markdown。
Types ¶
type CheckResult ¶
type CheckResult struct {
Name string `json:"name"`
NameZh string `json:"name_zh,omitempty"`
Status string `json:"status"`
StatusZh string `json:"status_zh,omitempty"`
}
CheckResult 描述一个校验阶段的结果。
type Issue ¶
type Issue struct {
Severity Severity `json:"severity"`
SeverityZh string `json:"severity_zh,omitempty"`
Stage Stage `json:"stage"`
StageZh string `json:"stage_zh,omitempty"`
Code string `json:"code"`
EngineCode string `json:"engine_code,omitempty"`
Message string `json:"message"`
Hint string `json:"hint,omitempty"`
File string `json:"file,omitempty"`
Path string `json:"path,omitempty"`
Line int `json:"line,omitempty"`
Column int `json:"column,omitempty"`
}
Issue 描述一条可定位、可机器读取的校验问题。
type Option ¶
type Option func(*Options)
Option 修改校验器配置。
func WithMaxFileSize ¶
WithMaxFileSize 设置单个 ZIP 条目解压后的大小上限。
func WithMaxInputSize ¶
WithMaxInputSize 设置 ZIP 原始输入数据的大小上限;传入 0 表示不限制。
func WithMaxTotalSize ¶
WithMaxTotalSize 设置整个 OFD 包解压后的大小上限。
type Options ¶
type Options struct {
Mode Mode
MaxErrors int
MaxInputSize int64
MaxFileSize int64
MaxTotalSize int64
MaxEntries int
MaxXMLBytes int64
MaxXMLNodes int
MaxXMLDepth int
CheckXSD bool
ScanXML bool
CheckDigest bool
FailOnWarning bool
Schemas *schema.Set
}
Options 定义校验器的资源限制和检查开关。
type PDFOptions ¶
type PDFOptions struct {
// Font 指定报告使用的字体文件;未指定时自动查找支持中文的系统字体。
Font string
}
PDFOptions 配置 PDF 报告的字体。
type Report ¶
type Report struct {
SchemaVersion string `json:"schema_version"`
Tool ToolInfo `json:"tool"`
Input InputInfo `json:"input"`
Status Status `json:"status"`
StatusZh string `json:"status_zh,omitempty"`
Summary Summary `json:"summary"`
Checks []CheckResult `json:"checks"`
Issues []Issue `json:"issues"`
StartedAt time.Time `json:"started_at"`
DurationMS int64 `json:"duration_ms"`
}
Report 是校验器的统一报告模型。
type Summary ¶
type Summary struct {
Errors int `json:"errors"`
Warnings int `json:"warnings"`
Infos int `json:"infos"`
Files int `json:"files"`
}
Summary 汇总报告中的问题和文件数量。
type Validator ¶
type Validator struct {
// contains filtered or unexported fields
}
Validator 执行 OFD 容器、XML、XSD、引用和语义校验。
func (*Validator) ValidatePath ¶
ValidatePath 校验指定路径的 OFD 文件并返回完整报告。
Click to show internal directories.
Click to hide internal directories.