Skip to content

Commit

Permalink
Ensure ApiPath does not get a NullReferenceExcepton when copying comm…
Browse files Browse the repository at this point in the history
…on parameters to operation method parameters. (#5914)

Previously, when the operation method does not have any parameters a null refference exception occurs when attempting to copy the common parameters to the operation metod.
  • Loading branch information
AaronPatterson authored Apr 14, 2023
1 parent fbac9fb commit aef61a7
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@ public Dictionary<string, Operation> operations
{
if (this.parameters != null)
{
if (operation.parameters == null)
{
operation.parameters = new List<Parameter>();
}

operation.parameters.AddRange(this.parameters);
}
ret.Add(method, operation);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@
},
"paths": {
"/deployments": {
"parameters": [
{
"$ref": "#/parameters/apiVersionQueryParameter"
}
],
"get": {
"tags": [
"Deployments:"
Expand All @@ -16,11 +21,6 @@
"produces": [
"application/json"
],
"parameters": [
{
"$ref": "#/parameters/apiVersionQueryParameter"
}
],
"responses": {
"200": {
"description": "Success",
Expand Down Expand Up @@ -54,9 +54,6 @@
"application/json"
],
"parameters": [
{
"$ref": "#/parameters/apiVersionQueryParameter"
},
{
"in": "body",
"name": "body",
Expand Down

0 comments on commit aef61a7

Please sign in to comment.