Fix api-ref request samples containing curl commands instead of JSON
Several API sample files under doc/api_samples/ contained literal curl
commands instead of JSON request bodies, despite having .json file
extensions. This caused the api-ref documentation to render curl
command syntax with incorrect syntax highlighting (JavaScript or
default) instead of showing the actual JSON request payload.
Additionally, the attributes-post-curl.json file had a syntax error
with a missing closing brace in the embedded JSON.
Replace the curl command files with proper JSON request body files,
rename them from *-curl.json to *-req.json to match the existing
*-resp.json naming convention, and update the api-ref .inc files
to use consistent headings ("Example request:" instead of "Example
post curl") and add :language: javascript where it was missing.
Closes-Bug: #2158147
Assisted-by: Claude claude-opus-4-6 claude-code-2.1.190
Change-Id: I3b118051cb165c01ebefe8b8cecb9be9fc694827
Signed-off-by: melanie witt <melwittt@gmail.com>
This commit is contained in:
@@ -19,7 +19,6 @@ repos:
|
||||
files: .*\.(yaml|yml)$
|
||||
- id: check-json
|
||||
files: .*\.json$
|
||||
exclude: .*-curl.*\.json$
|
||||
- id: check-ast
|
||||
# git
|
||||
- id: check-added-large-files
|
||||
|
||||
@@ -58,9 +58,10 @@ Request
|
||||
|
||||
- device_profile_name: device_profile_name
|
||||
|
||||
**Example post curl**
|
||||
**Example request: create an accelerator request**
|
||||
|
||||
.. literalinclude:: ../../doc/api_samples/accelerator_requests/accelerator_requests-post-curl.json
|
||||
.. literalinclude:: ../../doc/api_samples/accelerator_requests/accelerator_requests-post-req.json
|
||||
:language: javascript
|
||||
|
||||
**Example response: create an accelerator request**
|
||||
|
||||
@@ -88,9 +89,10 @@ Request
|
||||
- instance_uuid: instance_uuid_bind_unbind_req
|
||||
- instance_project_id: instance_project_id_bind_unbind_req
|
||||
|
||||
**Example patch curl**
|
||||
**Example request: update an accelerator request**
|
||||
|
||||
.. literalinclude:: ../../doc/api_samples/accelerator_requests/accelerator_requests-patch-curl.json
|
||||
.. literalinclude:: ../../doc/api_samples/accelerator_requests/accelerator_requests-patch-req.json
|
||||
:language: javascript
|
||||
|
||||
**Example response: update an accelerator request**
|
||||
|
||||
|
||||
@@ -95,9 +95,10 @@ Request
|
||||
- key: attribute_key_req
|
||||
- value: attribute_value_req
|
||||
|
||||
**Example post curl**
|
||||
**Example request: create an attribute**
|
||||
|
||||
.. literalinclude:: ../../doc/api_samples/attributes/attributes-post-curl.json
|
||||
.. literalinclude:: ../../doc/api_samples/attributes/attributes-post-req.json
|
||||
:language: javascript
|
||||
|
||||
**Example response: create an attribute**
|
||||
|
||||
|
||||
@@ -114,14 +114,14 @@ Response
|
||||
- updated_at: updated
|
||||
- links: links
|
||||
|
||||
**Example post curl with resource/trait**
|
||||
**Example request: create a device profile with resource/trait**
|
||||
|
||||
.. literalinclude:: ../../doc/api_samples/device_profiles/device_profiles-post-curl.json
|
||||
.. literalinclude:: ../../doc/api_samples/device_profiles/device_profiles-post-req.json
|
||||
:language: javascript
|
||||
|
||||
**Example post curl with a cyborg property when bitstream is required**
|
||||
**Example request: create a device profile with a bitstream property**
|
||||
|
||||
.. literalinclude:: ../../doc/api_samples/device_profiles/device_profiles-post-curl-with-bitstream.json
|
||||
.. literalinclude:: ../../doc/api_samples/device_profiles/device_profiles-post-req-with-bitstream.json
|
||||
:language: javascript
|
||||
|
||||
**Example response: create a device profile**
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
curl -g -i -X PATCH http://192.168.23.138/accelerator/v2/accelerator_requests \
|
||||
-H "Accept: application/json" \
|
||||
-H "Content-Type: application/json" \
|
||||
-H "User-Agent: None" \
|
||||
-H "X-Auth-Token: yourtoken" \
|
||||
-d '
|
||||
{"89ec9c4d-73b2-4aaf-9225-485945aa7162":
|
||||
[{"op": "add", "path": "/instance_uuid",
|
||||
"value": "506220bc-18f2-4294-9b29-80267a021dc0"},
|
||||
{"op": "add", "path": "/hostname", "value": "centos-80"},
|
||||
{"op": "add", "path": "/device_rp_uuid",
|
||||
"value": "03631f82-20a9-3f67-a29d-dc1abe4042bf"},
|
||||
{"op": "add", "path": "/project_id",
|
||||
"value": "8934fbea7b3f4685bd8ee7cf166a4c09"}]}'
|
||||
@@ -0,0 +1,24 @@
|
||||
{
|
||||
"89ec9c4d-73b2-4aaf-9225-485945aa7162": [
|
||||
{
|
||||
"op": "add",
|
||||
"path": "/instance_uuid",
|
||||
"value": "506220bc-18f2-4294-9b29-80267a021dc0"
|
||||
},
|
||||
{
|
||||
"op": "add",
|
||||
"path": "/hostname",
|
||||
"value": "centos-80"
|
||||
},
|
||||
{
|
||||
"op": "add",
|
||||
"path": "/device_rp_uuid",
|
||||
"value": "03631f82-20a9-3f67-a29d-dc1abe4042bf"
|
||||
},
|
||||
{
|
||||
"op": "add",
|
||||
"path": "/project_id",
|
||||
"value": "8934fbea7b3f4685bd8ee7cf166a4c09"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
curl -g -i -X POST http://192.168.23.138/accelerator/v2/accelerator_requests \
|
||||
-H "Accept: application/json" \
|
||||
-H "Content-Type: application/json" \
|
||||
-H "User-Agent: None" \
|
||||
-H "X-Auth-Token: yourtoken" \
|
||||
-d '{"device_profile_name": "tmp-dp1"}'
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"device_profile_name": "tmp-dp1"
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
curl -g -i -X POST $cyborg_endpoint_url/attributes \
|
||||
-H "Accept: application/json" \
|
||||
-H "Content-Type: application/json" \
|
||||
-H "User-Agent:None" \
|
||||
-H "X-Auth-Token: yourtoken" \
|
||||
-d '{"deployable_id": "1",
|
||||
"key": "rc",
|
||||
"value": "FPGA"'
|
||||
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"deployable_id": "1",
|
||||
"key": "rc",
|
||||
"value": "FPGA"
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
curl -g -i -X POST $cyborg_endpoint_url/device_profiles \
|
||||
-H "Accept: application/json" \
|
||||
-H "Content-Type: application/json" \
|
||||
-H "User-Agent:None" \
|
||||
-H "X-Auth-Token: yourtoken" \
|
||||
-d '[{"name": "afexample_3",
|
||||
"description": "device profile description",
|
||||
"groups": [{"resources:CUSTOM_ACCELERATOR_FPGA": "1",
|
||||
"trait:CUSTOM_FPGA_1": "required",
|
||||
"trait:CUSTOM_FUNCTION_ID_3AFB": "required",
|
||||
"accel:bitstream_id": "a6a12670-7014-4cff-a563-cea949b57fb3"}]}]'
|
||||
@@ -1,10 +0,0 @@
|
||||
curl -g -i -X POST $cyborg_endpoint_url/device_profiles \
|
||||
-H "Accept: application/json" \
|
||||
-H "Content-Type: application/json" \
|
||||
-H "User-Agent:None" \
|
||||
-H "X-Auth-Token: yourtoken" \
|
||||
-d '[{"name": "afexample_3",
|
||||
"description": "device profile description",
|
||||
"groups": [{"resources:CUSTOM_ACCELERATOR_FPGA": "1",
|
||||
"trait:CUSTOM_FPGA_1": "required",
|
||||
"trait:CUSTOM_FUNCTION_ID_3AFB": "required"}]}]'
|
||||
@@ -0,0 +1,14 @@
|
||||
[
|
||||
{
|
||||
"name": "afexample_3",
|
||||
"description": "device profile description",
|
||||
"groups": [
|
||||
{
|
||||
"resources:CUSTOM_ACCELERATOR_FPGA": "1",
|
||||
"trait:CUSTOM_FPGA_1": "required",
|
||||
"trait:CUSTOM_FUNCTION_ID_3AFB": "required",
|
||||
"accel:bitstream_id": "a6a12670-7014-4cff-a563-cea949b57fb3"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
@@ -0,0 +1,13 @@
|
||||
[
|
||||
{
|
||||
"name": "afexample_3",
|
||||
"description": "device profile description",
|
||||
"groups": [
|
||||
{
|
||||
"resources:CUSTOM_ACCELERATOR_FPGA": "1",
|
||||
"trait:CUSTOM_FPGA_1": "required",
|
||||
"trait:CUSTOM_FUNCTION_ID_3AFB": "required"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
Reference in New Issue
Block a user