Documentation
¶
Overview ¶
Package schematest provides assertions for the JSON schemas a plugin publishes, so that the fields a user configures in the Dev UI stay documented.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AssertDescribed ¶
AssertDescribed reports every property in schema, at any depth, that lacks a description or whose description does not end in a period.
Schema inference does not read Go doc comments: github.com/invopop/jsonschema runs without a comment map, so a field is described only by a struct tag. The Dev UI renders that description as the tooltip on the help icon beside the field, so a field without one offers the user no explanation at all.
name identifies the schema in failure messages, e.g. the middleware name.
func AssertNoInlineDescriptions ¶
AssertNoInlineDescriptions reports every `jsonschema:"description=..."` tag in the .go files directly under dir, which must instead be written as a `jsonschema_description` tag.
github.com/invopop/jsonschema splits the `jsonschema` tag on commas to separate its keywords, so an inline description silently loses everything from its first comma onward: `description=If true, descend into subdirectories.` reaches the schema as "If true". The dedicated tag is read whole, so punctuation needs no thought.
`json:"recursive,omitempty" jsonschema_description:"If true, descend into subdirectories."`
Both forms produce the same schema, and a field may carry the dedicated tag alongside a `jsonschema` tag holding other keywords such as an enum.
Unlike AssertDescribed, this reads the source rather than a published schema, so it also covers schemas a plugin never exposes as a descriptor, such as tool input types.
Types ¶
This section is empty.