Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
OpenAPI.Generate.Monad
Description
Synopsis
- data GeneratorEnvironment = GeneratorEnvironment {}
- newtype Generator a = Generator {}
- runGenerator :: GeneratorEnvironment -> Generator a -> (a, LogEntries)
- createEnvironment :: Settings -> ReferenceMap -> GeneratorEnvironment
- logMessage :: LogSeverity -> Text -> Generator ()
- logError :: Text -> Generator ()
- logWarning :: Text -> Generator ()
- logInfo :: Text -> Generator ()
- logTrace :: Text -> Generator ()
- nested :: Text -> Generator a -> Generator a
- resetPath :: [Text] -> Generator a -> Generator a
- getCurrentPath :: Generator [Text]
- appendToPath :: [Text] -> Generator [Text]
- adjustSettings :: (Settings -> Settings) -> Generator a -> Generator a
- createReferenceLookupM :: (Text -> ReferenceMap -> Maybe a) -> Text -> Generator (Maybe a)
- getSchemaReferenceM :: Text -> Generator (Maybe SchemaObject)
- getResponseReferenceM :: Text -> Generator (Maybe ResponseObject)
- getParameterReferenceM :: Text -> Generator (Maybe ParameterObject)
- getExampleReferenceM :: Text -> Generator (Maybe ExampleObject)
- getRequestBodyReferenceM :: Text -> Generator (Maybe RequestBodyObject)
- getHeaderReferenceM :: Text -> Generator (Maybe HeaderObject)
- getSecuritySchemeReferenceM :: Text -> Generator (Maybe SecuritySchemeObject)
- getSettings :: Generator Settings
- getSetting :: (Settings -> a) -> Generator a
Documentation
data GeneratorEnvironment Source #
The reader environment of the Generator
monad
The generatorEnvironmentCurrentPath
is updated using the nested
function to track the current position within the specification.
This is used to produce tracable log messages.
The generatorEnvironmentReferences
map is a lookup table for references within the OpenAPI specification.
Constructors
GeneratorEnvironment | |
Instances
Show GeneratorEnvironment Source # | |
Defined in OpenAPI.Generate.Monad Methods showsPrec :: Int -> GeneratorEnvironment -> ShowS # show :: GeneratorEnvironment -> String # showList :: [GeneratorEnvironment] -> ShowS # | |
Eq GeneratorEnvironment Source # | |
Defined in OpenAPI.Generate.Monad Methods (==) :: GeneratorEnvironment -> GeneratorEnvironment -> Bool # (/=) :: GeneratorEnvironment -> GeneratorEnvironment -> Bool # | |
MonadReader GeneratorEnvironment Generator Source # | |
Defined in OpenAPI.Generate.Monad Methods ask :: Generator GeneratorEnvironment # local :: (GeneratorEnvironment -> GeneratorEnvironment) -> Generator a -> Generator a # reader :: (GeneratorEnvironment -> a) -> Generator a # |
The Generator
monad is used to pass a Reader
environment to functions in need of resolving references
and collects log messages.
Constructors
Generator | |
Fields |
Instances
Applicative Generator Source # | |
Functor Generator Source # | |
Monad Generator Source # | |
MonadReader GeneratorEnvironment Generator Source # | |
Defined in OpenAPI.Generate.Monad Methods ask :: Generator GeneratorEnvironment # local :: (GeneratorEnvironment -> GeneratorEnvironment) -> Generator a -> Generator a # reader :: (GeneratorEnvironment -> a) -> Generator a # | |
MonadWriter LogEntries Generator Source # | |
Defined in OpenAPI.Generate.Monad Methods writer :: (a, LogEntries) -> Generator a # tell :: LogEntries -> Generator () # listen :: Generator a -> Generator (a, LogEntries) # pass :: Generator (a, LogEntries -> LogEntries) -> Generator a # |
runGenerator :: GeneratorEnvironment -> Generator a -> (a, LogEntries) Source #
Runs the generator monad within a provided environment.
createEnvironment :: Settings -> ReferenceMap -> GeneratorEnvironment Source #
Create an environment based on a ReferenceMap
and Settings
logMessage :: LogSeverity -> Text -> Generator () Source #
Writes a log message to a Generator
monad
nested :: Text -> Generator a -> Generator a Source #
This function can be used to tell the Generator
monad where in the OpenAPI specification the generator currently is
resetPath :: [Text] -> Generator a -> Generator a Source #
This function can be used to tell the Generator
monad where in the OpenAPI specification the generator currently is (ignoring any previous path changes)
getCurrentPath :: Generator [Text] Source #
adjustSettings :: (Settings -> Settings) -> Generator a -> Generator a Source #
Allows to adjust the settings for certain parts of the generation.
createReferenceLookupM :: (Text -> ReferenceMap -> Maybe a) -> Text -> Generator (Maybe a) Source #
Helper function to create a lookup function for a specific type
getSchemaReferenceM :: Text -> Generator (Maybe SchemaObject) Source #
Resolve a SchemaObject
reference from within the Generator
monad
getResponseReferenceM :: Text -> Generator (Maybe ResponseObject) Source #
Resolve a ResponseObject
reference from within the Generator
monad
getParameterReferenceM :: Text -> Generator (Maybe ParameterObject) Source #
Resolve a ParameterObject
reference from within the Generator
monad
getExampleReferenceM :: Text -> Generator (Maybe ExampleObject) Source #
Resolve a ExampleObject
reference from within the Generator
monad
getRequestBodyReferenceM :: Text -> Generator (Maybe RequestBodyObject) Source #
Resolve a RequestBodyObject
reference from within the Generator
monad
getHeaderReferenceM :: Text -> Generator (Maybe HeaderObject) Source #
Resolve a HeaderObject
reference from within the Generator
monad
getSecuritySchemeReferenceM :: Text -> Generator (Maybe SecuritySchemeObject) Source #
Resolve a SecuritySchemeObject
reference from within the Generator
monad
getSettings :: Generator Settings Source #
Get all settings passed to the program
getSetting :: (Settings -> a) -> Generator a Source #
Get a specific setting selected by f