@ -5,11 +5,16 @@
* `api_data`: the OpenAPI data
* `api_data`: the OpenAPI data
* `base_url`: the base URL: that is, the part we glue onto the front
* `base_url`: the base URL: that is, the part we glue onto the front
of each value in `paths` to get a complete URL.
of each value in `paths` to get a complete URL.
* `anchor_base`: an optional prefix for the HTML IDs generated by
this template.
This template replaces the old {{*_http_api}} template.
*/}}
*/}}
{{ $api_data := index .api_data }}
{{ $api_data := index .api_data }}
{{ $base_url := .base_url }}
{{ $base_url := .base_url }}
{{ $anchor_base := .anchor_base }}
{{ range $path_name, $path_data := $api_data.paths }}
{{ range $path_name, $path_data := $api_data.paths }}
@ -21,28 +26,28 @@
{{ with $path_data.get }}
{{ with $path_data.get }}
{{ $operation_params := merge $params (dict "method" "GET" "operation_data" . ) }}
{{ $operation_params := merge $params (dict "method" "GET" "operation_data" . "anchor_base" $anchor_base ) }}
{{ partial "openapi/render-operation" $operation_params }}
{{ partial "openapi/render-operation" $operation_params }}
{{ end }}
{{ end }}
{{ with $path_data.post }}
{{ with $path_data.post }}
{{ $operation_params := merge $params (dict "method" "POST" "operation_data" . ) }}
{{ $operation_params := merge $params (dict "method" "POST" "operation_data" . "anchor_base" $anchor_base ) }}
{{ partial "openapi/render-operation" $operation_params }}
{{ partial "openapi/render-operation" $operation_params }}
{{ end }}
{{ end }}
{{ with $path_data.put }}
{{ with $path_data.put }}
{{ $operation_params := merge $params (dict "method" "PUT" "operation_data" . ) }}
{{ $operation_params := merge $params (dict "method" "PUT" "operation_data" . "anchor_base" $anchor_base ) }}
{{ partial "openapi/render-operation" $operation_params }}
{{ partial "openapi/render-operation" $operation_params }}
{{ end }}
{{ end }}
{{ with $path_data.delete }}
{{ with $path_data.delete }}
{{ $operation_params := merge $params (dict "method" "DELETE" "operation_data" . ) }}
{{ $operation_params := merge $params (dict "method" "DELETE" "operation_data" . "anchor_base" $anchor_base ) }}
{{ partial "openapi/render-operation" $operation_params }}
{{ partial "openapi/render-operation" $operation_params }}
{{ end }}
{{ end }}