openapi3-code-generator-0.1.0.3: OpenAPI3 Haskell Client Code Generator

Safe HaskellNone
LanguageHaskell2010

OpenAPI.Generate.Doc

Description

Utility functions for Doc manipulation

Synopsis

Documentation

emptyDoc :: Applicative f => f Doc Source #

Empty document inside an Applicative (typically Q)

appendDoc :: Applicative f => f Doc -> f Doc -> f Doc Source #

Append a Doc to another inside an Applicative (typically Q)

generateHaddockComment :: [Text] -> Doc Source #

Generate a Haddock comment with multiple lines

escapeText :: Text -> Text Source #

Escape text for use in Haddock comment

breakOnTokens :: [Text] -> Doc -> Doc Source #

Add line breaks to a Doc at all occurrences of the passed tokens (removes all other line breaks).

breakOnTokensWithReplacement :: (Text -> Text) -> [Text] -> Doc -> Doc Source #

Add line breaks to a Doc at all occurrences of the passed tokens (removes all other line breaks). The replacement function is used to generate the text replacing the tokens.

sideComments :: [Text] -> Doc Source #

Convert a list of lines to side comments

zipCodeAndComments :: [Text] -> [Text] -> Doc Source #

Intertwine code lines with comment lines

The code lines should have one more line (the first line is not commented)

sideBySide :: Doc -> Doc -> Doc Source #

Place two documents side-by-side, aligned at the top line

If one of the documents is longer than the other, the shorter one is extended with empty lines. The lines of the right document are aligned in the same column, no matter if the left document is shorter or longer

Example usage:

>>> show $ sideBySide (text "a") (text "b" $$ text "c")
a b
  c

addOperationsModuleHeader :: String -> String -> String -> Doc -> Doc Source #

Add the module header to a module of an operation

addSecuritySchemesModuleHeader :: String -> Doc -> Doc Source #

Add the module header to the security scheme module

addConfigurationModuleHeader :: String -> Doc -> Doc Source #

Add the module header to the configuration module

createModuleHeaderWithReexports :: String -> [String] -> String -> Doc Source #

Create a Doc containing a module which imports other modules and re-exports them

addModelModuleHeader :: String -> String -> [String] -> String -> Doc -> Doc Source #

Add the module header to a module of a model