# `Alternera.Plugin.Editor.DefinitionVersion`
[🔗](https://github.com/10e-ab/alternera-sdk/blob/v0.9.0/alternera_plugin_editor/lib/alternera/plugin/editor/definition_version.ex#L1)

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.

# `suggestion`

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

An entry as the `SuggestInput` hook reads it.

# `draft?`

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

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

# `hints`

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`

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

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

# `versions`

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

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

---

*Consult [api-reference.md](api-reference.md) for complete listing*
