@@ -201,6 +201,15 @@ inlineSchemas names = inlineSchemasWhen (`elem` names)
201201inlineAllSchemas :: Data s => Definitions -> s -> s
202202inlineAllSchemas = inlineSchemasWhen (const True)
203203
204+-- | Convert a type into a schema without references.
205+--
206+-- __WARNING:__ @'toInlinedSchema'@ will produce infinite schema
207+-- when inlining recursive schemas.
208+toInlinedSchema :: ToSchema a => proxy a -> Schema
209+toInlinedSchema proxy = inlineAllSchemas defs schema
210+ where
211+ (defs, schema) = runDeclare (declareSchema proxy) mempty
212+
204213-- | Inline all /non-recursive/ schemas for which the definition
205214-- can be found in @'Definitions'@.
206215inlineNonRecursiveSchemas :: Data s => Definitions -> s -> s