Skip to content

Commit

Permalink
Do not use title for objects containing only additionalProperties or …
Browse files Browse the repository at this point in the history
…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>
  • Loading branch information
zecakeh committed Apr 24, 2024
1 parent 26ce392 commit 07645fc
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions layouts/partials/openapi/render-object-table.html
Original file line number Diff line number Diff line change
Expand Up @@ -155,12 +155,10 @@
adhering to a regex pattern

* `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" }}
{{ $type := "object" }}
{{ if .title }}
{{ if and .title (or .properties (not (or .additionalProperties .patternProperties))) }}
{{/*
If the property has a `title`, use that rather than `type`.
This means we can write things like `EventFilter` rather than `object`.
Expand Down

0 comments on commit 07645fc

Please sign in to comment.