diff --git a/layouts/partials/openapi/render-operation.html b/layouts/partials/openapi/render-operation.html index 6d516d06..74b729cf 100644 --- a/layouts/partials/openapi/render-operation.html +++ b/layouts/partials/openapi/render-operation.html @@ -22,13 +22,14 @@ {{ $endpoint := .endpoint }} {{ $operation_data := .operation_data }} {{ $path := .path }} +{{ $anchor := anchorize $endpoint }}
-

+

{{ $method }} {{ $endpoint }}

@@ -63,9 +64,9 @@
-{{ partial "openapi/render-request" (dict "parameters" $operation_data.parameters "path" $path) }} +{{ partial "openapi/render-request" (dict "parameters" $operation_data.parameters "path" $path "anchor_base" $anchor ) }}
-{{ partial "openapi/render-responses" (dict "responses" $operation_data.responses "path" $path) }} +{{ partial "openapi/render-responses" (dict "responses" $operation_data.responses "path" $path "anchor_base" $anchor ) }}
diff --git a/layouts/partials/openapi/render-request.html b/layouts/partials/openapi/render-request.html index 2174b552..be39fa38 100644 --- a/layouts/partials/openapi/render-request.html +++ b/layouts/partials/openapi/render-request.html @@ -4,6 +4,7 @@ * `parameters`: OpenAPI/Swagger data specifying the parameters * `path`: the path where this definition was found, to enable us to resolve "$ref" + * `anchor_base`: a prefix to add to the HTML anchors generated for each object This template renders: * the "simple parameters" (header, path, query parameters) @@ -14,6 +15,7 @@ {{ $parameters := .parameters }} {{ $path := .path }} +{{ $anchor_base := .anchor_base }}

Request

@@ -38,7 +40,7 @@ {{ $schema := partial "json-schema/resolve-refs" (dict "schema" $body_parameter.schema "path" $path) }} {{ $schema := partial "json-schema/resolve-allof" $schema }} - {{ $additional_types := partial "json-schema/resolve-additional-types" (dict "schema" $schema) }} + {{ $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" . }} diff --git a/layouts/partials/openapi/render-responses.html b/layouts/partials/openapi/render-responses.html index 3935c4e0..c6556fbb 100644 --- a/layouts/partials/openapi/render-responses.html +++ b/layouts/partials/openapi/render-responses.html @@ -4,6 +4,7 @@ * `responses`: OpenAPI/Swagger data specifying the responses * `path`: the path where this definition was found, to enable us to resolve "$ref" + * `anchor_base`: a prefix to add to the HTML anchors generated for each object This template renders: * a summary of all the different responses @@ -15,6 +16,7 @@ {{ $responses := .responses }} {{ $path := .path }} +{{ $anchor_base := .anchor_base }}

Responses

@@ -71,7 +73,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) }} + {{ $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" . }}