diff --git a/lib/rest/static/decorated/api.github.com.json b/lib/rest/static/decorated/api.github.com.json index 7d11071230a7..965cdfd5f3af 100644 --- a/lib/rest/static/decorated/api.github.com.json +++ b/lib/rest/static/decorated/api.github.com.json @@ -224876,14 +224876,22 @@ "type": "object", "properties": { "content": { - "description": "Content of the file", + "description": "
Content of the file
", "readOnly": false, - "type": "string" + "type": "string", + "name": "content", + "in": "body", + "rawType": "string", + "rawDescription": "Content of the file", + "isRequired": true, + "childParamsGroups": [] } }, "required": [ "content" - ] + ], + "rawType": "object", + "name": "key" }, "examples": [ { @@ -224897,7 +224905,41 @@ "rawType": "object", "rawDescription": "Names and content for the files that make up the gist", "isRequired": true, - "childParamsGroups": [] + "childParamsGroups": [ + { + "parentName": "files", + "parentType": "object", + "id": "files-object", + "params": [ + { + "description": "A user-defined key to represent an item in files
.
Content of the file
", + "readOnly": false, + "type": "string", + "name": "content", + "in": "body", + "rawType": "string", + "rawDescription": "Content of the file", + "isRequired": true, + "childParamsGroups": [] + } + ] + } + ] }, { "oneOf": [ @@ -228586,15 +228628,25 @@ ], "properties": { "content": { - "description": "The new content of the file", - "type": "string" + "description": "The new content of the file
", + "type": "string", + "name": "content", + "in": "body", + "rawType": "string", + "rawDescription": "The new content of the file", + "childParamsGroups": [] }, "filename": { - "description": "The new filename for the file", - "type": [ + "description": "The new filename for the file
", + "type": "string or null", + "name": "filename", + "in": "body", + "rawType": [ "string", "null" - ] + ], + "rawDescription": "The new filename for the file", + "childParamsGroups": [] } }, "anyOf": [ @@ -228612,7 +228664,9 @@ "type": "object", "maxProperties": 0 } - ] + ], + "rawType": "object", + "name": "key" }, "examples": [ { @@ -228627,7 +228681,51 @@ "rawType": "object", "rawDescription": "Names of files to be updated", "isRequired": false, - "childParamsGroups": [] + "childParamsGroups": [ + { + "parentName": "files", + "parentType": "object", + "id": "files-object", + "params": [ + { + "description": "A user-defined key to represent an item in files
.
The new content of the file
", + "type": "string", + "name": "content", + "in": "body", + "rawType": "string", + "rawDescription": "The new content of the file", + "childParamsGroups": [] + }, + { + "description": "The new filename for the file
", + "type": "string or null", + "name": "filename", + "in": "body", + "rawType": [ + "string", + "null" + ], + "rawDescription": "The new filename for the file", + "childParamsGroups": [] + } + ] + } + ] } ], "enabledForGitHubApps": false, diff --git a/lib/rest/static/decorated/ghes-3.1.json b/lib/rest/static/decorated/ghes-3.1.json index f8fa72a332fb..fede38c4ef95 100644 --- a/lib/rest/static/decorated/ghes-3.1.json +++ b/lib/rest/static/decorated/ghes-3.1.json @@ -162644,14 +162644,22 @@ "type": "object", "properties": { "content": { - "description": "Content of the file", + "description": "Content of the file
", "readOnly": false, - "type": "string" + "type": "string", + "name": "content", + "in": "body", + "rawType": "string", + "rawDescription": "Content of the file", + "isRequired": true, + "childParamsGroups": [] } }, "required": [ "content" - ] + ], + "rawType": "object", + "name": "key" }, "examples": [ { @@ -162665,7 +162673,41 @@ "rawType": "object", "rawDescription": "Names and content for the files that make up the gist", "isRequired": true, - "childParamsGroups": [] + "childParamsGroups": [ + { + "parentName": "files", + "parentType": "object", + "id": "files-object", + "params": [ + { + "description": "A user-defined key to represent an item in files
.
Content of the file
", + "readOnly": false, + "type": "string", + "name": "content", + "in": "body", + "rawType": "string", + "rawDescription": "Content of the file", + "isRequired": true, + "childParamsGroups": [] + } + ] + } + ] }, { "oneOf": [ @@ -166354,15 +166396,25 @@ ], "properties": { "content": { - "description": "The new content of the file", - "type": "string" + "description": "The new content of the file
", + "type": "string", + "name": "content", + "in": "body", + "rawType": "string", + "rawDescription": "The new content of the file", + "childParamsGroups": [] }, "filename": { - "description": "The new filename for the file", - "type": [ + "description": "The new filename for the file
", + "type": "string or null", + "name": "filename", + "in": "body", + "rawType": [ "string", "null" - ] + ], + "rawDescription": "The new filename for the file", + "childParamsGroups": [] } }, "anyOf": [ @@ -166380,7 +166432,9 @@ "type": "object", "maxProperties": 0 } - ] + ], + "rawType": "object", + "name": "key" }, "examples": [ { @@ -166395,7 +166449,51 @@ "rawType": "object", "rawDescription": "Names of files to be updated", "isRequired": false, - "childParamsGroups": [] + "childParamsGroups": [ + { + "parentName": "files", + "parentType": "object", + "id": "files-object", + "params": [ + { + "description": "A user-defined key to represent an item in files
.
The new content of the file
", + "type": "string", + "name": "content", + "in": "body", + "rawType": "string", + "rawDescription": "The new content of the file", + "childParamsGroups": [] + }, + { + "description": "The new filename for the file
", + "type": "string or null", + "name": "filename", + "in": "body", + "rawType": [ + "string", + "null" + ], + "rawDescription": "The new filename for the file", + "childParamsGroups": [] + } + ] + } + ] } ], "enabledForGitHubApps": false, diff --git a/lib/rest/static/decorated/ghes-3.2.json b/lib/rest/static/decorated/ghes-3.2.json index abc438e1acdb..89cc764df5bd 100644 --- a/lib/rest/static/decorated/ghes-3.2.json +++ b/lib/rest/static/decorated/ghes-3.2.json @@ -168387,14 +168387,22 @@ "type": "object", "properties": { "content": { - "description": "Content of the file", + "description": "Content of the file
", "readOnly": false, - "type": "string" + "type": "string", + "name": "content", + "in": "body", + "rawType": "string", + "rawDescription": "Content of the file", + "isRequired": true, + "childParamsGroups": [] } }, "required": [ "content" - ] + ], + "rawType": "object", + "name": "key" }, "examples": [ { @@ -168408,7 +168416,41 @@ "rawType": "object", "rawDescription": "Names and content for the files that make up the gist", "isRequired": true, - "childParamsGroups": [] + "childParamsGroups": [ + { + "parentName": "files", + "parentType": "object", + "id": "files-object", + "params": [ + { + "description": "A user-defined key to represent an item in files
.
Content of the file
", + "readOnly": false, + "type": "string", + "name": "content", + "in": "body", + "rawType": "string", + "rawDescription": "Content of the file", + "isRequired": true, + "childParamsGroups": [] + } + ] + } + ] }, { "oneOf": [ @@ -172097,15 +172139,25 @@ ], "properties": { "content": { - "description": "The new content of the file", - "type": "string" + "description": "The new content of the file
", + "type": "string", + "name": "content", + "in": "body", + "rawType": "string", + "rawDescription": "The new content of the file", + "childParamsGroups": [] }, "filename": { - "description": "The new filename for the file", - "type": [ + "description": "The new filename for the file
", + "type": "string or null", + "name": "filename", + "in": "body", + "rawType": [ "string", "null" - ] + ], + "rawDescription": "The new filename for the file", + "childParamsGroups": [] } }, "anyOf": [ @@ -172123,7 +172175,9 @@ "type": "object", "maxProperties": 0 } - ] + ], + "rawType": "object", + "name": "key" }, "examples": [ { @@ -172138,7 +172192,51 @@ "rawType": "object", "rawDescription": "Names of files to be updated", "isRequired": false, - "childParamsGroups": [] + "childParamsGroups": [ + { + "parentName": "files", + "parentType": "object", + "id": "files-object", + "params": [ + { + "description": "A user-defined key to represent an item in files
.
The new content of the file
", + "type": "string", + "name": "content", + "in": "body", + "rawType": "string", + "rawDescription": "The new content of the file", + "childParamsGroups": [] + }, + { + "description": "The new filename for the file
", + "type": "string or null", + "name": "filename", + "in": "body", + "rawType": [ + "string", + "null" + ], + "rawDescription": "The new filename for the file", + "childParamsGroups": [] + } + ] + } + ] } ], "enabledForGitHubApps": false, diff --git a/lib/rest/static/decorated/ghes-3.3.json b/lib/rest/static/decorated/ghes-3.3.json index 7178f4786521..ec10a3b28fe1 100644 --- a/lib/rest/static/decorated/ghes-3.3.json +++ b/lib/rest/static/decorated/ghes-3.3.json @@ -168969,14 +168969,22 @@ "type": "object", "properties": { "content": { - "description": "Content of the file", + "description": "Content of the file
", "readOnly": false, - "type": "string" + "type": "string", + "name": "content", + "in": "body", + "rawType": "string", + "rawDescription": "Content of the file", + "isRequired": true, + "childParamsGroups": [] } }, "required": [ "content" - ] + ], + "rawType": "object", + "name": "key" }, "examples": [ { @@ -168990,7 +168998,41 @@ "rawType": "object", "rawDescription": "Names and content for the files that make up the gist", "isRequired": true, - "childParamsGroups": [] + "childParamsGroups": [ + { + "parentName": "files", + "parentType": "object", + "id": "files-object", + "params": [ + { + "description": "A user-defined key to represent an item in files
.
Content of the file
", + "readOnly": false, + "type": "string", + "name": "content", + "in": "body", + "rawType": "string", + "rawDescription": "Content of the file", + "isRequired": true, + "childParamsGroups": [] + } + ] + } + ] }, { "oneOf": [ @@ -172679,15 +172721,25 @@ ], "properties": { "content": { - "description": "The new content of the file", - "type": "string" + "description": "The new content of the file
", + "type": "string", + "name": "content", + "in": "body", + "rawType": "string", + "rawDescription": "The new content of the file", + "childParamsGroups": [] }, "filename": { - "description": "The new filename for the file", - "type": [ + "description": "The new filename for the file
", + "type": "string or null", + "name": "filename", + "in": "body", + "rawType": [ "string", "null" - ] + ], + "rawDescription": "The new filename for the file", + "childParamsGroups": [] } }, "anyOf": [ @@ -172705,7 +172757,9 @@ "type": "object", "maxProperties": 0 } - ] + ], + "rawType": "object", + "name": "key" }, "examples": [ { @@ -172720,7 +172774,51 @@ "rawType": "object", "rawDescription": "Names of files to be updated", "isRequired": false, - "childParamsGroups": [] + "childParamsGroups": [ + { + "parentName": "files", + "parentType": "object", + "id": "files-object", + "params": [ + { + "description": "A user-defined key to represent an item in files
.
The new content of the file
", + "type": "string", + "name": "content", + "in": "body", + "rawType": "string", + "rawDescription": "The new content of the file", + "childParamsGroups": [] + }, + { + "description": "The new filename for the file
", + "type": "string or null", + "name": "filename", + "in": "body", + "rawType": [ + "string", + "null" + ], + "rawDescription": "The new filename for the file", + "childParamsGroups": [] + } + ] + } + ] } ], "enabledForGitHubApps": false, diff --git a/lib/rest/static/decorated/ghes-3.4.json b/lib/rest/static/decorated/ghes-3.4.json index be4312a3887a..ff8e105d5658 100644 --- a/lib/rest/static/decorated/ghes-3.4.json +++ b/lib/rest/static/decorated/ghes-3.4.json @@ -175158,14 +175158,22 @@ "type": "object", "properties": { "content": { - "description": "Content of the file", + "description": "Content of the file
", "readOnly": false, - "type": "string" + "type": "string", + "name": "content", + "in": "body", + "rawType": "string", + "rawDescription": "Content of the file", + "isRequired": true, + "childParamsGroups": [] } }, "required": [ "content" - ] + ], + "rawType": "object", + "name": "key" }, "examples": [ { @@ -175179,7 +175187,41 @@ "rawType": "object", "rawDescription": "Names and content for the files that make up the gist", "isRequired": true, - "childParamsGroups": [] + "childParamsGroups": [ + { + "parentName": "files", + "parentType": "object", + "id": "files-object", + "params": [ + { + "description": "A user-defined key to represent an item in files
.
Content of the file
", + "readOnly": false, + "type": "string", + "name": "content", + "in": "body", + "rawType": "string", + "rawDescription": "Content of the file", + "isRequired": true, + "childParamsGroups": [] + } + ] + } + ] }, { "oneOf": [ @@ -178868,15 +178910,25 @@ ], "properties": { "content": { - "description": "The new content of the file", - "type": "string" + "description": "The new content of the file
", + "type": "string", + "name": "content", + "in": "body", + "rawType": "string", + "rawDescription": "The new content of the file", + "childParamsGroups": [] }, "filename": { - "description": "The new filename for the file", - "type": [ + "description": "The new filename for the file
", + "type": "string or null", + "name": "filename", + "in": "body", + "rawType": [ "string", "null" - ] + ], + "rawDescription": "The new filename for the file", + "childParamsGroups": [] } }, "anyOf": [ @@ -178894,7 +178946,9 @@ "type": "object", "maxProperties": 0 } - ] + ], + "rawType": "object", + "name": "key" }, "examples": [ { @@ -178909,7 +178963,51 @@ "rawType": "object", "rawDescription": "Names of files to be updated", "isRequired": false, - "childParamsGroups": [] + "childParamsGroups": [ + { + "parentName": "files", + "parentType": "object", + "id": "files-object", + "params": [ + { + "description": "A user-defined key to represent an item in files
.
The new content of the file
", + "type": "string", + "name": "content", + "in": "body", + "rawType": "string", + "rawDescription": "The new content of the file", + "childParamsGroups": [] + }, + { + "description": "The new filename for the file
", + "type": "string or null", + "name": "filename", + "in": "body", + "rawType": [ + "string", + "null" + ], + "rawDescription": "The new filename for the file", + "childParamsGroups": [] + } + ] + } + ] } ], "enabledForGitHubApps": false, diff --git a/lib/rest/static/decorated/github.ae.json b/lib/rest/static/decorated/github.ae.json index 0f99d56b515c..ea7920414956 100644 --- a/lib/rest/static/decorated/github.ae.json +++ b/lib/rest/static/decorated/github.ae.json @@ -163917,14 +163917,22 @@ "type": "object", "properties": { "content": { - "description": "Content of the file", + "description": "Content of the file
", "readOnly": false, - "type": "string" + "type": "string", + "name": "content", + "in": "body", + "rawType": "string", + "rawDescription": "Content of the file", + "isRequired": true, + "childParamsGroups": [] } }, "required": [ "content" - ] + ], + "rawType": "object", + "name": "key" }, "examples": [ { @@ -163938,7 +163946,41 @@ "rawType": "object", "rawDescription": "Names and content for the files that make up the gist", "isRequired": true, - "childParamsGroups": [] + "childParamsGroups": [ + { + "parentName": "files", + "parentType": "object", + "id": "files-object", + "params": [ + { + "description": "A user-defined key to represent an item in files
.
Content of the file
", + "readOnly": false, + "type": "string", + "name": "content", + "in": "body", + "rawType": "string", + "rawDescription": "Content of the file", + "isRequired": true, + "childParamsGroups": [] + } + ] + } + ] }, { "oneOf": [ @@ -167627,15 +167669,25 @@ ], "properties": { "content": { - "description": "The new content of the file", - "type": "string" + "description": "The new content of the file
", + "type": "string", + "name": "content", + "in": "body", + "rawType": "string", + "rawDescription": "The new content of the file", + "childParamsGroups": [] }, "filename": { - "description": "The new filename for the file", - "type": [ + "description": "The new filename for the file
", + "type": "string or null", + "name": "filename", + "in": "body", + "rawType": [ "string", "null" - ] + ], + "rawDescription": "The new filename for the file", + "childParamsGroups": [] } }, "anyOf": [ @@ -167653,7 +167705,9 @@ "type": "object", "maxProperties": 0 } - ] + ], + "rawType": "object", + "name": "key" }, "examples": [ { @@ -167668,7 +167722,51 @@ "rawType": "object", "rawDescription": "Names of files to be updated", "isRequired": false, - "childParamsGroups": [] + "childParamsGroups": [ + { + "parentName": "files", + "parentType": "object", + "id": "files-object", + "params": [ + { + "description": "A user-defined key to represent an item in files
.
The new content of the file
", + "type": "string", + "name": "content", + "in": "body", + "rawType": "string", + "rawDescription": "The new content of the file", + "childParamsGroups": [] + }, + { + "description": "The new filename for the file
", + "type": "string or null", + "name": "filename", + "in": "body", + "rawType": [ + "string", + "null" + ], + "rawDescription": "The new filename for the file", + "childParamsGroups": [] + } + ] + } + ] } ], "enabledForGitHubApps": false, diff --git a/script/rest/utils/operation.js b/script/rest/utils/operation.js index fbe268dba8b1..3ad716800f61 100644 --- a/script/rest/utils/operation.js +++ b/script/rest/utils/operation.js @@ -314,7 +314,51 @@ async function getBodyParams(paramsObject, requiredParams) { param.description = await renderContent(param.description) // there may be zero, one, or multiple object parameters that have children parameters param.childParamsGroups = [] - const childParamsGroup = await getChildParamsGroup(param) + let childParamsGroup + + // When additionalProperties is defined with a type of `object` + // the input parameter is a dictionary. This handles cases for + // a dictionary. We don't have any list cases yet, and when + // the type is `string` we don't need to render additional rows of + // parameters. + // https://swagger.io/docs/specification/data-models/dictionaries/ + + // This conditional accounts for additionalProperties of type object + // and [null, 'object'] + if ( + param.additionalProperties && + (param.additionalProperties.type === 'object' || + (Array.isArray(param.additionalProperties.type) && + param.additionalProperties.type.includes('object'))) + ) { + // Add the first element which will always be the user-defined key + slugger.reset() + const id = slugger.slug(`${param.name}-${param.type}`) + param.childParamsGroups.push({ + parentName: param.name, + parentType: param.type, + id, + params: [ + { + description: `A user-defined key to represent an item in ${param.name}
.