Don't show not listable entites in Swagger UI (fixes #510)

This commit is contained in:
Bernd Bestel 2020-01-23 20:05:44 +01:00
parent b4997abf75
commit 469dcefc7a
No known key found for this signature in database
GPG Key ID: 71BD34C0D4891300
2 changed files with 23 additions and 5 deletions

View File

@ -171,6 +171,6 @@ class GenericEntityApiController extends BaseApiController
private function IsEntityWithPreventedListing($entity) private function IsEntityWithPreventedListing($entity)
{ {
return in_array($entity, $this->OpenApiSpec->components->internalSchemas->ExposedEntitiesPreventListing->enum); return !in_array($entity, $this->OpenApiSpec->components->internalSchemas->ExposedEntityButNoListing->enum);
} }
} }

View File

@ -129,7 +129,7 @@
"required": true, "required": true,
"description": "A valid entity name", "description": "A valid entity name",
"schema": { "schema": {
"$ref": "#/components/internalSchemas/ExposedEntity" "$ref": "#/components/internalSchemas/ExposedEntityButNoListing"
} }
} }
], ],
@ -274,7 +274,7 @@
"required": true, "required": true,
"description": "A valid entity name", "description": "A valid entity name",
"schema": { "schema": {
"$ref": "#/components/internalSchemas/ExposedEntity" "$ref": "#/components/internalSchemas/ExposedEntityButNoListing"
} }
}, },
{ {
@ -3275,10 +3275,28 @@
"meal_plan" "meal_plan"
] ]
}, },
"ExposedEntitiesPreventListing": { "ExposedEntityButNoListing": {
"type": "string", "type": "string",
"enum": [ "enum": [
"api_keys" "products",
"chores",
"batteries",
"locations",
"quantity_units",
"quantity_unit_conversions",
"shopping_list",
"shopping_lists",
"recipes",
"recipes_pos",
"recipes_nestings",
"tasks",
"task_categories",
"product_groups",
"equipment",
"userfields",
"userentities",
"userobjects",
"meal_plan"
] ]
}, },
"StockTransactionType": { "StockTransactionType": {