Alternera.Plugin.Editor.DefinitionVersion (alternera_plugin_editor v0.9.0)

Copy Markdown View Source

The Version field of a step that reads an API definition, or a schema namespace of one, as the step editors draw it: what its <.suggest_input> offers (suggestions/1), whether a version reads the draft (draft?/1) and the lines under it (hints/1).

The definition is an entry of the editor's api_definitions (Alternera.Plugin.Editor): versions its releases, highest first, and, where the page can open it, open_key (its Workbench tab) and href (the APIs tab, for a page without the Workbench). With them, the line for a definition with no releases links to it, where its Releases tab makes one.

Summary

Types

An entry as the SuggestInput hook reads it.

Functions

Whether version reads the draft: none, empty or draft.

The lines under a Version field: the newest releases; or, for a definition with none, that the step reads the draft, with a link to the definition; or, while a definition with releases is read as a draft, a warning naming a release to pick. id starts every DOM id (<id>-versions, <id>-versions-none, <id>-versions-open, <id>-version-draft); reads is the step's verb ("reads", "serves").

draft, then ^X.Y.Z and X.Y.Z for each release.

The releases of definition, highest first; [] for none or no definition.

Types

suggestion()

@type suggestion() :: %{value: String.t(), description: String.t()}

An entry as the SuggestInput hook reads it.

Functions

draft?(version)

@spec draft?(String.t() | nil) :: boolean()

Whether version reads the draft: none, empty or draft.

hints(assigns)

The lines under a Version field: the newest releases; or, for a definition with none, that the step reads the draft, with a link to the definition; or, while a definition with releases is read as a draft, a warning naming a release to pick. id starts every DOM id (<id>-versions, <id>-versions-none, <id>-versions-open, <id>-version-draft); reads is the step's verb ("reads", "serves").

Attributes

  • id (:string) (required)
  • definition (:map) - the entry, nil while none is found. Defaults to nil.
  • version (:string) - Defaults to nil.
  • reads (:string) - Defaults to "reads".

suggestions(versions)

@spec suggestions([String.t()]) :: [suggestion()]

draft, then ^X.Y.Z and X.Y.Z for each release.

versions(definition)

@spec versions(map() | nil) :: [String.t()]

The releases of definition, highest first; [] for none or no definition.