From 55f76570db4c6469df0a4104d5d0b97fe570e04d Mon Sep 17 00:00:00 2001 From: Richard van der Hoff Date: Tue, 23 Apr 2024 19:44:30 +0100 Subject: [PATCH] Improve comments in `render-object-table` Just documenting the current situation. --- .../partials/openapi/render-object-table.html | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/layouts/partials/openapi/render-object-table.html b/layouts/partials/openapi/render-object-table.html index 6faa21d9..2c59401d 100644 --- a/layouts/partials/openapi/render-object-table.html +++ b/layouts/partials/openapi/render-object-table.html @@ -9,11 +9,11 @@ * `properties`: optional dictionary of the properties to list, each given as: `property_name` : `property_data` - * `additionalProperties`: optional dictionary for properties with undefined - names, in the same format as `property_data` + * `additionalProperties`: an OpenAPI schema document for additional properties + on the object. * `patternProperties`: optional dictionary for properties with names adhering - to a regex pattern, in the same format as `property_data` + to a regex pattern. A map from regex pattern to OpenAPI schema document. * `required`: optional array containing the names of required properties. In some cases (such as response body specifications) this isn't used, and @@ -55,6 +55,15 @@ {{ else if (or .additionalProperties .patternProperties) }} + +{{/* +A special format of table for objects which only have additionalProperties or patternProperties. + +This is only ever used for top-level objects. Nested objects in this situation are just shown +as rows within their parent object, and don't get their own table. (They are filtered out in +resolve-additional-types.) +*/}} + {{ with $title }} {{ . }} @@ -113,7 +122,7 @@ {{ else if or (reflect.IsSlice .type) .oneOf }} {{/* It's legal to specify an array of types. - + There are two ways to do that: - Use an array of strings. - Use oneOf, with items having a schema.