Documentation
¶
Overview ¶
Package rpcschema is the schema snapshot of the functions an app serves to other apps: the input and output type of each function, and the number each field of those types has on the wire. An app's own snapshot is .aicoded/rpc.json; an app that calls it holds a copy in .aicoded/services/<app>.json.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Break ¶
type Break struct {
Method, Path, Reason string
}
Break is one change in a schema that breaks calls made with an older snapshot of it. Path is the field, such as GetInvoiceIn.Lines[].Amount; it is empty for a removed function.
func Compatible ¶
Compatible returns the changes in current that break calls made with the snapshot held: a removed function, and any field reachable from a function's input or output that was removed, renamed, renumbered or given another type. Added functions and fields break nothing. Type names may change. The breaks are sorted by function, then path.
type Field ¶
Field is one field of a type. Type is bool, int32, int64, uint32, uint64, float32, float64, string, bytes, time or the name of a type of the schema; "[]" and one of those for a slice; or "*" and one of those except bytes for an optional value.
type Schema ¶
type Schema struct {
App string `json:"app"`
Methods map[string]Method `json:"methods"`
Types map[string]Type `json:"types"`
}
Schema is the snapshot of one app's functions.
func Number ¶
Number returns fresh with its field numbers set; fresh's own numbers are ignored. A field keeps the number prev gives it under the same type and field name. A new field gets one more than the highest number its type has ever used. The number of a field prev has and fresh does not is retired for good. Types no function reaches are left out. prev may be nil.
func Parse ¶
Parse reads the snapshot data, read from path. It refuses anything aicoded does not write with E-RPC-005 at path:line: invalid JSON, an unknown or repeated key, a missing or invalid name, a bad type, a reference to a type the snapshot does not have, and a field number that is not valid, is used twice in a type or is also retired.