Bug 28272: Prevent api spec to accept extra parameters
authorJonathan Druart <jonathan.druart@bugs.koha-community.org>
Thu, 6 May 2021 13:11:51 +0000 (15:11 +0200)
committerJonathan Druart <jonathan.druart@bugs.koha-community.org>
Mon, 10 May 2021 08:28:02 +0000 (10:28 +0200)
Some of our definition files are missing { additionalProperties: false }
We must have it to make sure all properties are defined and prevent the
spec to accept extra parameters (being more strict but also allowing to
catch errors more easily)

grep -rL additionalProperties api/v1/swagger/definitions/*.json

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
19 files changed:
api/v1/swagger/definitions/account_line.json
api/v1/swagger/definitions/allows_renewal.json
api/v1/swagger/definitions/basket.json
api/v1/swagger/definitions/cashup.json
api/v1/swagger/definitions/checkout.json
api/v1/swagger/definitions/checkouts.json
api/v1/swagger/definitions/club_hold.json
api/v1/swagger/definitions/club_hold_patron_hold.json
api/v1/swagger/definitions/club_hold_patron_holds.json
api/v1/swagger/definitions/club_holds.json
api/v1/swagger/definitions/error.json
api/v1/swagger/definitions/hold.json
api/v1/swagger/definitions/holds.json
api/v1/swagger/definitions/ill_backend.json
api/v1/swagger/definitions/ill_backends.json
api/v1/swagger/definitions/import_batch_profile.json
api/v1/swagger/definitions/import_batch_profiles.json
api/v1/swagger/definitions/patron_account_credit.json
api/v1/swagger/definitions/return_claim.json

index 04c6155..ddf9016 100644 (file)
@@ -97,5 +97,6 @@
       ],
       "description": "Internal identifier for the library in which the transaction took place"
     }
-  }
+  },
+  "additionalProperties": false
 }
index 6db074b..9c40ced 100644 (file)
@@ -17,5 +17,6 @@
       "type": ["string", "null"],
       "description": "Description on false allows_renewal."
     }
-  }
+  },
+  "additionalProperties": false
 }
index e5b3b91..c5f0642 100644 (file)
@@ -95,5 +95,6 @@
             ],
             "description": "When items should be created for orders in this basket (Options: 'ordering', 'receiving', 'cataloguing'. Null means system wide config)"
         }
-    }
+    },
+    "additionalProperties": false
 }
index e643a9c..a4c5a42 100644 (file)
@@ -26,5 +26,6 @@
             "type": "object",
             "description": "A summary of the cashup action"
         }
-    }
+    },
+    "additionalProperties": false
 }
index 6976d5d..8540ea7 100644 (file)
@@ -79,6 +79,7 @@
           "null"
       ],
       "description": "The object representing the checkout issuer"
-  }
-}
+    }
+  },
+  "additionalProperties": false
 }
index b6562f9..bc3ff67 100644 (file)
@@ -2,5 +2,6 @@
   "type": "array",
   "items": {
     "$ref": "checkout.json"
-  }
+  },
+  "additionalProperties": false
 }
index 5a270bc..68cede6 100644 (file)
@@ -17,5 +17,6 @@
         "type": ["string", "null"],
         "description": "Internal item identifier"
       }
-    }
-  }
+    },
+    "additionalProperties": false
+}
index 1f33814..43b1097 100644 (file)
@@ -26,5 +26,6 @@
         "type": ["string", "null"],
         "description": "Generic error message"
       }
-    }
-  }
+    },
+    "additionalProperties": false
+}
index ff7b6e5..b2ae356 100644 (file)
@@ -2,5 +2,6 @@
     "type": "array",
     "items": {
       "$ref": "club_hold_patron_hold.json"
-    }
-}
\ No newline at end of file
+    },
+    "additionalProperties": false
+}
index b484840..2de3163 100644 (file)
@@ -2,5 +2,6 @@
     "type": "array",
     "items": {
       "$ref": "club_hold.json"
-    }
-}
\ No newline at end of file
+    },
+    "additionalProperties": false
+}
index e43673f..b0fe4fc 100644 (file)
@@ -5,5 +5,6 @@
       "description": "Error message",
       "type": "string"
     }
-  }
+  },
+  "additionalProperties": false
 }
index 6a018e9..58f3234 100644 (file)
@@ -83,5 +83,6 @@
       "type": "boolean",
       "description": "If the hold is placed at item level"
     }
-  }
+  },
+  "additionalProperties": false
 }
index e551885..b2ee4a6 100644 (file)
@@ -2,5 +2,6 @@
   "type": "array",
   "items": {
     "$ref": "hold.json"
-  }
+  },
+  "additionalProperties": false
 }
index f67dc47..34199e0 100644 (file)
@@ -9,5 +9,6 @@
       "type": "object",
       "description": "List of capabilities"
     }
-  }
+  },
+  "additionalProperties": false
 }
index fc68c50..2cdd5c4 100644 (file)
@@ -2,5 +2,6 @@
   "type": "array",
   "items": {
     "$ref": "ill_backend.json"
-  }
+  },
+  "additionalProperties": false
 }
index fde0393..98e3aa8 100644 (file)
@@ -49,5 +49,6 @@
       "description": "any comments added when the file was uploaded",
       "type": ["string", "null"]
     }
-  }
-}
\ No newline at end of file
+  },
+  "additionalProperties": false
+}
index 4c2b17b..e02e589 100644 (file)
@@ -2,5 +2,6 @@
     "type": "array",
     "items": {
       "$ref": "import_batch_profile.json"
-    }
-  }
\ No newline at end of file
+    },
+    "additionalProperties": false
+}
index ba156fe..74ed408 100644 (file)
@@ -39,5 +39,6 @@
       "description": "Internal note"
     }
   },
-  "required": [ "amount" ]
+  "required": [ "amount" ],
+  "additionalProperties": false
 }
index 62f2bae..f23812a 100644 (file)
@@ -89,5 +89,6 @@
       ],
       "description": "patron id of librarian who resolved this claim"
     }
-  }
+  },
+  "additionalProperties": false
 }