morph 0.1.0
Asynchronous bridge between GUI thread and business models
Loading...
Searching...
No Matches
schema_name.hpp File Reference

Compile-time $defs keys for the forms layer's field wrappers. More...

#include <array>
#include <concepts>
#include <cstddef>
#include <string_view>
#include <type_traits>
#include "../../detail/fixed_string.hpp"

Go to the source code of this file.

Detailed Description

Compile-time $defs keys for the forms layer's field wrappers.

glaze keys a schema's $defs block by glz::name_v<T> and populates each entry once: auto& def = defs[name_v<val_t>]; if (!def.type) { … }. A glz::meta::name that is the same string for two instantiations therefore makes the second one silently $ref the first one's definition, and a renderer that resolves the $ref reads the wrong payload type.

This header is the single place the forms layer composes those keys, so the rule that keeps them apart is stated once rather than once per wrapper.

Two rules shape what goes into a key:

  • Nothing compiler-derived. glz::name_v falls back to a __PRETTY_FUNCTION__/__FUNCSIG__-derived spelling that differs between compilers, and a $defs key that changed with the compiler would make a schema unreadable by a peer build — the same reason core/payload_schema.hpp refuses it for the payload fingerprint. Keys here are built only from template arguments spelled in these sources.
  • Discriminate exactly what the definition's content depends on. Two instantiations whose $defs entries would be byte-identical should share one entry; that is what $defs is for. Splitting them would only bloat the document. So a key carries the parameters the entry's shape varies with, and nothing else.

Definition in file schema_name.hpp.