Documentation
¶
Overview ¶
Package ghcontract pins the forge client's `--json` field lists, so a test's fake forge client refuses a field the real one refuses.
The problem it closes: `abcd land` asked `gh pr view --json` for isInMergeQueue, a field gh has no such name for, and a fake forge that answered any field hid it; every real queue confirmation failed. The lists here are gh's own, as `gh pr view --json`, `gh pr list --json` (the same set) and `gh repo view --json` print them with no value, under gh-2.100.0/. Refresh them by running those three commands with a newer gh.
It pins the forge's GraphQL fields the same way (graphql-fields.txt, read by introspection), and CheckGraphQL refuses a query selecting a field its type does not have, so a renamed or mistyped field in a query abcd sends fails a test rather than the real forge.
It is a test-support package, as gittest is: production code never imports it.
Index ¶
Constants ¶
const Version = "2.100.0"
Version is the gh release the lists were read from.
Variables ¶
This section is empty.
Functions ¶
func Check ¶
Check refuses a forge client call (gh's arguments) whose `--json` or `--json=` names a field gh does not take for that command, as gh does, and a `--json` on a command whose list is not pinned. A call with no `--json` passes.
func CheckGraphQL ¶
CheckGraphQL refuses a GraphQL query that selects a field its type does not have in the pinned schema, as the forge refuses it. It parses the shape abcd's queries take, and refuses any other: an optional `query` keyword, name and variable definitions, then nested selections of plain fields, each with optional arguments, and inline fragments (`... on Type { }`) on a union the type is pinned to be, or on the selection's own type. An alias (`p12: pullRequest(number:12)`) is read past to the field it names, which is checked as any other. `__typename`, the meta-field every selection may take, is read bare (no alias, arguments or selection). A named fragment, a directive or a mutation is refused as not parsed rather than passed unchecked; arguments are not checked.
func Fields ¶
Fields is the `--json` field list gh takes for the command named by the first two arguments ("pr view", "pr list", "repo view"), or nil for a command whose list is not pinned here.
func GraphQLField ¶
GraphQLField reports the named type of field on the forge's GraphQL type typ, and whether the pinned schema has that field.
Types ¶
This section is empty.