You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[BUG] ExampleGenerator returns the string "{}" (or null) for type: object schemas without properties #25237
Have you provided a full/minimal spec to reproduce the issue?
Have you validated the input using an OpenAPI validator?
Have you tested with the latest master to confirm the issue still exists?
Have you searched for related issues/PRs?
What's the actual output vs expected output?
Description
resolvePropertyToExample returns the Java string literal "{}" for an object schema without properties and for a $ref that cannot be resolved. Json.pretty then serializes it as a JSON string ("metadata" : "{}") instead of an empty object ("metadata" : { }), so the example has the wrong type (JSON Schema Validation wright-00, 5.21).
The same happens one level up. For a top-level model type: object without properties, resolveModelToExample falls through to return null, and generate(null, ["application/json"], "Anything") returns the example null. Through the CLI this model gets unaliased first, so the operation simply has no example; only programmatic callers see null.
Return new LinkedHashMap<>() (an empty map) instead of the string "{}" in both branches of resolvePropertyToExample, and also for object schemas without properties in resolveModelToExample.
Looks like this was resolved by #25253 (merged Oct 19), which returns an empty object for both the nested and top-level cases and keeps the unresolved-$ref fallback intentionally. I think this can be closed.
Activity
rajeshvasa commentedon Nov 15, 2026
Looks like this was resolved by #25253 (merged Oct 19), which returns an empty object for both the nested and top-level cases and keeps the unresolved-
$reffallback intentionally. I think this can be closed.