Documentation
¶
Index ¶
- Constants
- func BuildRouteKey(method, path string) string
- func DispatchJSON(body []byte) []byte
- func ExtractRouteMethodNames(files []ThriftSourceFile) map[string]string
- func FormatValidationIssues(issues []ValidationIssue) string
- func NormalizeRoutePath(path string) string
- func RenderThrift(document ThriftDocument) string
- type BridgeError
- type BridgeRequest
- type BridgeResponse
- type Kind
- type ProjectionError
- type ProjectionOptions
- type ProjectionResult
- type Property
- type ThriftDocument
- type ThriftField
- type ThriftMethod
- type ThriftSourceFile
- type ThriftStruct
- type ValidationError
- type ValidationIssue
- type ValidationOptions
- type ValidationResult
- type Value
- func (v *Value) Clone() *Value
- func (v *Value) Entries() []Property
- func (v *Value) Get(key string) *Value
- func (v *Value) Has(key string) bool
- func (v *Value) Is(kind Kind) bool
- func (v *Value) List() []*Value
- func (v *Value) MarshalJSON() ([]byte, error)
- func (v *Value) Set(name string, value *Value)
- func (v *Value) Str() string
- func (v *Value) Truth() bool
Constants ¶
const ProfileApifoxHzThrift = "apifox-hz-thrift"
Variables ¶
This section is empty.
Functions ¶
func BuildRouteKey ¶
func DispatchJSON ¶
func ExtractRouteMethodNames ¶
func ExtractRouteMethodNames(files []ThriftSourceFile) map[string]string
func FormatValidationIssues ¶
func FormatValidationIssues(issues []ValidationIssue) string
func NormalizeRoutePath ¶
func RenderThrift ¶
func RenderThrift(document ThriftDocument) string
Types ¶
type BridgeError ¶
type BridgeError struct {
Name string `json:"name"`
Message string `json:"message"`
Pointer string `json:"pointer,omitempty"`
Issues []ValidationIssue `json:"issues,omitempty"`
}
type BridgeRequest ¶
type BridgeRequest struct {
Action string `json:"action"`
Input json.RawMessage `json:"input,omitempty"`
Options json.RawMessage `json:"options,omitempty"`
Files []ThriftSourceFile `json:"files,omitempty"`
Method string `json:"method,omitempty"`
Path string `json:"path,omitempty"`
Issues []ValidationIssue `json:"issues,omitempty"`
}
BridgeRequest is the browser/WASM wire boundary. All actual conversion and validation remains in the native core; no JavaScript projection is shipped.
type BridgeResponse ¶
type BridgeResponse struct {
Result json.RawMessage `json:"result,omitempty"`
Error *BridgeError `json:"error,omitempty"`
}
type ProjectionError ¶
type ProjectionError struct {
Message string `json:"message"`
Pointer string `json:"pointer,omitempty"`
}
func (*ProjectionError) Error ¶
func (e *ProjectionError) Error() string
type ProjectionOptions ¶
type ProjectionResult ¶
type ProjectionResult struct {
Document ThriftDocument `json:"document"`
Thrift string `json:"thrift"`
}
func Convert ¶
func Convert(input []byte, options ProjectionOptions) (ProjectionResult, error)
func ConvertDocument ¶
func ConvertDocument(document *Value, options ProjectionOptions) (ProjectionResult, error)
type ThriftDocument ¶
type ThriftDocument struct {
Namespace string `json:"namespace"`
ServiceName string `json:"serviceName"`
Definitions []ThriftStruct `json:"definitions"`
Methods []ThriftMethod `json:"methods"`
}
func Project ¶
func Project(document *Value, options ProjectionOptions) (ThriftDocument, error)
type ThriftField ¶
type ThriftMethod ¶
type ThriftSourceFile ¶
type ThriftStruct ¶
type ThriftStruct struct {
Name string `json:"name"`
Comment []string `json:"comment,omitempty"`
Fields []ThriftField `json:"fields"`
}
type ValidationError ¶
type ValidationError struct {
Issues []ValidationIssue `json:"issues"`
}
func (*ValidationError) Error ¶
func (e *ValidationError) Error() string
type ValidationIssue ¶
type ValidationOptions ¶
type ValidationResult ¶
type ValidationResult struct {
Profile string `json:"profile"`
Issues []ValidationIssue `json:"issues"`
ErrorCount int `json:"errorCount"`
WarningCount int `json:"warningCount"`
PathCount int `json:"pathCount"`
OperationCount int `json:"operationCount"`
SchemaCount int `json:"schemaCount"`
}
func AssertValid ¶
func AssertValid(document *Value, options ValidationOptions) (ValidationResult, error)
func Validate ¶
func Validate(input []byte, options ValidationOptions) (ValidationResult, error)
Validate checks the shared APIFox/Hertz/Thrift profile. It never fetches refs, executes mock scripts, or reads other files. Projection is checked by default.
func ValidateDocument ¶
func ValidateDocument(document *Value, options ValidationOptions) (ValidationResult, error)
type Value ¶
type Value struct {
Kind Kind
Text string
Number float64
Bool bool
Items []*Value
Fields []Property
// contains filtered or unexported fields
}
Value preserves object order, including ECMAScript's numeric-key ordering. This is part of the existing Thrift field-number contract, not cosmetic JSON formatting. Unknown OpenAPI extensions remain available to profile validation.
func Parse ¶
Parse accepts one JSON or YAML document, with a finite, bounded JSON data model. YAML aliases/merges resolve before validation; duplicate explicit keys and alias cycles are rejected instead of silently changing the contract.
func ParseOpenAPIDocument ¶
func (*Value) MarshalJSON ¶
Directories
¶
| Path | Synopsis |
|---|---|
|
cmd
|
|
|
browser-preview
command
browser-preview serves only the example and built browser assets on loopback.
|
browser-preview serves only the example and built browser assets on loopback. |
|
build-wasm
command
build-wasm creates browser artifacts from the same Go module as the CLI.
|
build-wasm creates browser artifacts from the same Go module as the CLI. |
|
openapi-thrift
command
|
|
|
openapi-thrift-wasm
command
|
|
|
release
command
release builds and verifies the artifacts shipped by the release workflow.
|
release builds and verifies the artifacts shipped by the release workflow. |
|
internal
|
|
|
cli
Package cli is the native command boundary; the reusable core has no file IO.
|
Package cli is the native command boundary; the reusable core has no file IO. |