Documentation
¶
Overview ¶
Package contractscan discovers runtime contract registrations in normal Go source using the standard Go AST.
Index ¶
- Constants
- func AsyncAPIPayload(report Report, options AsyncAPIOptions) ([]byte, error)
- func LinkReferences(refs []gwdkir.ContractReference, report Report) []gwdkir.ContractReference
- func WriteAsyncAPI(outputDir string, report Report, options AsyncAPIOptions) (string, error)
- type AsyncAPIOptions
- type Contract
- type Diagnostic
- type EventRef
- type Report
Constants ¶
View Source
const AsyncAPIFile = "asyncapi.json"
View Source
const RuntimeImportPath = "github.com/cssbruno/gowdk/runtime/contracts"
Variables ¶
This section is empty.
Functions ¶
func AsyncAPIPayload ¶ added in v0.3.0
func AsyncAPIPayload(report Report, options AsyncAPIOptions) ([]byte, error)
func LinkReferences ¶
func LinkReferences(refs []gwdkir.ContractReference, report Report) []gwdkir.ContractReference
func WriteAsyncAPI ¶ added in v0.3.0
func WriteAsyncAPI(outputDir string, report Report, options AsyncAPIOptions) (string, error)
Types ¶
type AsyncAPIOptions ¶ added in v0.3.0
type AsyncAPIOptions struct {
IncludeDomainEvents bool
}
type Contract ¶
type Contract struct {
Kind runtimecontracts.Kind `json:"kind"`
EventCategory runtimecontracts.EventCategory `json:"eventCategory,omitempty"`
Package string `json:"package,omitempty"`
Type string `json:"type"`
TypeImportPath string `json:"typeImportPath,omitempty"`
Result string `json:"result,omitempty"`
ResultImportPath string `json:"resultImportPath,omitempty"`
Handler string `json:"handler,omitempty"`
Register string `json:"register,omitempty"`
InputFields []source.BackendInputField `json:"inputFields,omitempty"`
PayloadFields []source.BackendInputField `json:"payloadFields,omitempty"`
Emits []EventRef `json:"emits,omitempty"`
Roles []string `json:"roles,omitempty"`
Source string `json:"source"`
Line int `json:"line"`
Column int `json:"column"`
}
Contract describes one discovered registration call.
type Diagnostic ¶
type Diagnostic struct {
Severity string `json:"severity"`
Code string `json:"code,omitempty"`
Kind runtimecontracts.Kind `json:"kind,omitempty"`
Package string `json:"package,omitempty"`
Type string `json:"type,omitempty"`
TypeImportPath string `json:"typeImportPath,omitempty"`
Handler string `json:"handler,omitempty"`
Source string `json:"source"`
Line int `json:"line"`
Column int `json:"column"`
Message string `json:"message"`
}
Diagnostic describes a validation issue found while scanning contracts.
type EventRef ¶
type EventRef struct {
Category runtimecontracts.EventCategory `json:"category"`
Type string `json:"type"`
TypeImportPath string `json:"typeImportPath,omitempty"`
}
EventRef describes one event a command handler can emit.
type Report ¶
type Report struct {
Version int `json:"version"`
Root string `json:"root"`
Contracts []Contract `json:"contracts"`
Diagnostics []Diagnostic `json:"diagnostics,omitempty"`
}
Report is the full discovery output.
Click to show internal directories.
Click to hide internal directories.