Generate correctly typed empty object examples
Empty object schemas currently become the JSON string "{}" when used as properties and null when generated as named models. This uses an empty map in both paths, with the same example caching as other model branches so repeated references remain objects.
The tests cover nested and top-level objects, arrays, repeated references, explicit examples and typed map values. Unresolved $ref handling is deliberately unchanged: an absent schema does not establish an object type.
Addresses #25237 for object schemas without properties.
Validation:
- ExampleGeneratorTest and StaticHtmlGeneratorTest: 29 passed.
- CLI packaging completed.
- The HTML reproduction now emits
"metadata" : { }instead of a string. - Regenerated html/html2 samples; no tracked changes. The full sample matrix was not run.
AI assistance: Codex helped investigate the issue and prepare the implementation and tests. The validation commands above were run locally.
PR checklist
- Read the contribution guidelines.
- Run the full project build, all sample generators and documentation export.
- Mention language technical committee members, if applicable. This change is in the shared example generator.
Summary by cubic
Fixes empty object schema examples so they generate typed empty objects ({}) instead of the JSON string "{}" when nested as properties or null when generated as named models. Named map schemas now also generate examples from their additional properties instead of empty maps, and both paths reuse the example cache so repeated references stay objects. Tests cover nested and top-level objects, arrays, repeated references, explicit examples, typed map values, and unresolved $ref schemas keep their existing fallback.