nfx-serialization 0.3.0
Cross-platform C++ JSON serialization library with extensible trait capabilities
Loading...
Searching...
No Matches
nfx::serialization::json::SchemaGenerator Class Referencefinal

JSON Schema generator from Document instances. More...

#include <nfx/serialization/json/SchemaGenerator.h>

Classes

struct  Options
 Configuration options for schema generation. More...

Public Member Functions

 SchemaGenerator (const Document &document)
 Generate JSON Schema from a single document.
 SchemaGenerator (const Document &document, const Options &options)
 Generate JSON Schema from a single document.
 SchemaGenerator (const std::vector< Document > &documents)
 Generate JSON Schema from multiple sample documents.
 SchemaGenerator (const std::vector< Document > &documents, const Options &options)
 Generate JSON Schema from multiple sample documents.
 SchemaGenerator (const SchemaGenerator &)=default
 Copy constructor.
 SchemaGenerator (SchemaGenerator &&) noexcept=default
 Move constructor.
 ~SchemaGenerator ()=default
 Destructor.
SchemaGeneratoroperator= (const SchemaGenerator &)=default
 Copy assignment operator.
SchemaGeneratoroperator= (SchemaGenerator &&) noexcept=default
 Move assignment operator.
const Documentschema () const noexcept
 Get the generated schema.

Detailed Description

JSON Schema generator from Document instances.

Analyzes JSON data to generate JSON Schema Draft 2020-12 compliant schemas. Infers types, detects string formats (email, date, URI, UUID, etc.), and generates constraints based on observed values.

Definition at line 54 of file SchemaGenerator.h.

Constructor & Destructor Documentation

◆ SchemaGenerator() [1/4]

nfx::serialization::json::SchemaGenerator::SchemaGenerator ( const Document & document)
explicit

Generate JSON Schema from a single document.

Parameters
documentThe JSON document to analyze
Here is the caller graph for this function:

◆ SchemaGenerator() [2/4]

nfx::serialization::json::SchemaGenerator::SchemaGenerator ( const Document & document,
const Options & options )

Generate JSON Schema from a single document.

Parameters
documentThe JSON document to analyze
optionsGeneration options

◆ SchemaGenerator() [3/4]

nfx::serialization::json::SchemaGenerator::SchemaGenerator ( const std::vector< Document > & documents)
explicit

Generate JSON Schema from multiple sample documents.

Analyzes multiple samples to infer required properties, detect enums, and generate more accurate constraints.

Parameters
documentsVector of JSON documents to analyze

◆ SchemaGenerator() [4/4]

nfx::serialization::json::SchemaGenerator::SchemaGenerator ( const std::vector< Document > & documents,
const Options & options )

Generate JSON Schema from multiple sample documents.

Analyzes multiple samples to infer required properties, detect enums, and generate more accurate constraints.

Parameters
documentsVector of JSON documents to analyze
optionsGeneration options

Member Function Documentation

◆ operator=() [1/2]

SchemaGenerator & nfx::serialization::json::SchemaGenerator::operator= ( const SchemaGenerator & )
default

Copy assignment operator.

Returns
Reference to this generator
Here is the call graph for this function:

◆ operator=() [2/2]

SchemaGenerator & nfx::serialization::json::SchemaGenerator::operator= ( SchemaGenerator && )
defaultnoexcept

Move assignment operator.

Returns
Reference to this generator
Here is the call graph for this function:

◆ schema()

const Document & nfx::serialization::json::SchemaGenerator::schema ( ) const
inlinenoexcept

Get the generated schema.

Returns
Const reference to the generated JSON Schema

Definition at line 146 of file SchemaGenerator.h.

Here is the call graph for this function:
Here is the caller graph for this function:

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