Do not use title for objects containing only additionalProperties or patternProperties

Previously, titles would appear that do not link to a subchema definition.
It would also mean that named subschemas would appear without being clearly referenced.

Now, the type clearly shows the nesting of objects
and subschema definitions should be clearly referenced.

Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
This commit is contained in:
Kévin Commaille 2024-04-24 12:27:53 +02:00
parent 26ce3929b4
commit 07645fc1ad
No known key found for this signature in database
GPG key ID: 29A48C1F03620416

View file

@ -155,12 +155,10 @@
adhering to a regex pattern adhering to a regex pattern
* `anchor`: optional HTML element id for the target type, which will be used to link to it. * `anchor`: optional HTML element id for the target type, which will be used to link to it.
The title has a higher priority than anything else.
*/}} */}}
{{ define "partials/object-type-or-title" }} {{ define "partials/object-type-or-title" }}
{{ $type := "object" }} {{ $type := "object" }}
{{ if .title }} {{ if and .title (or .properties (not (or .additionalProperties .patternProperties))) }}
{{/* {{/*
If the property has a `title`, use that rather than `type`. If the property has a `title`, use that rather than `type`.
This means we can write things like `EventFilter` rather than `object`. This means we can write things like `EventFilter` rather than `object`.