Skip to content

Commit a550fa9

Browse files
committed
Use let binding to avoid repetition
1 parent a4a74fd commit a550fa9

1 file changed

Lines changed: 10 additions & 10 deletions

File tree

src/Orb/OpenApi.hs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1143,30 +1143,30 @@ instance FC.Fleece FleeceOpenApi where
11431143
interpretValidateNamed name _uncheck _check (FC.Schema _unvalidatedName (FleeceOpenApi mkErrOrSchemaInfo)) = do
11441144
FleeceOpenApi $ \path -> do
11451145
schemaInfo <- mkErrOrSchemaInfo (addSchemaToPath name path)
1146+
let
1147+
key = Just $ fleeceNameToOpenApiKey name
1148+
schemaWithTitle =
1149+
(openApiSchema schemaInfo)
1150+
{ OpenApi._schemaTitle = key
1151+
}
11461152

11471153
if schemaIsPrimitive schemaInfo
11481154
then do
11491155
components <- collectComponents [schemaInfo]
11501156
pure $
11511157
schemaInfo
11521158
{ fleeceName = name
1153-
, openApiKey = Just . fleeceNameToOpenApiKey $ name
1159+
, openApiKey = key
11541160
, openApiNullable = False
11551161
, schemaComponents = components
1156-
, openApiSchema =
1157-
(openApiSchema schemaInfo)
1158-
{ OpenApi._schemaTitle = Just $ fleeceNameToOpenApiKey name
1159-
}
1162+
, openApiSchema = schemaWithTitle
11601163
}
11611164
else
11621165
pure $
11631166
schemaInfo
11641167
{ fleeceName = name
1165-
, openApiKey = Just . fleeceNameToOpenApiKey $ name
1166-
, openApiSchema =
1167-
(openApiSchema schemaInfo)
1168-
{ OpenApi._schemaTitle = Just $ fleeceNameToOpenApiKey name
1169-
}
1168+
, openApiKey = key
1169+
, openApiSchema = schemaWithTitle
11701170
}
11711171

11721172
interpretValidateAnonymous _uncheck _check (FC.Schema _name (FleeceOpenApi errOrSchemaInfo)) = do

0 commit comments

Comments
 (0)