Differentiate API endpoints' request and response children's IDs

Ensures that the objects have a unique ID compared to other parts of the endpoint.
Mostly useful for the Error type that can be used for responses with different status codes.

Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
This commit is contained in:
Kévin Commaille 2024-06-20 11:12:53 +02:00
parent fa0e3068b4
commit 8db8f446d0
No known key found for this signature in database
GPG key ID: 0C971D9DBC9D678D
2 changed files with 4 additions and 2 deletions

View file

@ -16,6 +16,7 @@
{{ $parameters := .parameters }}
{{ $request_body := .request_body }}
{{ $anchor_base := .anchor_base }}
{{ $anchor := printf "%s_request" $anchor_base }}
<h2>Request</h2>
@ -42,7 +43,7 @@
*/}}
{{ $schema := $json_body.schema }}
{{ $additional_types := partial "json-schema/resolve-additional-types" (dict "schema" $schema "anchor_base" $anchor_base) }}
{{ $additional_types := partial "json-schema/resolve-additional-types" (dict "schema" $schema "anchor_base" $anchor) }}
{{ range $additional_types }}
{{ partial "openapi/render-object-table" . }}
{{ end }}

View file

@ -39,6 +39,7 @@
{{ range $code, $response := $responses }}
{{ if $response.content }}
{{ $anchor := printf "%s_response-%s" $anchor_base $code }}
<h3>{{$code}} response</h3>
{{/* Display defined headers */}}
{{ if $response.headers }}
@ -97,7 +98,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) }}
{{ $additional_types := partial "json-schema/resolve-additional-types" (dict "schema" $schema "anchor_base" $anchor) }}
{{ range $additional_types }}
{{ partial "openapi/render-object-table" . }}
{{ end }}