diff options
Diffstat (limited to 'frontend')
-rw-r--r-- | frontend/app/Schema.hs | 31 |
1 files changed, 18 insertions, 13 deletions
diff --git a/frontend/app/Schema.hs b/frontend/app/Schema.hs index 8c02a1a..cae9ed6 100644 --- a/frontend/app/Schema.hs +++ b/frontend/app/Schema.hs @@ -70,19 +70,24 @@ viewSchema :: Schema -> View action viewSchema schema = ol_ [] $ ( \(k, v) -> - li_ [] $ - [ text (toMisoString k), - text ":", - text - ( case v of - Type "string" (Just "date-time") -> "datetime" - Type v Nothing -> toMisoString v - Type v (Just f) -> toMisoString v <> " (" <> f <> ")" - Reference v -> "reference to " <> toMisoString v - Union vs -> Miso.String.intercalate " or " vs - ), - text (if k `S.member` schema.required then "" else "?") - ] + let v' = case v of + Type "string" (Just "date-time") -> "datetime" + Type v Nothing -> toMisoString v + Type v (Just f) -> toMisoString v <> " (" <> f <> ")" + Reference v -> "reference to " <> toMisoString v + Union vs -> Miso.String.intercalate " or " vs + required = k `S.member` schema.required + in li_ [] $ + [ text (toMisoString k), + text + ( ":" + <> ( if ' ' `T.elem` fromMisoString v' && not required + then "(" <> v' <> ")" + else v' + ) + <> (if required then "" else "?") + ) + ] ) <$> (M.toList schema.properties) |