Sen API
Sen Libraries
Loading...
Searching...
No Matches
sen::gen::JsonGenerator Class Reference

Renders JSON-Schema descriptions of sen type sets. Stateful (caches the loaded inja templates), so prefer reusing one instance across calls when possible. More...

#include <json.h>

Public Member Functions

 JsonGenerator ()
 ~JsonGenerator ()
std::string generatePackage (const sen::lang::TypeSetContext &typeSets, const PackageOptions &opts={})
 Renders a package schema for the supplied type set.
std::string generateComponent (const sen::lang::TypeSetContext &typeSets, const ComponentOptions &opts={})
 Renders a component schema (i.e. one that exposes a Configuration class) for the supplied type set.
std::string combineSchemas (const std::vector< std::string > &schemaContents, const std::string &schemaName)
 Renders a kernel configuration file that combines an arbitrary number of previously rendered schemas into one document. schemaContents are the raw rendered strings (as produced by generatePackage / generateComponent or read from disk).
std::string renderTypeSchema (const sen::CustomType &type)
 Renders one type's JSON-Schema fragment in the same shape the file-level renderers use ("<qualifiedName>": { "$id": "...", ... }). Cross-type references are emitted as $ref strings keyed by qualified name; the caller resolves them.

Detailed Description

Renders JSON-Schema descriptions of sen type sets. Stateful (caches the loaded inja templates), so prefer reusing one instance across calls when possible.

Constructor & Destructor Documentation

◆ JsonGenerator()

sen::gen::JsonGenerator::JsonGenerator ( )

◆ ~JsonGenerator()

sen::gen::JsonGenerator::~JsonGenerator ( )

Member Function Documentation

◆ generatePackage()

std::string sen::gen::JsonGenerator::generatePackage ( const sen::lang::TypeSetContext & typeSets,
const PackageOptions & opts = {} )
nodiscard

Renders a package schema for the supplied type set.

◆ generateComponent()

std::string sen::gen::JsonGenerator::generateComponent ( const sen::lang::TypeSetContext & typeSets,
const ComponentOptions & opts = {} )
nodiscard

Renders a component schema (i.e. one that exposes a Configuration class) for the supplied type set.

◆ combineSchemas()

std::string sen::gen::JsonGenerator::combineSchemas ( const std::vector< std::string > & schemaContents,
const std::string & schemaName )
nodiscard

Renders a kernel configuration file that combines an arbitrary number of previously rendered schemas into one document. schemaContents are the raw rendered strings (as produced by generatePackage / generateComponent or read from disk).

◆ renderTypeSchema()

std::string sen::gen::JsonGenerator::renderTypeSchema ( const sen::CustomType & type)
nodiscard

Renders one type's JSON-Schema fragment in the same shape the file-level renderers use ("<qualifiedName>": { "$id": "...", ... }). Cross-type references are emitted as $ref strings keyed by qualified name; the caller resolves them.


The documentation for this class was generated from the following file: