Remove is_root param

Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
pull/1637/head
Kévin Commaille 8 months ago
parent 37a42b487e
commit 0c63e4e2ce
No known key found for this signature in database
GPG Key ID: 29A48C1F03620416

@ -59,7 +59,6 @@
{{ $additional_types := partial "json-schema/resolve-additional-types" (dict
"schema" $event_data.properties.content
"anchor_base" $anchor_base
"is_root" true
) }}
{{ $additional_types = uniq $additional_types }}

@ -2,7 +2,6 @@
Finds and returns all objects, including nested ones, given a dict containing:
* `schema`: a JSON schema object
* `is_root`: Whether this is the root of the schema, meaning we should not clean the object so we can show additional and pattern properties.
* `anchor_base`: a prefix to add to the HTML anchors generated for each object. If nil, no anchors are generated.
* `name`: optionally, a name to use for this object in error/warning messages. If left unset,
the object's `title` property is used (if present).
@ -12,7 +11,7 @@
Assumes that "resolve-refs" and "resolve-allof" has already been called on the
input schema.
Returns an array of all the objects found. If `is_root` is true, the first object keeps all its properties. For all other objects, the following properties are returned:
Returns an array of all the objects found. The first object keeps all its properties. For all other objects, the following properties are returned:
* title
* properties
* required
@ -24,7 +23,6 @@
*/}}
{{ $this_object := .schema }}
{{ $is_root := .is_root }}
{{ $anchor_base := .anchor_base }}
{{ $all_objects := slice }}
{{ $name := .name | default $this_object.title | default "<untitled object>" }}
@ -38,11 +36,7 @@
{{/*
Add the object we were passed into the $all_objects array
*/}}
{{ $this_additional_object := $this_object }}
{{ if not $is_root }}
{{ $this_additional_object = partial "clean-object" $this_object }}
{{ end }}
{{ $all_objects = $all_objects | append $this_additional_object }}
{{ $all_objects = $all_objects | append $this_object }}
{{/*
Add any nested objects referenced in this object's `additionalProperties`

@ -45,7 +45,7 @@
{{ $schema := partial "json-schema/resolve-refs" (dict "schema" $json_body.schema "path" $path) }}
{{ $schema := partial "json-schema/resolve-allof" $schema }}
{{ $additional_types := partial "json-schema/resolve-additional-types" (dict "schema" $schema "anchor_base" $anchor_base "is_root" true) }}
{{ $additional_types := partial "json-schema/resolve-additional-types" (dict "schema" $schema "anchor_base" $anchor_base) }}
{{ $additional_types = uniq $additional_types }}
{{ range $additional_types }}
{{ partial "openapi/render-object-table" . }}

@ -80,7 +80,7 @@
response. (This will be a no-op for response types which aren't
objects or arrays.)
*/}}
{{ $additional_types := partial "json-schema/resolve-additional-types" (dict "schema" $schema "anchor_base" $anchor_base "is_root" true) }}
{{ $additional_types := partial "json-schema/resolve-additional-types" (dict "schema" $schema "anchor_base" $anchor_base) }}
{{ $additional_types = uniq $additional_types }}
{{ range $additional_types }}
{{ partial "openapi/render-object-table" . }}

@ -50,7 +50,7 @@
{{ $definition.description | markdownify }}
{{ $additional_types := partial "json-schema/resolve-additional-types" (dict "schema" $definition "name" (printf "\"%s\"" $path)) "is_root" true }}
{{ $additional_types := partial "json-schema/resolve-additional-types" (dict "schema" $definition "name" (printf "\"%s\"" $path)) }}
{{ $additional_types = uniq $additional_types }}
{{ range $additional_types }}

@ -35,7 +35,7 @@
{{ $event = merge $event (dict "title" "") }}
{{ $additional_types := partial "json-schema/resolve-additional-types" (dict "schema" $event) "is_root" true }}
{{ $additional_types := partial "json-schema/resolve-additional-types" (dict "schema" $event) }}
{{ range $additional_types }}
{{ partial "openapi/render-object-table" . }}
{{end}}

Loading…
Cancel
Save