Skip to content

build_json_schema

Python reference for nagasim.modelschema.build_json_schema.

Return the current model file format as a draft 2020-12 JSON Schema.

Built fresh on each call from the block and distribution registries and the enumerations in resource_manager, schedules, stats and timeunits, so plugin blocks and distributions are included automatically.

Returns:

Type Description
dict

The schema, ready for json.dumps or an editor's schema hookup.

See Also

nagasim.modelfmt.minimal : The shortest valid form of a model.

Examples:

>>> from nagasim.modelschema import build_json_schema
>>> schema = build_json_schema()
>>> schema["$schema"]
'https://json-schema.org/draft/2020-12/schema'
>>> "blocks" in schema["properties"]
True