From 5d001ddea39104d03dd0bfc53ef1cb48d0248654 Mon Sep 17 00:00:00 2001 From: Martin Weise <martin.weise@tuwien.ac.at> Date: Tue, 5 Nov 2024 21:01:26 +0100 Subject: [PATCH] Updated openAPI --- .docs/.swagger/api.yaml | 348 ++++++++++++++++++------------ .docs/.swagger/openapi-merge.json | 3 - 2 files changed, 215 insertions(+), 136 deletions(-) diff --git a/.docs/.swagger/api.yaml b/.docs/.swagger/api.yaml index a3f7eea7f2..1857e4bb3f 100644 --- a/.docs/.swagger/api.yaml +++ b/.docs/.swagger/api.yaml @@ -24,7 +24,7 @@ servers: url: 'http://localhost' externalDocs: description: Project Website - url: 'https://www.ifs.tuwien.ac.at/infrastructures/dbrepo/' + url: 'https://www.ifs.tuwien.ac.at/infrastructures/dbrepo/1.4.7/' paths: /api/analyse/datatypes: get: @@ -1102,6 +1102,64 @@ paths: security: - basicAuth: [] - bearerAuth: [] + '/api/database/{databaseId}/view/{viewId}/export': + get: + tags: + - view-endpoint + summary: Get view data + description: >- + Gets data from view with id as downloadable file. For tables in private + databases, the user needs to have at least *READ* access to the + associated database. + operationId: exportDataset + parameters: + - name: databaseId + in: path + required: true + schema: + type: integer + format: int64 + - name: viewId + in: path + required: true + schema: + type: integer + format: int64 + responses: + '200': + description: Exported view data + content: + application/json: + schema: + type: string + format: binary + '400': + description: Request pagination or view data select query is malformed + content: + application/json: + schema: + $ref: '#/components/schemas/ApiErrorDto' + '403': + description: Export view data not allowed + content: + application/json: + schema: + $ref: '#/components/schemas/ApiErrorDto' + '404': + description: Failed to find view in metadata database or export dataset + content: + application/json: + schema: + $ref: '#/components/schemas/ApiErrorDto' + '503': + description: Failed to establish connection with the metadata service + content: + application/json: + schema: + $ref: '#/components/schemas/ApiErrorDto' + security: + - basicAuth: [] + - bearerAuth: [] '/api/database/{databaseId}/table/{tableId}/statistic': get: tags: @@ -1223,7 +1281,7 @@ paths: Gets data from table with id as downloadable file. For tables in private databases, the user needs to have at least *READ* access to the associated database. - operationId: exportDataset + operationId: exportDataset_1 parameters: - name: databaseId in: path @@ -2313,12 +2371,6 @@ paths: application/json: schema: $ref: '#/components/schemas/ApiErrorDto' - '422': - description: Failed to retrieve from database sidecar - content: - application/json: - schema: - $ref: '#/components/schemas/ApiErrorDto' '502': description: Connection to data service failed content: @@ -2560,7 +2612,9 @@ paths: tags: - table-endpoint summary: Find table - description: Finds a table with id. + description: >- + Finds a table with id. When the `system` role is present, the endpoint + responds with additional connection metadata in the header. operationId: findById_2 parameters: - name: databaseId @@ -2578,6 +2632,31 @@ paths: responses: '200': description: Find table successfully + headers: + X-Username: + description: The authentication username + style: simple + X-Table: + description: The table internal name + style: simple + Access-Control-Expose-Headers: + description: Expose custom headers + style: simple + X-Type: + description: The JDBC connection type + style: simple + X-Database: + description: The database internal name + style: simple + X-Password: + description: The authentication password + style: simple + X-Host: + description: The database hostname + style: simple + X-Port: + description: The database port number + style: simple content: application/json: schema: @@ -3824,6 +3903,16 @@ paths: responses: '200': description: Database found successfully + headers: + X-Username: + description: The authentication username + style: simple + Access-Control-Expose-Headers: + description: Expose custom headers + style: simple + X-Password: + description: The authentication password + style: simple content: application/json: schema: @@ -3872,6 +3961,31 @@ paths: responses: '200': description: Find view successfully + headers: + X-Username: + description: The authentication username + style: simple + Access-Control-Expose-Headers: + description: Expose custom headers + style: simple + X-Type: + description: The JDBC connection type + style: simple + X-View: + description: The view internal name + style: simple + X-Database: + description: The database internal name + style: simple + X-Password: + description: The authentication password + style: simple + X-Host: + description: The database hostname + style: simple + X-Port: + description: The database port number + style: simple content: application/json: schema: @@ -4172,58 +4286,7 @@ paths: summary: Performs a fuzzy search tags: - search-endpoint - '/api/search/{index}': - get: - consumes: - - application/json - description: Gets the index - operationId: get_index - parameters: - - description: The search type. - in: path - name: type - required: true - schema: - enum: - - database - - table - - view - - column - - user - - identifier - - concept - - unit - type: string - - in: body - name: body - required: true - schema: - properties: - field_value_pairs: - type: object - search_term: - example: air quality - type: string - t1: - example: 0 - type: integer - t2: - example: 100 - type: integer - type: object - produces: - - application/json - responses: - '200': - content: - application/json: - schema: - $ref: '#/components/schemas/IndexDto' - description: 'OK, contains the elements formatted as an array of JSON arrays' - summary: Gets the index - tags: - - search-endpoint - '/api/search/{type}': + '/api/search/{field_type}': post: consumes: - application/json @@ -4287,7 +4350,7 @@ paths: summary: Performs a general search tags: - search-endpoint - '/api/search/{type}/fields': + '/api/search/{field_type}/fields': get: operationId: get_fields parameters: @@ -4318,56 +4381,57 @@ paths: summary: Get searchable fields tags: - search-endpoint - '/sidecar/export/{filename}': - post: + '/api/search/{index}': + get: consumes: - application/json - description: | - Exports a specific .csv file to the Storage Service via S3 + description: Gets the index + operationId: get_index parameters: - - description: Name of the object file to export to the Storage Service + - description: The search type. in: path - name: filename + name: type required: true - produces: - - application/json - responses: - '202': - content: {} - description: Exported the .csv - '400': - description: The Storage Service could not be contacted or .csv was not found. - security: - - bearerAuth: [] - - basicAuth: [] - summary: Exports a .csv to the Storage Service - tags: - - sidecar - '/sidecar/import/{filename}': - post: - consumes: - - application/json - description: | - Imports a specific .csv file from the Storage Service via S3 - parameters: - - description: Name of the object file to import from the Storage Service - in: path - name: filename + schema: + enum: + - database + - table + - view + - column + - user + - identifier + - concept + - unit + type: string + - in: body + name: body required: true + schema: + properties: + field_value_pairs: + type: object + search_term: + example: air quality + type: string + t1: + example: 0 + type: integer + t2: + example: 100 + type: integer + type: object produces: - application/json responses: - '202': - content: {} - description: Imported the .csv - '400': - description: The Storage Service could not be contacted or .csv was not found. - security: - - bearerAuth: [] - - basicAuth: [] - summary: Imports a .csv from the Storage Service + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/IndexDto' + description: 'OK, contains the elements formatted as an array of JSON arrays' + summary: Gets the index tags: - - sidecar + - search-endpoint components: securitySchemes: basicAuth: @@ -5607,6 +5671,7 @@ components: type: object ImportDto: required: + - header - location - separator type: object @@ -5614,16 +5679,17 @@ components: location: type: string example: file.csv + header: + type: boolean + description: >- + If true, the first line contains the column names, otherwise it + contains only data separator: type: string example: ',' quote: type: string example: '"' - skip_lines: - minimum: 0 - type: integer - format: int64 line_termination: type: string example: \r\n @@ -5961,8 +6027,6 @@ components: - internal_name - name - quota - - sidecar_host - - sidecar_port type: object properties: id: @@ -5993,11 +6057,6 @@ components: internal_name: type: string example: data-db - sidecar_host: - type: string - sidecar_port: - type: integer - format: int32 ui_host: type: string ui_port: @@ -6221,6 +6280,7 @@ components: - id - jdbc_method - name + - operators - registry - version type: object @@ -6240,6 +6300,10 @@ components: dialect: type: string example: org.hibernate.dialect.MariaDBDialect + operators: + type: array + items: + $ref: '#/components/schemas/OperatorDto' driver_class: type: string example: org.mariadb.jdbc.Driver @@ -6257,6 +6321,22 @@ components: type: array items: $ref: '#/components/schemas/DataTypeDto' + OperatorDto: + required: + - display_name + - documentation + - value + type: object + properties: + value: + type: string + example: XOR + documentation: + type: string + example: 'https://mariadb.com/kb/en/xor/' + display_name: + type: string + example: XOR PrimaryKeyDto: required: - column @@ -6486,8 +6566,6 @@ components: minLength: 0 type: string example: Date - alias: - type: string size: type: integer format: int64 @@ -8334,8 +8412,6 @@ components: - privileged_password - privileged_username - quota - - sidecar_host - - sidecar_port type: object properties: name: @@ -8356,11 +8432,6 @@ components: type: integer description: Image ID format: int64 - sidecar_host: - type: string - sidecar_port: - type: integer - format: int32 ui_host: type: string ui_port: @@ -8657,11 +8728,6 @@ components: port: type: integer format: int32 - sidecarHost: - type: string - sidecarPort: - type: integer - format: int32 uiHost: type: string uiPort: @@ -8725,6 +8791,10 @@ components: type: array items: $ref: '#/components/schemas/DataType' + operators: + type: array + items: + $ref: '#/components/schemas/Operator' Creator: type: object properties: @@ -9673,6 +9743,20 @@ components: type: string description: type: string + Operator: + type: object + properties: + id: + type: integer + format: int64 + displayName: + type: string + value: + type: string + documentation: + type: string + image: + $ref: '#/components/schemas/ContainerImage' PrimaryKey: type: object properties: @@ -9780,10 +9864,6 @@ components: type: string database: $ref: '#/components/schemas/Database' - columns: - type: array - items: - $ref: '#/components/schemas/TableColumn' identifiers: type: array items: @@ -9804,6 +9884,10 @@ components: avgRowLength: type: integer format: int64 + columns: + type: array + items: + $ref: '#/components/schemas/TableColumn' created: type: string format: date-time @@ -10036,8 +10120,6 @@ components: $ref: '#/components/schemas/View' name: type: string - autoGenerated: - type: boolean internalName: type: string columnType: diff --git a/.docs/.swagger/openapi-merge.json b/.docs/.swagger/openapi-merge.json index af25a7582f..6e41b75f58 100644 --- a/.docs/.swagger/openapi-merge.json +++ b/.docs/.swagger/openapi-merge.json @@ -14,9 +14,6 @@ }, { "inputFile": "./api-search.yaml" - }, - { - "inputFile": "./api-sidecar.yaml" } ], "output": "./api.yaml" -- GitLab