diff --git a/src/app/Http/Controllers/ResponseController.php b/src/app/Http/Controllers/ResponseController.php index b13a33d..0f41745 100644 --- a/src/app/Http/Controllers/ResponseController.php +++ b/src/app/Http/Controllers/ResponseController.php @@ -177,7 +177,7 @@ protected function filterDataByFieldlist( $fieldlist[] = $queries['orderBy'] ?? $initialSortColumn; $fieldlist = array_merge($defaults, $fieldlist); $fieldlist = array_unique($fieldlist); - $dataArray = $data->toArray()[0] ?: $data->toArray(); + $dataArray = $data->toArray()[0] ?? $data->toArray(); $fieldsToRemove = array_filter(array_keys($dataArray), function($field) use ($fieldlist) { return !in_array($field, $fieldlist); }); diff --git a/src/app/Http/Controllers/StoryController.php b/src/app/Http/Controllers/StoryController.php index 71c8fa0..27312f7 100644 --- a/src/app/Http/Controllers/StoryController.php +++ b/src/app/Http/Controllers/StoryController.php @@ -28,6 +28,8 @@ public function index(Request $request): JsonResponse $data = $this->getDataByRequest($request, $model, $queryColumns, $initialSortColumn); + $data = $this->filterDataByFieldlist($data, $request, ['StoryId'], $initialSortColumn); + if (!$data) { return $this->sendError('Invalid data', $request . ' not valid', 400); } diff --git a/src/public/v2/documentation/swagger-initializer.js b/src/public/v2/documentation/swagger-initializer.js index d18890e..045b4e7 100644 --- a/src/public/v2/documentation/swagger-initializer.js +++ b/src/public/v2/documentation/swagger-initializer.js @@ -1,22 +1,21 @@ window.onload = function() { - // - - // the following lines will be replaced by docker/configurator, when it runs in a docker-container - window.ui = SwaggerUIBundle({ - url: window.location.origin + "/v2/documentation/api-docs.yaml", - dom_id: '#swagger-ui', - // deepLinking: true, - persistAuthorization: true, - filter: true, - presets: [ - SwaggerUIBundle.presets.apis, - SwaggerUIStandalonePreset - ], - plugins: [ - SwaggerUIBundle.plugins.DownloadUrl - ], - layout: "StandaloneLayout" - }); - - // + window.ui = SwaggerUIBundle({ + url: window.location.origin + "/v2/documentation/api-docs.yaml", + dom_id: '#swagger-ui', + docExpansion: 'none', + deepLinking: true, + persistAuthorization: true, + filter: true, + defaultModelsExpandDepth: 0, + docExpansion: 'none', + tagsSorter: 'alpha', + presets: [ + SwaggerUIBundle.presets.apis, + SwaggerUIStandalonePreset, + ], + plugins: [ + // SwaggerUIBundle.plugins.DownloadUrl + ], + layout: 'StandaloneLayout', + }); }; diff --git a/src/storage/api-docs/api-docs.yaml b/src/storage/api-docs/api-docs.yaml index 07c3b77..69e8711 100644 --- a/src/storage/api-docs/api-docs.yaml +++ b/src/storage/api-docs/api-docs.yaml @@ -1,7 +1,7 @@ openapi: 3.1.1 info: - version: 1.56.0 + version: 1.57.0 title: Transcribathon Platform API v2 description: This is the documentation of the Transcribathon API v2 used by [https:transcribathon.eu](https://transcribathon.eu/).
For authorization you can use the the bearer token you are provided with. diff --git a/src/storage/api-docs/stories-path.yaml b/src/storage/api-docs/stories-path.yaml index 87ace1e..11f4d2b 100644 --- a/src/storage/api-docs/stories-path.yaml +++ b/src/storage/api-docs/stories-path.yaml @@ -37,6 +37,10 @@ get: description: Determine the type of query for the parameter (DcTitle, RecordId). If set, a broad search ( LIKE %term%) is processed otherwise the exact term is searched for schema: type: boolean + - in: query + name: fieldlist + description: Comma-separated list of fields that will be shown in the response + type: string responses: 200: description: Ok