Do not generate anchors for objects which will not have a table

This commit is contained in:
Richard van der Hoff 2024-02-14 09:58:49 +00:00
parent 4043c1fc58
commit 83bbc23e30

View file

@ -24,8 +24,9 @@
* `resolve-allof` is called on the top-level `schema` beforehand, * `resolve-allof` is called on the top-level `schema` beforehand,
* `resolve-allof` doesn't recurse down to subschemas). * `resolve-allof` doesn't recurse down to subschemas).
* *
* * If `anchor_base` is set, each object with a `title` is given an `anchor`, * * If `anchor_base` is set, each object with a `title` and `properties`
* which is a string suitable for using as an html anchor for that object schema. * is given an `anchor`, which is a string suitable for using as an html
* anchor for that object schema.
* *
* * With the *exception* of the top-level `schema` (if it is an object), * * With the *exception* of the top-level `schema` (if it is an object),
* properties outside the following list are removed: * properties outside the following list are removed:
@ -64,8 +65,8 @@
{{ $all_objects := slice }} {{ $all_objects := slice }}
{{ if eq $this_object.type "object" }} {{ if eq $this_object.type "object" }}
/* Give this object an anchor, if it has a name */ /* Give this object an anchor, if it has a name and properties */
{{ if (and $anchor_base $this_object.title) }} {{ if (and $anchor_base $this_object.title $this_object.properties) }}
{{ $this_object = merge $this_object (dict "anchor" (printf "%s_%s" $anchor_base (anchorize $this_object.title))) }} {{ $this_object = merge $this_object (dict "anchor" (printf "%s_%s" $anchor_base (anchorize $this_object.title))) }}
{{ end }} {{ end }}