diff --git a/app/doc/Swarm/Doc/Schema/Refined.hs b/app/doc/Swarm/Doc/Schema/Refined.hs index afaee625c6..45da096f3a 100644 --- a/app/doc/Swarm/Doc/Schema/Refined.hs +++ b/app/doc/Swarm/Doc/Schema/Refined.hs @@ -87,6 +87,7 @@ getSchemaReferences = \case Alternatives xs -> concatMap getSchemaReferences xs Reference x -> pure x ListOf x -> getSchemaReferences x + EnumList _ -> [] -- | A subset of all JSON schemas, conforming to internal Swarm conventions. -- diff --git a/app/doc/Swarm/Doc/Schema/Render.hs b/app/doc/Swarm/Doc/Schema/Render.hs index 678ee59fb8..82bde7cc50 100644 --- a/app/doc/Swarm/Doc/Schema/Render.hs +++ b/app/doc/Swarm/Doc/Schema/Render.hs @@ -14,6 +14,7 @@ import Control.Monad.IO.Class (liftIO) import Control.Monad.Trans.Except (except) import Data.Aeson import Data.List (intersperse) +import Data.List.NonEmpty qualified as NE import Data.Map (Map) import Data.Map.Strict qualified as M import Data.Maybe (fromMaybe) @@ -176,6 +177,7 @@ listToText titleMap = \case Alternatives xs -> renderAlternatives $ map (listToText titleMap) xs Reference r@(SchemaIdReference x) -> schemaLink r x ListOf x -> listToText titleMap x <> text " list" + EnumList xs -> renderAlternatives $ NE.toList $ text <$> xs where renderAlternatives = mconcat . intersperse (text " or ") schemaLink r = link (fragmentHref titleMap r) "Link to object properties" . text diff --git a/app/doc/Swarm/Doc/Schema/SchemaType.hs b/app/doc/Swarm/Doc/Schema/SchemaType.hs index 4f85397ef2..f6a9a57ef0 100644 --- a/app/doc/Swarm/Doc/Schema/SchemaType.hs +++ b/app/doc/Swarm/Doc/Schema/SchemaType.hs @@ -6,6 +6,7 @@ module Swarm.Doc.Schema.SchemaType where import Control.Applicative ((<|>)) import Data.Aeson +import Data.List.NonEmpty (NonEmpty) import Data.Text (Text) import Data.Text qualified as T import System.FilePath (takeBaseName) @@ -29,6 +30,7 @@ data SchemaType Reference SchemaIdReference | -- | Members of a list, all of the given schema type ListOf SchemaType + | EnumList (NonEmpty Text) deriving (Eq, Ord, Show) newtype SchemaIdReference = SchemaIdReference Text