diff --git a/layouts/partials/openapi/endpoint.html b/layouts/partials/openapi/endpoint.html
index da9cb3be57af..37c83be4360d 100644
--- a/layouts/partials/openapi/endpoint.html
+++ b/layouts/partials/openapi/endpoint.html
@@ -84,9 +84,7 @@
Request Body
{{ end }}
{{ end }}
- {{/* Request/response examples hidden for now — revisit once example
- quality is validated across the full public spec. */}}
- {{/* {{ template "openapi/request-example.html" (dict "method" .method "path" .path "details" .details) }} */}}
+ {{ template "openapi/request-example.html" (dict "method" .method "path" .path "details" .details) }}
Responses
{{/* Split responses: inline-rendered (all 2xx + any 4xx/5xx with a JSON schema) vs. stock errors (4xx/5xx with no schema, rendered as compact chip row). */}}
@@ -129,7 +127,7 @@ Responses
{{ if isset $responseDetails.content "application/json" }}
{{ $schema := index $responseDetails.content "application/json" "schema" }}
{{ template "openapi/response-schema.html" (dict "schema" $schema "openapi" $.openapi) }}
- {{/* {{ template "openapi/examples.html" (dict "responseDetails" $responseDetails "responseCode" $responseCode "openapi" $.openapi) }} */}}
+ {{ template "openapi/examples.html" (dict "responseDetails" $responseDetails "responseCode" $responseCode) }}
{{ end }}
{{ end }}
diff --git a/layouts/partials/openapi/request-example.html b/layouts/partials/openapi/request-example.html
index 391434aac0a6..adf88ddd1657 100644
--- a/layouts/partials/openapi/request-example.html
+++ b/layouts/partials/openapi/request-example.html
@@ -16,23 +16,27 @@ Example Request
{{- $url = printf "%s?%s" $url (delimit $queryParts "&") }}
{{- end }}
-{{/* Build the curl command line by line. */}}
+{{/* Read the request body example from the native OpenAPI 3 mediaType.example slot. */}}
+{{- $bodyData := "" }}
+{{- with .details.requestBody }}
+ {{- with index .content "application/json" }}
+ {{- if .example }}
+ {{- $bodyData = .example | jsonify (dict "indent" " ") }}
+ {{- end }}
+ {{- end }}
+{{- end }}
+
{{- $lines := slice "curl \\" }}
{{- $lines = $lines | append " -H \"Accept: application/vnd.pulumi+8\" \\" }}
-{{- $lines = $lines | append " -H \"Content-Type: application/json\" \\" }}
+{{- if $bodyData }}
+ {{- $lines = $lines | append " -H \"Content-Type: application/json\" \\" }}
+{{- end }}
{{- $lines = $lines | append " -H \"Authorization: token $PULUMI_ACCESS_TOKEN\" \\" }}
{{- if ne $method "GET" }}
{{- $lines = $lines | append (printf " --request %s \\" $method) }}
{{- end }}
-{{- with .details.requestBody }}
- {{- $jsonContent := index .content "application/json" }}
- {{- with $jsonContent }}
- {{- $bodyData := "{}" }}
- {{- if .example }}
- {{- $bodyData = .example | jsonify }}
- {{- end }}
- {{- $lines = $lines | append (printf " --data '%s' \\" $bodyData) }}
- {{- end }}
+{{- if $bodyData }}
+ {{- $lines = $lines | append (printf " --data '%s' \\" $bodyData) }}
{{- end }}
{{- $lines = $lines | append (printf " %s" $url) }}
{{ delimit $lines "\n" }}