Make resolve-allof partial recursive (#1787)

Makes it easier to use, like resolve-refs. It just needs to be called once.

Fixes an issue with m.call.* events not displaying the common fields

Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com>
This commit is contained in:
Kévin Commaille 2024-04-17 10:29:34 +02:00 committed by GitHub
parent 073ce659df
commit e82829d4a2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 56 additions and 94 deletions

View file

@ -38,9 +38,6 @@
</thead>
{{ range $property_name, $property := $properties }}
{{ $property := partial "json-schema/resolve-allof" $property }}
{{/*
Handle two ways of indicating "required", one for simple parameters,
the other for request and response body objects.
@ -67,7 +64,7 @@
<th class="col-description">Description</th>
</thead>
{{ $property := partial "json-schema/resolve-allof" . }}
{{ $property := . }}
<tr>
<td><code>{{ partial "partials/property-type" $property }}</code></td>
@ -111,9 +108,6 @@
like `[type]`.
*/}}
{{ $items := .items }}
{{ if .items }}
{{ $items = partial "json-schema/resolve-allof" .items }}
{{ end }}
{{ $inner_type := partial "property-type" $items }}
{{ $type = delimit (slice "[" $inner_type "]") "" }}
{{ else if or (reflect.IsSlice .type) .oneOf }}
@ -180,8 +174,7 @@
If the property uses `additionalProperties` to describe its
internal structure, handle this with a bit of recursion
*/}}
{{ $additionalProperties := partial "json-schema/resolve-allof" .additionalProperties }}
{{ $type = delimit (slice "{string: " (partial "property-type" $additionalProperties) "}" ) "" }}
{{ $type = delimit (slice "{string: " (partial "property-type" .additionalProperties) "}" ) "" }}
{{ else if reflect.IsMap .patternProperties }}
{{/*
If the property uses `patternProperties` to describe its
@ -193,7 +186,6 @@
{{ $types := slice }}
{{ range $pattern, $schema := .patternProperties}}
{{ $schema = partial "json-schema/resolve-allof" $schema }}
{{ $types = $types | append (partial "property-type" $schema) }}
{{ end }}