diff --git a/.docs/.openapi/api-data.yaml b/.docs/.openapi/api-data.yaml index 7be3a4039aea0f8d10bf8fb1ba324c23503710a7..f61466dc6b8dbf4ab405be438bb03b4edbd1b29e 100644 --- a/.docs/.openapi/api-data.yaml +++ b/.docs/.openapi/api-data.yaml @@ -59,18 +59,6 @@ paths: type: string format: date-time responses: - "400": - description: Request pagination is malformed - content: - application/json: - schema: - $ref: "#/components/schemas/ApiErrorDto" - "403": - description: Not allowed to retrieve view data - content: - application/json: - schema: - $ref: "#/components/schemas/ApiErrorDto" "200": description: Retrieved view data headers: @@ -86,8 +74,8 @@ paths: application/json: schema: type: string - "409": - description: View schema could not be mapped + "503": + description: Failed to establish connection with the metadata service content: application/json: schema: @@ -98,8 +86,20 @@ paths: application/json: schema: $ref: "#/components/schemas/ApiErrorDto" - "503": - description: Failed to establish connection with the metadata service + "409": + description: View schema could not be mapped + content: + application/json: + schema: + $ref: "#/components/schemas/ApiErrorDto" + "400": + description: Request pagination is malformed + content: + application/json: + schema: + $ref: "#/components/schemas/ApiErrorDto" + "403": + description: Not allowed to retrieve view data content: application/json: schema: @@ -147,18 +147,6 @@ paths: type: string format: date-time responses: - "400": - description: Request pagination is malformed - content: - application/json: - schema: - $ref: "#/components/schemas/ApiErrorDto" - "403": - description: Not allowed to retrieve view data - content: - application/json: - schema: - $ref: "#/components/schemas/ApiErrorDto" "200": description: Retrieved view data headers: @@ -174,8 +162,8 @@ paths: application/json: schema: type: string - "409": - description: View schema could not be mapped + "503": + description: Failed to establish connection with the metadata service content: application/json: schema: @@ -186,8 +174,20 @@ paths: application/json: schema: $ref: "#/components/schemas/ApiErrorDto" - "503": - description: Failed to establish connection with the metadata service + "409": + description: View schema could not be mapped + content: + application/json: + schema: + $ref: "#/components/schemas/ApiErrorDto" + "400": + description: Request pagination is malformed + content: + application/json: + schema: + $ref: "#/components/schemas/ApiErrorDto" + "403": + description: Not allowed to retrieve view data content: application/json: schema: @@ -237,14 +237,14 @@ paths: type: integer format: int64 responses: - "404": - description: Failed to find table in metadata database + "400": + description: Request pagination or table data select query is malformed content: application/json: schema: $ref: "#/components/schemas/ApiErrorDto" - "400": - description: Request pagination or table data select query is malformed + "503": + description: Failed to establish connection with the metadata service content: application/json: schema: @@ -264,14 +264,14 @@ paths: application/json: schema: type: string - "403": - description: Not allowed to get table data + "404": + description: Failed to find table in metadata database content: application/json: schema: $ref: "#/components/schemas/ApiErrorDto" - "503": - description: Failed to establish connection with the metadata service + "403": + description: Not allowed to get table data content: application/json: schema: @@ -312,32 +312,32 @@ paths: $ref: "#/components/schemas/TupleUpdateDto" required: true responses: - "404": - description: Failed to find table in metadata database + "400": + description: Request pagination or table data select query is malformed content: application/json: schema: $ref: "#/components/schemas/ApiErrorDto" - "400": - description: Request pagination or table data select query is malformed + "503": + description: Failed to establish connection with the metadata service content: application/json: schema: $ref: "#/components/schemas/ApiErrorDto" - "202": - description: Updated table data "403": description: Update table data not allowed content: application/json: schema: $ref: "#/components/schemas/ApiErrorDto" - "503": - description: Failed to establish connection with the metadata service + "404": + description: Failed to find table in metadata database content: application/json: schema: $ref: "#/components/schemas/ApiErrorDto" + "202": + description: Updated table data security: - basicAuth: [] - bearerAuth: [] @@ -374,30 +374,30 @@ paths: $ref: "#/components/schemas/TupleDto" required: true responses: - "503": - description: Failed to establish connection with the metadata service or - storage service - content: - application/json: - schema: - $ref: "#/components/schemas/ApiErrorDto" "400": description: Request pagination or table data select query is malformed content: application/json: schema: $ref: "#/components/schemas/ApiErrorDto" - "403": - description: Create table data not allowed + "404": + description: Failed to find table in metadata database or blob in storage + service content: application/json: schema: $ref: "#/components/schemas/ApiErrorDto" "201": description: Created table data - "404": - description: Failed to find table in metadata database or blob in storage - service + "503": + description: Failed to establish connection with the metadata service or + storage service + content: + application/json: + schema: + $ref: "#/components/schemas/ApiErrorDto" + "403": + description: Create table data not allowed content: application/json: schema: @@ -438,28 +438,28 @@ paths: $ref: "#/components/schemas/TupleDeleteDto" required: true responses: - "404": - description: Failed to find table in metadata database + "400": + description: Request pagination or table data select query is malformed content: application/json: schema: $ref: "#/components/schemas/ApiErrorDto" - "400": - description: Request pagination or table data select query is malformed + "503": + description: Failed to establish connection with the metadata service content: application/json: schema: $ref: "#/components/schemas/ApiErrorDto" - "403": - description: Delete table data not allowed + "404": + description: Failed to find table in metadata database content: application/json: schema: $ref: "#/components/schemas/ApiErrorDto" "202": description: Deleted table data - "503": - description: Failed to establish connection with the metadata service + "403": + description: Delete table data not allowed content: application/json: schema: @@ -508,14 +508,14 @@ paths: type: integer format: int64 responses: - "404": - description: Failed to find table in metadata database + "400": + description: Request pagination or table data select query is malformed content: application/json: schema: $ref: "#/components/schemas/ApiErrorDto" - "400": - description: Request pagination or table data select query is malformed + "503": + description: Failed to establish connection with the metadata service content: application/json: schema: @@ -535,14 +535,14 @@ paths: application/json: schema: type: string - "403": - description: Not allowed to get table data + "404": + description: Failed to find table in metadata database content: application/json: schema: $ref: "#/components/schemas/ApiErrorDto" - "503": - description: Failed to establish connection with the metadata service + "403": + description: Not allowed to get table data content: application/json: schema: @@ -586,9 +586,8 @@ paths: type: integer format: int64 responses: - "404": - description: Failed to find database in metadata database or query in query - store of the data database + "503": + description: Failed to communicate with database content: application/json: schema: @@ -599,12 +598,6 @@ paths: application/json: schema: $ref: "#/components/schemas/ApiErrorDto" - "400": - description: Invalid pagination - content: - application/json: - schema: - $ref: "#/components/schemas/ApiErrorDto" "200": description: Retrieved subset data headers: @@ -626,8 +619,15 @@ paths: application/json: schema: type: string - "503": - description: Failed to communicate with database + "404": + description: Failed to find database in metadata database or query in query + store of the data database + content: + application/json: + schema: + $ref: "#/components/schemas/ApiErrorDto" + "400": + description: Invalid pagination content: application/json: schema: @@ -670,9 +670,8 @@ paths: type: integer format: int64 responses: - "404": - description: Failed to find database in metadata database or query in query - store of the data database + "503": + description: Failed to communicate with database content: application/json: schema: @@ -683,12 +682,6 @@ paths: application/json: schema: $ref: "#/components/schemas/ApiErrorDto" - "400": - description: Invalid pagination - content: - application/json: - schema: - $ref: "#/components/schemas/ApiErrorDto" "200": description: Retrieved subset data headers: @@ -710,8 +703,15 @@ paths: application/json: schema: type: string - "503": - description: Failed to communicate with database + "404": + description: Failed to find database in metadata database or query in query + store of the data database + content: + application/json: + schema: + $ref: "#/components/schemas/ApiErrorDto" + "400": + description: Invalid pagination content: application/json: schema: @@ -746,13 +746,6 @@ paths: $ref: "#/components/schemas/QueryPersistDto" required: true responses: - "404": - description: Failed to find database in metadata database or query in query - store of the data database - content: - application/json: - schema: - $ref: "#/components/schemas/ApiErrorDto" "202": description: Persisted subset content: @@ -765,8 +758,8 @@ paths: application/json: schema: $ref: "#/components/schemas/ApiErrorDto" - "400": - description: Malformed select query + "503": + description: Failed to communicate with database content: application/json: schema: @@ -777,8 +770,15 @@ paths: application/json: schema: $ref: "#/components/schemas/ApiErrorDto" - "503": - description: Failed to communicate with database + "400": + description: Malformed select query + content: + application/json: + schema: + $ref: "#/components/schemas/ApiErrorDto" + "404": + description: Failed to find database in metadata database or query in query + store of the data database content: application/json: schema: @@ -823,8 +823,8 @@ paths: responses: "202": description: Imported dataset successfully - "403": - description: Import table dataset not allowed + "503": + description: Failed to establish connection with the metadata service content: application/json: schema: @@ -835,14 +835,14 @@ paths: application/json: schema: $ref: "#/components/schemas/ApiErrorDto" - "400": - description: Dataset and/or query are malformed + "403": + description: Import table dataset not allowed content: application/json: schema: $ref: "#/components/schemas/ApiErrorDto" - "503": - description: Failed to establish connection with the metadata service + "400": + description: Dataset and/or query are malformed content: application/json: schema: @@ -874,8 +874,16 @@ paths: schema: type: boolean responses: - "403": - description: Not allowed to find subsets + "200": + description: Found subsets + content: + application/json: + schema: + type: array + items: + $ref: "#/components/schemas/QueryDto" + "503": + description: Failed to communicate with database content: application/json: schema: @@ -887,16 +895,8 @@ paths: application/json: schema: $ref: "#/components/schemas/ApiErrorDto" - "200": - description: Found subsets - content: - application/json: - schema: - type: array - items: - $ref: "#/components/schemas/QueryDto" - "503": - description: Failed to communicate with database + "403": + description: Not allowed to find subsets content: application/json: schema: @@ -945,33 +945,32 @@ paths: $ref: "#/components/schemas/ExecuteStatementDto" required: true responses: - "404": - description: Failed to find database in metadata database or query in query - store of the data database + "403": + description: Not allowed to find subset content: application/json: schema: $ref: "#/components/schemas/ApiErrorDto" - "400": - description: Malformed select query + "501": + description: Failed to execute query as it contains non-supported keywords content: application/json: schema: $ref: "#/components/schemas/ApiErrorDto" - "501": - description: Failed to execute query as it contains non-supported keywords + "503": + description: Failed to communicate with database content: application/json: schema: $ref: "#/components/schemas/ApiErrorDto" - "417": - description: Failed to insert query into query store of data database + "400": + description: Malformed select query content: application/json: schema: $ref: "#/components/schemas/ApiErrorDto" - "503": - description: Failed to communicate with database + "417": + description: Failed to insert query into query store of data database content: application/json: schema: @@ -982,8 +981,9 @@ paths: application/json: schema: type: string - "403": - description: Not allowed to find subset + "404": + description: Failed to find database in metadata database or query in query + store of the data database content: application/json: schema: @@ -1020,12 +1020,6 @@ paths: type: string format: date-time responses: - "403": - description: Export view data not allowed - content: - application/json: - schema: - $ref: "#/components/schemas/ApiErrorDto" "400": description: Request pagination or view data select query is malformed content: @@ -1039,6 +1033,12 @@ paths: schema: type: string format: binary + "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: @@ -1089,8 +1089,14 @@ paths: application/json: schema: $ref: "#/components/schemas/ApiErrorDto" - "403": - description: Find table history not allowed + "503": + description: Failed to establish connection with the metadata service + content: + application/json: + schema: + $ref: "#/components/schemas/ApiErrorDto" + "404": + description: Failed to find table history in data database content: application/json: schema: @@ -1103,14 +1109,8 @@ paths: type: array items: $ref: "#/components/schemas/TableHistoryDto" - "404": - description: Failed to find table history in data database - content: - application/json: - schema: - $ref: "#/components/schemas/ApiErrorDto" - "503": - description: Failed to establish connection with the metadata service + "403": + description: Find table history not allowed content: application/json: schema: @@ -1147,12 +1147,24 @@ paths: type: string format: date-time responses: + "400": + description: Request pagination or table data select query is malformed + content: + application/json: + schema: + $ref: "#/components/schemas/ApiErrorDto" "403": description: Export table data not allowed 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" "404": description: Failed to find table in metadata database content: @@ -1166,18 +1178,6 @@ paths: schema: type: string format: binary - "400": - description: Request pagination or table data select query is malformed - 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: [] @@ -1217,22 +1217,14 @@ paths: type: string format: date-time responses: - "200": - description: Found subset - content: - application/json: - schema: - $ref: "#/components/schemas/QueryDto" - text/csv: {} - "404": - description: Failed to find database in metadata database or query in query - store of the data database + "403": + description: Not allowed to find subset content: application/json: schema: $ref: "#/components/schemas/ApiErrorDto" - "400": - description: Malformed select query + "406": + description: Failed to find acceptable representation content: application/json: schema: @@ -1243,14 +1235,22 @@ paths: application/json: schema: $ref: "#/components/schemas/ApiErrorDto" - "403": - description: Not allowed to find subset + "400": + description: Malformed select query content: application/json: schema: $ref: "#/components/schemas/ApiErrorDto" - "406": - description: Failed to find acceptable representation + "200": + description: Found subset + content: + application/json: + schema: + $ref: "#/components/schemas/QueryDto" + text/csv: {} + "404": + description: Failed to find database in metadata database or query in query + store of the data database content: application/json: schema: @@ -1356,10 +1356,18 @@ components: type: object additionalProperties: type: object + example: + key: value + example: + key: value keys: type: object additionalProperties: type: object + example: + id: 1 + example: + id: 1 QueryPersistDto: required: - persist @@ -1368,13 +1376,58 @@ components: persist: type: boolean example: true + CreatorBriefDto: + required: + - creator_name + - id + type: object + properties: + id: + type: integer + format: int64 + example: 11 + affiliation: + type: string + example: Brown University + creator_name: + type: string + example: "Carberry, Josiah" + name_type: + type: string + example: Personal + enum: + - Personal + - Organizational + name_identifier: + type: string + example: 0000-0002-1825-0097 + name_identifier_scheme: + type: string + example: ORCID + enum: + - ORCID + - ROR + - ISNI + - GRID + affiliation_identifier: + type: string + example: https://ror.org/05gq02987 + affiliation_identifier_scheme: + type: string + example: ROR + enum: + - ROR + - GRID + - ISNI IdentifierBriefDto: required: - - created_by + - creators - database_id - id + - owned_by - publication_year - publisher + - status - titles - type type: object @@ -1382,13 +1435,19 @@ components: id: type: integer format: int64 + example: 2 type: type: string + example: database enum: - database - subset - table - view + creators: + type: array + items: + $ref: "#/components/schemas/CreatorBriefDto" titles: type: array items: @@ -1401,6 +1460,7 @@ components: example: TU Wien status: type: string + example: draft enum: - draft - published @@ -1424,9 +1484,10 @@ components: type: integer format: int32 example: 2022 - created_by: + owned_by: type: string format: uuid + example: 2f45ef7a-7f9b-4667-9156-152c87fe1ca5 IdentifierTitleDto: required: - id @@ -1435,6 +1496,7 @@ components: id: type: integer format: int64 + example: 4 title: type: string example: Airquality Demonstrator @@ -1649,6 +1711,7 @@ components: id: type: integer format: int64 + example: 4 owner: $ref: "#/components/schemas/UserBriefDto" execution: @@ -1671,6 +1734,7 @@ components: database_id: type: integer format: int64 + example: 1 query_normalized: type: string example: SELECT `id` FROM `air_quality` @@ -1725,6 +1789,10 @@ components: type: object additionalProperties: type: object + example: + key: value + example: + key: value ImportDto: required: - header @@ -1739,6 +1807,7 @@ components: type: boolean description: "If true, the first line contains the column names, otherwise\ \ it contains only data" + example: true separator: type: string example: "," @@ -1782,6 +1851,10 @@ components: type: object additionalProperties: type: object + example: + id: 1 + example: + id: 1 securitySchemes: basicAuth: type: http diff --git a/.docs/.openapi/api-metadata.yaml b/.docs/.openapi/api-metadata.yaml index 5578822fb407e254544a2b532ef439174956ea45..2696cecd0cfc1b7440e8cdf57615e52eddbf53bd 100644 --- a/.docs/.openapi/api-metadata.yaml +++ b/.docs/.openapi/api-metadata.yaml @@ -64,8 +64,8 @@ paths: $ref: "#/components/schemas/DatabaseCreateDto" required: true responses: - "409": - description: Query store could not be created + "503": + description: Failed to save in search service content: application/json: schema: @@ -95,24 +95,24 @@ paths: application/json: schema: $ref: "#/components/schemas/ApiErrorDto" - "503": - description: Failed to save in search service + "201": + description: Created a new database content: application/json: schema: - $ref: "#/components/schemas/ApiErrorDto" - "404": - description: Failed to fin container/user/database in metadata database + $ref: "#/components/schemas/DatabaseBriefDto" + "409": + description: Query store could not be created content: application/json: schema: $ref: "#/components/schemas/ApiErrorDto" - "201": - description: Created a new database + "404": + description: Failed to fin container/user/database in metadata database content: application/json: schema: - $ref: "#/components/schemas/DatabaseBriefDto" + $ref: "#/components/schemas/ApiErrorDto" security: - bearerAuth: [] - basicAuth: [] @@ -173,12 +173,6 @@ paths: type: string format: uuid responses: - "403": - description: No access to this database - content: - application/json: - schema: - $ref: "#/components/schemas/ApiErrorDto" "404": description: Database not found content: @@ -191,6 +185,12 @@ paths: application/json: schema: $ref: "#/components/schemas/DatabaseAccessDto" + "403": + description: No access to this database + content: + application/json: + schema: + $ref: "#/components/schemas/ApiErrorDto" security: - bearerAuth: [] - basicAuth: [] @@ -218,7 +218,7 @@ paths: content: application/json: schema: - $ref: "#/components/schemas/UpdateDatabaseAccessDto" + $ref: "#/components/schemas/CreateAccessDto" required: true responses: "404": @@ -227,9 +227,9 @@ paths: application/json: schema: $ref: "#/components/schemas/ApiErrorDto" - "403": - description: Modify access not permitted when no access is granted in the - first place + "502": + description: Access could not be updated due to connection error in the + data service content: application/json: schema: @@ -242,15 +242,15 @@ paths: $ref: "#/components/schemas/ApiErrorDto" "202": description: Modified access - "502": - description: Access could not be updated due to connection error in the - data service + "400": + description: Modify access query or database connection is malformed content: application/json: schema: $ref: "#/components/schemas/ApiErrorDto" - "400": - description: Modify access query or database connection is malformed + "403": + description: Modify access not permitted when no access is granted in the + first place content: application/json: schema: @@ -282,41 +282,41 @@ paths: content: application/json: schema: - $ref: "#/components/schemas/UpdateDatabaseAccessDto" + $ref: "#/components/schemas/CreateAccessDto" required: true responses: - "404": - description: Database or user not found + "400": + description: Granting access query or database connection is malformed content: application/json: schema: $ref: "#/components/schemas/ApiErrorDto" - "503": - description: Access could not be created in the data service + "403": + description: Failed giving access content: application/json: schema: $ref: "#/components/schemas/ApiErrorDto" - "403": - description: Failed giving access + "404": + description: Database or user not found content: application/json: schema: $ref: "#/components/schemas/ApiErrorDto" - "202": - description: Granting access succeeded + "502": + description: Access could not be created due to connection error content: application/json: schema: - $ref: "#/components/schemas/DatabaseAccessDto" - "400": - description: Granting access query or database connection is malformed + $ref: "#/components/schemas/ApiErrorDto" + "202": + description: Granting access succeeded content: application/json: schema: - $ref: "#/components/schemas/ApiErrorDto" - "502": - description: Access could not be created due to connection error + $ref: "#/components/schemas/DatabaseAccessDto" + "503": + description: Access could not be created in the data service content: application/json: schema: @@ -345,6 +345,12 @@ paths: type: string format: uuid responses: + "503": + description: Access could not be revoked in the data service + content: + application/json: + schema: + $ref: "#/components/schemas/ApiErrorDto" "403": description: Revoke of access not permitted as no access was found content: @@ -365,12 +371,6 @@ paths: application/json: schema: $ref: "#/components/schemas/ApiErrorDto" - "503": - description: Access could not be revoked in the data service - content: - application/json: - schema: - $ref: "#/components/schemas/ApiErrorDto" "400": description: Modify access query or database connection is malformed content: @@ -404,12 +404,6 @@ paths: type: string format: uuid responses: - "403": - description: No access to this database - content: - application/json: - schema: - $ref: "#/components/schemas/ApiErrorDto" "404": description: Database not found content: @@ -422,6 +416,12 @@ paths: application/json: schema: $ref: "#/components/schemas/DatabaseAccessDto" + "403": + description: No access to this database + content: + application/json: + schema: + $ref: "#/components/schemas/ApiErrorDto" security: - bearerAuth: [] - basicAuth: [] @@ -443,6 +443,12 @@ paths: type: string format: uuid responses: + "403": + description: Find user is not permitted + content: + application/json: + schema: + $ref: "#/components/schemas/ApiErrorDto" "404": description: User was not found content: @@ -455,12 +461,6 @@ paths: application/json: schema: $ref: "#/components/schemas/UserDto" - "403": - description: Find user is not permitted - content: - application/json: - schema: - $ref: "#/components/schemas/ApiErrorDto" security: - bearerAuth: [] - basicAuth: [] @@ -484,14 +484,8 @@ paths: $ref: "#/components/schemas/UserUpdateDto" required: true responses: - "202": - description: Modified user information - content: - application/json: - schema: - $ref: "#/components/schemas/UserDto" - "404": - description: Failed to find database/user in metadata database + "403": + description: Not allowed to modify user metadata content: application/json: schema: @@ -502,8 +496,14 @@ paths: application/json: schema: $ref: "#/components/schemas/ApiErrorDto" - "403": - description: Not allowed to modify user metadata + "202": + description: Modified user information + content: + application/json: + schema: + $ref: "#/components/schemas/UserDto" + "404": + description: Failed to find database/user in metadata database content: application/json: schema: @@ -540,14 +540,14 @@ paths: $ref: "#/components/schemas/ApiErrorDto" "202": description: Modified user password - "403": - description: Not allowed to change foreign user password + "502": + description: Connection to auth service failed content: application/json: schema: $ref: "#/components/schemas/ApiErrorDto" - "503": - description: Failed to get user in auth service + "403": + description: Not allowed to change foreign user password content: application/json: schema: @@ -558,8 +558,8 @@ paths: application/json: schema: $ref: "#/components/schemas/ApiErrorDto" - "502": - description: Connection to auth service failed + "503": + description: Failed to get user in auth service content: application/json: schema: @@ -581,24 +581,24 @@ paths: $ref: "#/components/schemas/RefreshTokenRequestDto" required: true responses: - "202": - description: Refreshed user token + "400": + description: Invalid refresh token content: application/json: schema: - $ref: "#/components/schemas/TokenDto" + $ref: "#/components/schemas/ApiErrorDto" "403": description: Not allowed content: application/json: schema: $ref: "#/components/schemas/ApiErrorDto" - "400": - description: Invalid refresh token + "202": + description: Refreshed user token content: application/json: schema: - $ref: "#/components/schemas/ApiErrorDto" + $ref: "#/components/schemas/TokenDto" "502": description: Connection to auth service failed content: @@ -618,8 +618,9 @@ paths: $ref: "#/components/schemas/LoginRequestDto" required: true responses: - "400": - description: Invalid login request + "428": + description: Account is not fully setup in auth service (requires password + change?) content: application/json: schema: @@ -630,33 +631,32 @@ paths: application/json: schema: $ref: "#/components/schemas/ApiErrorDto" - "404": - description: Failed to find user in auth database + "202": + description: Obtained user token content: application/json: schema: - $ref: "#/components/schemas/ApiErrorDto" - "503": - description: Failed to get user in auth service + $ref: "#/components/schemas/TokenDto" + "404": + description: Failed to find user in auth database content: application/json: schema: $ref: "#/components/schemas/ApiErrorDto" - "202": - description: Obtained user token + "502": + description: Connection to auth service failed content: application/json: schema: - $ref: "#/components/schemas/TokenDto" - "428": - description: Account is not fully setup in auth service (requires password - change?) + $ref: "#/components/schemas/ApiErrorDto" + "400": + description: Invalid login request content: application/json: schema: $ref: "#/components/schemas/ApiErrorDto" - "502": - description: Connection to auth service failed + "503": + description: Failed to get user in auth service content: application/json: schema: @@ -737,16 +737,16 @@ paths: type: integer format: int64 responses: - "202": - description: Deleted ontology successfully - content: - application/json: {} "404": description: Could not find ontology content: application/json: schema: $ref: "#/components/schemas/ApiErrorDto" + "202": + description: Deleted ontology successfully + content: + application/json: {} security: - bearerAuth: [] - basicAuth: [] @@ -828,18 +828,18 @@ paths: type: integer format: int64 responses: - "404": - description: Image could not be found - content: - application/json: - schema: - $ref: "#/components/schemas/ApiErrorDto" "200": description: Found image content: application/json: schema: $ref: "#/components/schemas/ImageDto" + "404": + description: Image could not be found + content: + application/json: + schema: + $ref: "#/components/schemas/ApiErrorDto" put: tags: - image-endpoint @@ -891,14 +891,14 @@ paths: type: integer format: int64 responses: - "202": - description: Deleted image successfully "404": description: Image could not be found content: application/json: schema: $ref: "#/components/schemas/ApiErrorDto" + "202": + description: Deleted image successfully security: - bearerAuth: [] - basicAuth: [] @@ -923,27 +923,6 @@ paths: schema: type: string responses: - "200": - description: Found identifier successfully - content: - application/json: - schema: - $ref: "#/components/schemas/IdentifierDto" - application/ld+json: - schema: - $ref: "#/components/schemas/LdDatasetDto" - text/csv: {} - text/xml: {} - text/bibliography: {} - text/bibliography; style=apa: {} - text/bibliography; style=ieee: {} - text/bibliography; style=bibtex: {} - "502": - description: Connection to data service failed - content: - application/json: - schema: - $ref: "#/components/schemas/ApiErrorDto" "400": description: "Identifier could not be exported, the requested style is not\ \ known" @@ -957,39 +936,60 @@ paths: application/json: schema: $ref: "#/components/schemas/ApiErrorDto" - "410": - description: Failed to retrieve from S3 endpoint + "406": + description: Failed to find acceptable representation content: application/json: schema: $ref: "#/components/schemas/ApiErrorDto" - "404": - description: Identifier could not be found + "502": + description: Connection to data service failed content: application/json: schema: $ref: "#/components/schemas/ApiErrorDto" - "406": - description: Failed to find acceptable representation + "503": + description: Failed to find in data service content: application/json: schema: $ref: "#/components/schemas/ApiErrorDto" - "503": - description: Failed to find in data service + "404": + description: Identifier could not be found content: application/json: schema: $ref: "#/components/schemas/ApiErrorDto" - put: - tags: - - identifier-endpoint - summary: Save identifier - description: Saves an identifier with id as a draft identifier. Identifiers - can only be created for objects the user has at least *READ* access in the - associated database (requires role `create-identifier`) or for any object - in any database (requires role `create-foreign-identifier`). - operationId: save + "200": + description: Found identifier successfully + content: + application/json: + schema: + $ref: "#/components/schemas/IdentifierDto" + application/ld+json: + schema: + $ref: "#/components/schemas/LdDatasetDto" + text/csv: {} + text/xml: {} + text/bibliography: {} + text/bibliography; style=apa: {} + text/bibliography; style=ieee: {} + text/bibliography; style=bibtex: {} + "410": + description: Failed to retrieve from S3 endpoint + content: + application/json: + schema: + $ref: "#/components/schemas/ApiErrorDto" + put: + tags: + - identifier-endpoint + summary: Save identifier + description: Saves an identifier with id as a draft identifier. Identifiers + can only be created for objects the user has at least *READ* access in the + associated database (requires role `create-identifier`) or for any object + in any database (requires role `create-foreign-identifier`). + operationId: save parameters: - name: identifierId in: path @@ -1004,38 +1004,38 @@ paths: $ref: "#/components/schemas/IdentifierSaveDto" required: true responses: - "502": - description: Connection to search service failed + "202": + description: Saved identifier content: application/json: schema: - $ref: "#/components/schemas/ApiErrorDto" - "404": - description: "Failed to find database, table or view" + $ref: "#/components/schemas/IdentifierDto" + "403": + description: Insufficient access rights or authorities content: application/json: schema: $ref: "#/components/schemas/ApiErrorDto" - "400": - description: Identifier form contains invalid request data + "503": + description: Failed to save in search service content: application/json: schema: $ref: "#/components/schemas/ApiErrorDto" - "503": - description: Failed to save in search service + "502": + description: Connection to search service failed content: application/json: schema: $ref: "#/components/schemas/ApiErrorDto" - "202": - description: Saved identifier + "404": + description: "Failed to find database, table or view" content: application/json: schema: - $ref: "#/components/schemas/IdentifierDto" - "403": - description: Insufficient access rights or authorities + $ref: "#/components/schemas/ApiErrorDto" + "400": + description: Identifier form contains invalid request data content: application/json: schema: @@ -1069,16 +1069,16 @@ paths: application/json: schema: $ref: "#/components/schemas/ApiErrorDto" - "404": - description: Identifier or database could not be found + "403": + description: Deleting identifier not permitted content: application/json: schema: $ref: "#/components/schemas/ApiErrorDto" "202": description: Deleted identifier - "403": - description: Deleting identifier not permitted + "404": + description: Identifier or database could not be found content: application/json: schema: @@ -1102,38 +1102,38 @@ paths: type: integer format: int64 responses: - "502": - description: Connection to search service failed + "202": + description: Published identifier content: application/json: schema: - $ref: "#/components/schemas/ApiErrorDto" - "404": - description: "Failed to find database, table or view" + $ref: "#/components/schemas/IdentifierDto" + "403": + description: Insufficient access rights or authorities content: application/json: schema: $ref: "#/components/schemas/ApiErrorDto" - "202": - description: Published identifier + "503": + description: Failed to save in search service content: application/json: schema: - $ref: "#/components/schemas/IdentifierDto" - "400": - description: Identifier form contains invalid request data + $ref: "#/components/schemas/ApiErrorDto" + "502": + description: Connection to search service failed content: application/json: schema: $ref: "#/components/schemas/ApiErrorDto" - "503": - description: Failed to save in search service + "404": + description: "Failed to find database, table or view" content: application/json: schema: $ref: "#/components/schemas/ApiErrorDto" - "403": - description: Insufficient access rights or authorities + "400": + description: Identifier form contains invalid request data content: application/json: schema: @@ -1163,32 +1163,32 @@ paths: $ref: "#/components/schemas/DatabaseModifyVisibilityDto" required: true responses: - "502": - description: Connection to search service failed + "202": + description: Visibility modified successfully content: application/json: schema: - $ref: "#/components/schemas/ApiErrorDto" - "404": - description: Failed to find database in metadata database + $ref: "#/components/schemas/DatabaseBriefDto" + "503": + description: Failed to save in search service content: application/json: schema: $ref: "#/components/schemas/ApiErrorDto" - "202": - description: Visibility modified successfully + "502": + description: Connection to search service failed content: application/json: schema: - $ref: "#/components/schemas/DatabaseBriefDto" + $ref: "#/components/schemas/ApiErrorDto" "400": description: The visibility payload is malformed content: application/json: schema: $ref: "#/components/schemas/ApiErrorDto" - "503": - description: Failed to save in search service + "404": + description: Failed to find database in metadata database content: application/json: schema: @@ -1223,12 +1223,6 @@ paths: type: integer format: int64 responses: - "403": - description: Find view is not permitted - content: - application/json: - schema: - $ref: "#/components/schemas/ApiErrorDto" "404": description: "Database, view or user could not be found" content: @@ -1266,6 +1260,12 @@ paths: application/json: schema: $ref: "#/components/schemas/ViewDto" + "403": + description: Find view is not permitted + content: + application/json: + schema: + $ref: "#/components/schemas/ApiErrorDto" security: - bearerAuth: [] - basicAuth: [] @@ -1296,18 +1296,6 @@ paths: $ref: "#/components/schemas/ViewUpdateDto" required: true responses: - "502": - description: Connection to search service failed - content: - application/json: - schema: - $ref: "#/components/schemas/ApiErrorDto" - "404": - description: Database or View could not be found - content: - application/json: - schema: - $ref: "#/components/schemas/ApiErrorDto" "403": description: Update not allowed content: @@ -1320,8 +1308,8 @@ paths: application/json: schema: $ref: "#/components/schemas/ApiErrorDto" - "400": - description: Update view query is malformed + "502": + description: Connection to search service failed content: application/json: schema: @@ -1332,6 +1320,18 @@ paths: '*/*': schema: $ref: "#/components/schemas/ViewDto" + "400": + description: Update view query is malformed + content: + application/json: + schema: + $ref: "#/components/schemas/ApiErrorDto" + "404": + description: Database or View could not be found + content: + application/json: + schema: + $ref: "#/components/schemas/ApiErrorDto" security: - bearerAuth: [] - basicAuth: [] @@ -1355,20 +1355,20 @@ paths: type: integer format: int64 responses: - "502": - description: Connection to search service failed + "400": + description: Delete view query is malformed content: application/json: schema: $ref: "#/components/schemas/ApiErrorDto" - "423": - description: Delete view resulted in an invalid query statement + "403": + description: Deletion not allowed content: application/json: schema: $ref: "#/components/schemas/ApiErrorDto" - "404": - description: "Database, view or user could not be found" + "503": + description: Failed to save in search service content: application/json: schema: @@ -1379,20 +1379,20 @@ paths: '*/*': schema: type: object - "400": - description: Delete view query is malformed + "423": + description: Delete view resulted in an invalid query statement content: application/json: schema: $ref: "#/components/schemas/ApiErrorDto" - "503": - description: Failed to save in search service + "502": + description: Connection to search service failed content: application/json: schema: $ref: "#/components/schemas/ApiErrorDto" - "403": - description: Deletion not allowed + "404": + description: "Database, view or user could not be found" content: application/json: schema: @@ -1455,14 +1455,14 @@ paths: application/json: schema: $ref: "#/components/schemas/TableDto" - "503": - description: Failed to obtain queue information from broker service + "404": + description: "Table, database or container could not be found" content: application/json: schema: $ref: "#/components/schemas/ApiErrorDto" - "403": - description: Access to the database is forbidden + "503": + description: Failed to obtain queue information from broker service content: application/json: schema: @@ -1473,8 +1473,8 @@ paths: application/json: schema: $ref: "#/components/schemas/ApiErrorDto" - "404": - description: "Table, database or container could not be found" + "403": + description: Access to the database is forbidden content: application/json: schema: @@ -1508,8 +1508,8 @@ paths: $ref: "#/components/schemas/TableUpdateDto" required: true responses: - "403": - description: Update table visibility not permitted + "503": + description: Failed to save in search service content: application/json: schema: @@ -1520,26 +1520,26 @@ paths: application/json: schema: $ref: "#/components/schemas/ApiErrorDto" - "404": - description: Table could not be found - content: - application/json: - schema: - $ref: "#/components/schemas/ApiErrorDto" "202": description: Updated the table content: application/json: schema: $ref: "#/components/schemas/TableBriefDto" - "503": - description: Failed to save in search service + "400": + description: Update table visibility payload is malformed content: application/json: schema: $ref: "#/components/schemas/ApiErrorDto" - "400": - description: Update table visibility payload is malformed + "403": + description: Update table visibility not permitted + content: + application/json: + schema: + $ref: "#/components/schemas/ApiErrorDto" + "404": + description: Table could not be found content: application/json: schema: @@ -1569,34 +1569,34 @@ paths: type: integer format: int64 responses: - "502": - description: Connection to search service failed + "404": + description: "Table, database or container could not be found" content: application/json: schema: $ref: "#/components/schemas/ApiErrorDto" - "403": - description: Access to the database is forbidden + "503": + description: Failed to save in search service content: application/json: schema: $ref: "#/components/schemas/ApiErrorDto" - "202": - description: Delete table successfully - "503": - description: Failed to save in search service + "502": + description: Connection to search service failed content: application/json: schema: $ref: "#/components/schemas/ApiErrorDto" + "202": + description: Delete table successfully "400": description: Delete table query resulted in an invalid query statement content: application/json: schema: $ref: "#/components/schemas/ApiErrorDto" - "404": - description: "Table, database or container could not be found" + "403": + description: Access to the database is forbidden content: application/json: schema: @@ -1627,32 +1627,32 @@ paths: type: integer format: int64 responses: - "502": - description: Connection to search service failed + "403": + description: Not the owner content: application/json: schema: $ref: "#/components/schemas/ApiErrorDto" - "503": - description: Failed to save in search service + "404": + description: Failed to find database/table in metadata database content: application/json: schema: $ref: "#/components/schemas/ApiErrorDto" - "400": - description: Failed to map column statistic to known columns + "503": + description: Failed to save in search service content: application/json: schema: $ref: "#/components/schemas/ApiErrorDto" - "404": - description: Failed to find database/table in metadata database + "400": + description: Failed to map column statistic to known columns content: application/json: schema: $ref: "#/components/schemas/ApiErrorDto" - "403": - description: Not the owner + "502": + description: Connection to search service failed content: application/json: schema: @@ -1698,26 +1698,27 @@ paths: $ref: "#/components/schemas/ColumnSemanticsUpdateDto" required: true responses: - "502": - description: Connection to search service failed + "404": + description: Failed to find user/table/database/ontology in metadata database content: application/json: schema: $ref: "#/components/schemas/ApiErrorDto" - "403": - description: Access to the database is forbidden + "400": + description: Update semantic concept query is malformed or update unit of + measurement query is malformed content: application/json: schema: $ref: "#/components/schemas/ApiErrorDto" - "404": - description: Failed to find user/table/database/ontology in metadata database + "503": + description: Failed to save in search service content: application/json: schema: $ref: "#/components/schemas/ApiErrorDto" - "503": - description: Failed to save in search service + "502": + description: Connection to search service failed content: application/json: schema: @@ -1728,9 +1729,8 @@ paths: application/json: schema: $ref: "#/components/schemas/ColumnDto" - "400": - description: Update semantic concept query is malformed or update unit of - measurement query is malformed + "403": + description: Access to the database is forbidden content: application/json: schema: @@ -1760,14 +1760,20 @@ paths: $ref: "#/components/schemas/DatabaseTransferDto" required: true responses: + "503": + description: Failed to save in search service + content: + application/json: + schema: + $ref: "#/components/schemas/ApiErrorDto" "502": description: Connection to search service failed content: application/json: schema: $ref: "#/components/schemas/ApiErrorDto" - "503": - description: Failed to save in search service + "403": + description: Transfer of ownership is not permitted content: application/json: schema: @@ -1778,12 +1784,6 @@ paths: application/json: schema: $ref: "#/components/schemas/DatabaseBriefDto" - "403": - description: Transfer of ownership is not permitted - content: - application/json: - schema: - $ref: "#/components/schemas/ApiErrorDto" "404": description: Database or user could not be found content: @@ -1816,36 +1816,36 @@ paths: type: integer format: int64 responses: - "502": - description: Connection to search service failed + "403": + description: Refresh view metadata is not permitted content: application/json: schema: $ref: "#/components/schemas/ApiErrorDto" - "404": - description: Failed to find database in metadata database + "503": + description: Failed to save in search service content: application/json: schema: $ref: "#/components/schemas/ApiErrorDto" - "503": - description: Failed to save in search service + "502": + description: Connection to search service failed content: application/json: schema: $ref: "#/components/schemas/ApiErrorDto" - "200": - description: Refreshed database views metadata + "404": + description: Failed to find database in metadata database content: application/json: schema: - $ref: "#/components/schemas/DatabaseBriefDto" - "403": - description: Refresh view metadata is not permitted + $ref: "#/components/schemas/ApiErrorDto" + "200": + description: Refreshed database views metadata content: application/json: schema: - $ref: "#/components/schemas/ApiErrorDto" + $ref: "#/components/schemas/DatabaseBriefDto" security: - bearerAuth: [] - basicAuth: [] @@ -1866,8 +1866,8 @@ paths: type: integer format: int64 responses: - "403": - description: Not allowed to refresh table metadata + "503": + description: Failed to save in search service content: application/json: schema: @@ -1878,14 +1878,8 @@ paths: application/json: schema: $ref: "#/components/schemas/ApiErrorDto" - "404": - description: Failed to fin user/database in metadata database - content: - application/json: - schema: - $ref: "#/components/schemas/ApiErrorDto" - "503": - description: Failed to save in search service + "400": + description: Failed to parse payload at search service content: application/json: schema: @@ -1896,8 +1890,14 @@ paths: application/json: schema: $ref: "#/components/schemas/DatabaseBriefDto" - "400": - description: Failed to parse payload at search service + "403": + description: Not allowed to refresh table metadata + content: + application/json: + schema: + $ref: "#/components/schemas/ApiErrorDto" + "404": + description: Failed to fin user/database in metadata database content: application/json: schema: @@ -1920,12 +1920,6 @@ paths: type: integer format: int64 responses: - "404": - description: Database or user could not be found - content: - application/json: - schema: - $ref: "#/components/schemas/ApiErrorDto" "200": description: View of image was successful content: @@ -1935,6 +1929,12 @@ paths: items: type: string format: byte + "404": + description: Database or user could not be found + content: + application/json: + schema: + $ref: "#/components/schemas/ApiErrorDto" security: - bearerAuth: [] - basicAuth: [] @@ -1959,38 +1959,38 @@ paths: $ref: "#/components/schemas/DatabaseModifyImageDto" required: true responses: - "502": - description: Connection to search service failed + "404": + description: Database could not be found content: application/json: schema: $ref: "#/components/schemas/ApiErrorDto" - "202": - description: Modify of image was successful + "503": + description: Failed to save in search service content: application/json: schema: - $ref: "#/components/schemas/DatabaseBriefDto" - "410": - description: File was not found in the Storage Service + $ref: "#/components/schemas/ApiErrorDto" + "502": + description: Connection to search service failed content: application/json: schema: $ref: "#/components/schemas/ApiErrorDto" - "404": - description: Database could not be found + "403": + description: Modify of image is not permitted content: application/json: schema: $ref: "#/components/schemas/ApiErrorDto" - "503": - description: Failed to save in search service + "202": + description: Modify of image was successful content: application/json: schema: - $ref: "#/components/schemas/ApiErrorDto" - "403": - description: Modify of image is not permitted + $ref: "#/components/schemas/DatabaseBriefDto" + "410": + description: File was not found in the Storage Service content: application/json: schema: @@ -2036,30 +2036,32 @@ paths: $ref: "#/components/schemas/SignupRequestDto" required: true responses: - "403": - description: Internal authentication to the auth service is invalid + "502": + description: Failed to create in auth service content: application/json: schema: $ref: "#/components/schemas/ApiErrorDto" - "400": - description: Parameters are not well-formed (likely email) - content: - application/json: {} "409": description: User with username already exists content: application/json: schema: $ref: "#/components/schemas/ApiErrorDto" - "417": - description: User with e-mail already exists + "404": + description: Default role not found content: application/json: schema: $ref: "#/components/schemas/ApiErrorDto" - "503": - description: Failed to create in auth service + "403": + description: Internal authentication to the auth service is invalid + content: + application/json: + schema: + $ref: "#/components/schemas/ApiErrorDto" + "417": + description: User with e-mail already exists content: application/json: schema: @@ -2070,18 +2072,16 @@ paths: application/json: schema: $ref: "#/components/schemas/UserDto" - "502": + "503": description: Failed to create in auth service content: application/json: schema: $ref: "#/components/schemas/ApiErrorDto" - "404": - description: Default role not found + "400": + description: Parameters are not well-formed (likely email) content: - application/json: - schema: - $ref: "#/components/schemas/ApiErrorDto" + application/json: {} /api/ontology: get: tags: @@ -2204,18 +2204,18 @@ paths: application/json: schema: $ref: "#/components/schemas/ApiErrorDto" - "400": - description: Image specification is invalid - content: - application/json: - schema: - $ref: "#/components/schemas/ApiErrorDto" "201": description: Created image content: application/json: schema: $ref: "#/components/schemas/ImageDto" + "400": + description: Image specification is invalid + content: + application/json: + schema: + $ref: "#/components/schemas/ApiErrorDto" security: - bearerAuth: [] - basicAuth: [] @@ -2257,6 +2257,13 @@ paths: schema: type: string responses: + "406": + description: "Identifier could not be exported, the requested style is not\ + \ known" + content: + application/json: + schema: + $ref: "#/components/schemas/ApiErrorDto" "200": description: Found identifiers successfully content: @@ -2270,13 +2277,6 @@ paths: type: array items: $ref: "#/components/schemas/LdDatasetDto" - "406": - description: "Identifier could not be exported, the requested style is not\ - \ known" - content: - application/json: - schema: - $ref: "#/components/schemas/ApiErrorDto" post: tags: - identifier-endpoint @@ -2293,42 +2293,42 @@ paths: $ref: "#/components/schemas/IdentifierCreateDto" required: true responses: - "502": - description: Connection to search service failed + "403": + description: Insufficient access rights or authorities content: application/json: schema: $ref: "#/components/schemas/ApiErrorDto" - "201": - description: Drafted identifier + "503": + description: Failed to save in search service content: application/json: schema: - $ref: "#/components/schemas/IdentifierDto" - "404": - description: "Failed to find database, table or view" + $ref: "#/components/schemas/ApiErrorDto" + "502": + description: Connection to search service failed content: application/json: schema: $ref: "#/components/schemas/ApiErrorDto" - "400": - description: Identifier form contains invalid request data + "404": + description: "Failed to find database, table or view" content: application/json: schema: $ref: "#/components/schemas/ApiErrorDto" - "503": - description: Failed to save in search service + "400": + description: Identifier form contains invalid request data content: application/json: schema: $ref: "#/components/schemas/ApiErrorDto" - "403": - description: Insufficient access rights or authorities + "201": + description: Drafted identifier content: application/json: schema: - $ref: "#/components/schemas/ApiErrorDto" + $ref: "#/components/schemas/IdentifierDto" security: - bearerAuth: [] - basicAuth: [] @@ -2385,14 +2385,8 @@ paths: $ref: "#/components/schemas/ViewCreateDto" required: true responses: - "423": - description: Create view resulted in an invalid query statement - content: - application/json: - schema: - $ref: "#/components/schemas/ApiErrorDto" - "502": - description: Connection to search service failed + "503": + description: Failed to save in search service content: application/json: schema: @@ -2403,14 +2397,14 @@ paths: application/json: schema: $ref: "#/components/schemas/ViewBriefDto" - "503": - description: Failed to save in search service + "423": + description: Create view resulted in an invalid query statement content: application/json: schema: $ref: "#/components/schemas/ApiErrorDto" - "403": - description: Credentials missing + "502": + description: Connection to search service failed content: application/json: schema: @@ -2427,6 +2421,12 @@ paths: application/json: schema: $ref: "#/components/schemas/ApiErrorDto" + "403": + description: Credentials missing + content: + application/json: + schema: + $ref: "#/components/schemas/ApiErrorDto" security: - bearerAuth: [] - basicAuth: [] @@ -2447,12 +2447,6 @@ paths: type: integer format: int64 responses: - "403": - description: List tables not permitted - content: - application/json: - schema: - $ref: "#/components/schemas/ApiErrorDto" "404": description: Database could not be found content: @@ -2467,6 +2461,12 @@ paths: type: array items: $ref: "#/components/schemas/TableBriefDto" + "403": + description: List tables not permitted + content: + application/json: + schema: + $ref: "#/components/schemas/ApiErrorDto" security: - bearerAuth: [] - basicAuth: [] @@ -2490,42 +2490,42 @@ paths: $ref: "#/components/schemas/TableCreateDto" required: true responses: - "502": - description: Connection to search service failed + "404": + description: "Database, container or user could not be found" content: application/json: schema: $ref: "#/components/schemas/ApiErrorDto" - "403": - description: Create table not permitted + "503": + description: Failed to save in search service content: application/json: schema: $ref: "#/components/schemas/ApiErrorDto" - "201": - description: Created a new table + "403": + description: Create table not permitted content: application/json: schema: - $ref: "#/components/schemas/TableBriefDto" - "409": - description: Create table conflicts with existing table name + $ref: "#/components/schemas/ApiErrorDto" + "502": + description: Connection to search service failed content: application/json: schema: $ref: "#/components/schemas/ApiErrorDto" - "404": - description: "Database, container or user could not be found" + "409": + description: Create table conflicts with existing table name content: application/json: schema: $ref: "#/components/schemas/ApiErrorDto" - "503": - description: Failed to save in search service + "201": + description: Created a new table content: application/json: schema: - $ref: "#/components/schemas/ApiErrorDto" + $ref: "#/components/schemas/TableBriefDto" "400": description: Create table query is malformed content: @@ -2568,7 +2568,7 @@ paths: content: application/json: schema: - $ref: "#/components/schemas/ContainerCreateDto" + $ref: "#/components/schemas/CreateContainerDto" required: true responses: "400": @@ -2577,8 +2577,14 @@ paths: application/json: schema: $ref: "#/components/schemas/ApiErrorDto" - "404": - description: Container image or user could not be found + "201": + description: Created a new container + content: + application/json: + schema: + $ref: "#/components/schemas/ContainerDto" + "403": + description: "Create container not permitted, need authority `create-container`" content: application/json: schema: @@ -2589,14 +2595,8 @@ paths: application/json: schema: $ref: "#/components/schemas/ApiErrorDto" - "201": - description: Created a new container - content: - application/json: - schema: - $ref: "#/components/schemas/ContainerDto" - "403": - description: "Create container not permitted, need authority `create-container`" + "404": + description: Container image or user could not be found content: application/json: schema: @@ -2646,20 +2646,6 @@ paths: schema: type: string responses: - "400": - description: Filter params are invalid - content: - application/json: - schema: - $ref: "#/components/schemas/ApiErrorDto" - "200": - description: Found entities - content: - application/json: - schema: - type: array - items: - $ref: "#/components/schemas/EntityDto" "404": description: Could not find ontology content: @@ -2678,6 +2664,20 @@ paths: application/json: schema: $ref: "#/components/schemas/ApiErrorDto" + "400": + description: Filter params are invalid + content: + application/json: + schema: + $ref: "#/components/schemas/ApiErrorDto" + "200": + description: Found entities + content: + application/json: + schema: + type: array + items: + $ref: "#/components/schemas/EntityDto" security: - bearerAuth: [] - basicAuth: [] @@ -2785,14 +2785,20 @@ paths: type: integer format: int64 responses: - "503": - description: Failed to find queue information in broker service + "403": + description: Not allowed to view database content: application/json: schema: $ref: "#/components/schemas/ApiErrorDto" - "502": - description: Connection to the broker service could not be established + "404": + description: "Database, user or exchange could not be found" + content: + application/json: + schema: + $ref: "#/components/schemas/ApiErrorDto" + "503": + description: Failed to find queue information in broker service content: application/json: schema: @@ -2813,14 +2819,8 @@ paths: application/json: schema: $ref: "#/components/schemas/DatabaseBriefDto" - "403": - description: Not allowed to view database - content: - application/json: - schema: - $ref: "#/components/schemas/ApiErrorDto" - "404": - description: "Database, user or exchange could not be found" + "502": + description: Connection to the broker service could not be established content: application/json: schema: @@ -2850,20 +2850,22 @@ paths: type: integer format: int64 responses: - "417": - description: Generated query is malformed + "404": + description: Failed to find database/table in metadata database content: application/json: schema: $ref: "#/components/schemas/ApiErrorDto" - "422": - description: Ontology does not have rdf or sparql endpoint + "200": + description: Suggested table semantics successfully content: application/json: schema: - $ref: "#/components/schemas/ApiErrorDto" - "400": - description: Failed to parse statistic in search service + type: array + items: + $ref: "#/components/schemas/EntityDto" + "422": + description: Ontology does not have rdf or sparql endpoint content: application/json: schema: @@ -2874,20 +2876,18 @@ paths: application/json: schema: $ref: "#/components/schemas/ApiErrorDto" - "404": - description: Failed to find database/table in metadata database + "417": + description: Generated query is malformed content: application/json: schema: $ref: "#/components/schemas/ApiErrorDto" - "200": - description: Suggested table semantics successfully + "400": + description: Failed to parse statistic in search service content: application/json: schema: - type: array - items: - $ref: "#/components/schemas/EntityDto" + $ref: "#/components/schemas/ApiErrorDto" security: - bearerAuth: [] - basicAuth: [] @@ -2918,8 +2918,8 @@ paths: type: integer format: int64 responses: - "400": - description: Generated query is malformed + "404": + description: Failed to find database/table in metadata database content: application/json: schema: @@ -2930,6 +2930,12 @@ paths: application/json: schema: $ref: "#/components/schemas/ApiErrorDto" + "400": + description: Generated query is malformed + content: + application/json: + schema: + $ref: "#/components/schemas/ApiErrorDto" "200": description: Suggested table column semantics successfully content: @@ -2938,12 +2944,6 @@ paths: type: array items: $ref: "#/components/schemas/TableColumnEntityDto" - "404": - description: Failed to find database/table in metadata database - content: - application/json: - schema: - $ref: "#/components/schemas/ApiErrorDto" security: - bearerAuth: [] - basicAuth: [] @@ -3023,10 +3023,54 @@ paths: $ref: "#/components/schemas/ConceptDto" components: schemas: + CreatorBriefDto: + required: + - creator_name + - id + type: object + properties: + id: + type: integer + format: int64 + example: 11 + affiliation: + type: string + example: Brown University + creator_name: + type: string + example: "Carberry, Josiah" + name_type: + type: string + example: Personal + enum: + - Personal + - Organizational + name_identifier: + type: string + example: 0000-0002-1825-0097 + name_identifier_scheme: + type: string + example: ORCID + enum: + - ORCID + - ROR + - ISNI + - GRID + affiliation_identifier: + type: string + example: https://ror.org/05gq02987 + affiliation_identifier_scheme: + type: string + example: ROR + enum: + - ROR + - GRID + - ISNI DatabaseBriefDto: required: - contact - id + - identifiers - internal_name - is_public - is_schema_public @@ -3037,6 +3081,7 @@ components: id: type: integer format: int64 + example: 3 name: type: string example: Air Quality @@ -3061,15 +3106,18 @@ components: owner_id: type: string format: uuid + example: 2f45ef7a-7f9b-4667-9156-152c87fe1ca5 preview_image: type: string IdentifierBriefDto: required: - - created_by + - creators - database_id - id + - owned_by - publication_year - publisher + - status - titles - type type: object @@ -3077,13 +3125,19 @@ components: id: type: integer format: int64 + example: 2 type: type: string + example: database enum: - database - subset - table - view + creators: + type: array + items: + $ref: "#/components/schemas/CreatorBriefDto" titles: type: array items: @@ -3096,6 +3150,7 @@ components: example: TU Wien status: type: string + example: draft enum: - draft - published @@ -3119,9 +3174,10 @@ components: type: integer format: int32 example: 2022 - created_by: + owned_by: type: string format: uuid + example: 2f45ef7a-7f9b-4667-9156-152c87fe1ca5 IdentifierTitleDto: required: - id @@ -3130,6 +3186,7 @@ components: id: type: integer format: int64 + example: 4 title: type: string example: Airquality Demonstrator @@ -3453,6 +3510,7 @@ components: $ref: "#/components/schemas/UserBriefDto" type: type: string + example: read enum: - read - write_own @@ -3505,6 +3563,22 @@ components: - id type: object properties: + jdbcMethod: + type: string + example: mariadb + host: + type: string + example: data-db + port: + type: integer + format: int32 + example: 3306 + username: + type: string + example: username + database: + type: string + example: air_quality id: type: string format: uuid @@ -3778,6 +3852,7 @@ components: id: type: integer format: int64 + example: 1 registry: type: string example: docker.io/library @@ -4700,6 +4775,7 @@ components: id: type: integer format: int64 + example: 11 firstname: type: string example: Josiah @@ -4753,6 +4829,7 @@ components: id: type: integer format: int64 + example: 3 description: type: string example: "Air quality reports at Stephansplatz, Vienna" @@ -4958,13 +5035,18 @@ components: required: - creators - database_id + - descriptions + - funders - id + - language + - licenses - owner - publication_year - publisher - query - query_hash - query_normalized + - status - titles - type type: object @@ -4972,8 +5054,10 @@ components: id: type: integer format: int64 + example: 2 type: type: string + example: database enum: - database - subset @@ -5204,6 +5288,7 @@ components: $ref: "#/components/schemas/CreatorDto" status: type: string + example: draft enum: - draft - published @@ -5262,6 +5347,7 @@ components: id: type: integer format: int64 + example: 2 funder_name: type: string example: European Commission @@ -5297,6 +5383,7 @@ components: id: type: integer format: int64 + example: 8 value: type: string example: 10.70124/dc4zh-9ce78 @@ -5386,7 +5473,6 @@ components: example: true ViewColumnDto: required: - - auto_generated - database_id - id - internal_name @@ -5399,11 +5485,12 @@ components: id: type: integer format: int64 + example: 12 name: maxLength: 64 minLength: 0 type: string - example: Date + example: Given Name size: type: integer format: int64 @@ -5420,6 +5507,7 @@ components: database_id: type: integer format: int64 + example: 1 ord: type: integer format: int32 @@ -5428,19 +5516,18 @@ components: maxLength: 64 minLength: 0 type: string - example: mdb_date - auto_generated: - type: boolean - example: false + example: given_name index_length: type: integer format: int64 + example: 255 length: type: integer format: int64 + example: 255 type: type: string - example: string + example: varchar enum: - char - varchar @@ -5480,6 +5567,7 @@ components: - columns - database_id - id + - identifiers - internal_name - name - owner @@ -5487,9 +5575,26 @@ components: - query_hash type: object properties: + jdbcMethod: + type: string + example: mariadb + host: + type: string + example: data-db + port: + type: integer + format: int32 + example: 3306 + username: + type: string + example: username + database: + type: string + example: air_quality id: type: integer format: int64 + example: 4 name: type: string example: Air Quality @@ -5512,6 +5617,7 @@ components: database_id: type: integer format: int64 + example: 1 internal_name: type: string example: air_quality @@ -5560,6 +5666,7 @@ components: id: type: integer format: int64 + example: 3 name: type: string example: Air Quality @@ -5569,6 +5676,7 @@ components: database_id: type: integer format: int64 + example: 2 internal_name: type: string example: air_quality @@ -5584,6 +5692,7 @@ components: owned_by: type: string format: uuid + example: 78337b80-5699-45db-8111-cec86439ab6b ColumnSemanticsUpdateDto: type: object properties: @@ -5640,12 +5749,18 @@ components: example: Column comment enums: type: array + example: + - val1 items: type: string + example: "[\"val1\"]" sets: type: array + example: + - val1 items: type: string + example: "[\"val1\"]" database_id: type: integer format: int64 @@ -5781,13 +5896,14 @@ components: properties: key: type: string - UpdateDatabaseAccessDto: + CreateAccessDto: required: - type type: object properties: type: type: string + example: read enum: - read - write_own @@ -6213,6 +6329,7 @@ components: id: type: integer format: int64 + example: 4 name: type: string example: Air Quality @@ -6222,6 +6339,7 @@ components: database_id: type: integer format: int64 + example: 1 internal_name: type: string example: air_quality @@ -6241,6 +6359,7 @@ components: owned_by: type: string format: uuid + example: ac750fcf-ea02-4fce-85ac-d73857e18b35 ColumnCreateDto: required: - name @@ -6412,7 +6531,7 @@ components: is_schema_public: type: boolean example: true - ContainerCreateDto: + CreateContainerDto: required: - host - image_id @@ -6428,10 +6547,12 @@ components: host: type: string description: Hostname of container + example: data-db2 port: type: integer description: Port of container format: int32 + example: 3306 quota: type: integer format: int64 @@ -6440,11 +6561,14 @@ components: type: integer description: Image ID format: int64 + example: 1 ui_host: type: string + example: example.com ui_port: type: integer format: int32 + example: 3306 privileged_username: type: string description: Username of privileged user @@ -6452,6 +6576,7 @@ components: privileged_password: type: string description: Password of privileged user + example: dbrepo ContainerDto: required: - count @@ -6462,9 +6587,26 @@ components: - quota type: object properties: + jdbcMethod: + type: string + example: mariadb + host: + type: string + example: data-db + port: + type: integer + format: int32 + example: 3306 + username: + type: string + example: username + database: + type: string + example: air_quality id: type: integer format: int64 + example: 4 name: type: string example: Air Quality @@ -6483,42 +6625,52 @@ components: format: date-time internal_name: type: string - example: data-db + example: air_quality ui_host: type: string + example: example.com ui_port: type: integer format: int32 + example: 3306 ColumnBriefDto: required: - - column_type - database_id - id - internal_name - name - table_id + - type type: object properties: id: type: integer format: int64 + example: 1 name: + maxLength: 64 + minLength: 0 type: string - example: date + example: Given Name alias: type: string + example: firstname database_id: type: integer format: int64 + example: 2 table_id: type: integer format: int64 + example: 3 internal_name: + maxLength: 64 + minLength: 0 type: string - example: mdb_date - column_type: + example: given_name + type: type: string - example: date + example: varchar enum: - char - varchar @@ -6678,6 +6830,7 @@ components: id: type: integer format: int64 + example: 5 name: type: string example: mariadb @@ -6762,8 +6915,11 @@ components: checks: uniqueItems: true type: array + example: + - value > 1 items: type: string + example: "[\"value > 1\"]" foreign_keys: type: array items: @@ -6779,6 +6935,7 @@ components: id: type: integer format: int64 + example: 8 ForeignKeyDto: required: - name @@ -6790,8 +6947,10 @@ components: id: type: integer format: int64 + example: 4 name: type: string + example: fk_name references: type: array items: @@ -6802,6 +6961,7 @@ components: $ref: "#/components/schemas/TableBriefDto" on_update: type: string + example: restrict enum: - restrict - cascade @@ -6810,6 +6970,7 @@ components: - set_default on_delete: type: string + example: restrict enum: - restrict - cascade @@ -6826,6 +6987,7 @@ components: id: type: integer format: int64 + example: 8 column: $ref: "#/components/schemas/ColumnBriefDto" foreign_key: @@ -6841,6 +7003,7 @@ components: id: type: integer format: int64 + example: 8 table: $ref: "#/components/schemas/TableBriefDto" column: @@ -6861,14 +7024,32 @@ components: - routing_key type: object properties: + jdbcMethod: + type: string + example: mariadb + host: + type: string + example: data-db + port: + type: integer + format: int32 + example: 3306 + username: + type: string + example: username + database: + type: string + example: air_quality id: type: integer format: int64 + example: 3 name: type: string example: Air Quality alias: type: string + example: a identifiers: type: array items: @@ -6892,6 +7073,7 @@ components: database_id: type: integer format: int64 + example: 2 internal_name: type: string example: air_quality @@ -6943,14 +7125,16 @@ components: id: type: integer format: int64 + example: 5 name: type: string + example: uk_name table: $ref: "#/components/schemas/TableBriefDto" columns: type: array items: - $ref: "#/components/schemas/ColumnDto" + $ref: "#/components/schemas/ColumnBriefDto" TableColumnEntityDto: required: - column_id @@ -6994,6 +7178,7 @@ components: id: type: integer format: int64 + example: 4 hash: type: string example: f829dd8a884182d0da846f365dee1221fd16610a14c81b8f9f295ff162749e50 diff --git a/.docs/.openapi/api.yaml b/.docs/.openapi/api.yaml index ef55c74ae9f16b81bd78522d44c2a62ab0bdb4ed..3338c9d6a281bfd4dab7ee378b1ce08d1f3d8f96 100644 --- a/.docs/.openapi/api.yaml +++ b/.docs/.openapi/api.yaml @@ -1617,7 +1617,7 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/UpdateDatabaseAccessDto' + $ref: '#/components/schemas/CreateAccessDto' required: true responses: '202': @@ -1684,7 +1684,7 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/UpdateDatabaseAccessDto' + $ref: '#/components/schemas/CreateAccessDto' required: true responses: '202': @@ -4002,7 +4002,7 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/ContainerCreateDto' + $ref: '#/components/schemas/CreateContainerDto' required: true responses: '201': @@ -4806,10 +4806,18 @@ components: type: object additionalProperties: type: object + example: + key: value + example: + key: value keys: type: object additionalProperties: type: object + example: + id: 1 + example: + id: 1 QueryPersistDto: required: - persist @@ -4818,13 +4826,58 @@ components: persist: type: boolean example: true + CreatorBriefDto: + required: + - creator_name + - id + type: object + properties: + id: + type: integer + format: int64 + example: 11 + affiliation: + type: string + example: Brown University + creator_name: + type: string + example: 'Carberry, Josiah' + name_type: + type: string + example: Personal + enum: + - Personal + - Organizational + name_identifier: + type: string + example: 0000-0002-1825-0097 + name_identifier_scheme: + type: string + example: ORCID + enum: + - ORCID + - ROR + - ISNI + - GRID + affiliation_identifier: + type: string + example: 'https://ror.org/05gq02987' + affiliation_identifier_scheme: + type: string + example: ROR + enum: + - ROR + - GRID + - ISNI IdentifierBriefDto: required: - - created_by + - creators - database_id - id + - owned_by - publication_year - publisher + - status - titles - type type: object @@ -4832,13 +4885,19 @@ components: id: type: integer format: int64 + example: 2 type: type: string + example: database enum: - database - subset - table - view + creators: + type: array + items: + $ref: '#/components/schemas/CreatorBriefDto' titles: type: array items: @@ -4851,6 +4910,7 @@ components: example: TU Wien status: type: string + example: draft enum: - draft - published @@ -4874,9 +4934,10 @@ components: type: integer format: int32 example: 2022 - created_by: + owned_by: type: string format: uuid + example: 2f45ef7a-7f9b-4667-9156-152c87fe1ca5 IdentifierTitleDto: required: - id @@ -4885,6 +4946,7 @@ components: id: type: integer format: int64 + example: 4 title: type: string example: Airquality Demonstrator @@ -5099,6 +5161,7 @@ components: id: type: integer format: int64 + example: 4 owner: $ref: '#/components/schemas/UserBriefDto' execution: @@ -5121,6 +5184,7 @@ components: database_id: type: integer format: int64 + example: 1 query_normalized: type: string example: SELECT `id` FROM `air_quality` @@ -5175,6 +5239,10 @@ components: type: object additionalProperties: type: object + example: + key: value + example: + key: value ImportDto: required: - header @@ -5190,6 +5258,7 @@ components: description: >- If true, the first line contains the column names, otherwise it contains only data + example: true separator: type: string example: ',' @@ -5233,10 +5302,15 @@ components: type: object additionalProperties: type: object + example: + id: 1 + example: + id: 1 DatabaseBriefDto: required: - contact - id + - identifiers - internal_name - is_public - is_schema_public @@ -5247,6 +5321,7 @@ components: id: type: integer format: int64 + example: 3 name: type: string example: Air Quality @@ -5271,6 +5346,7 @@ components: owner_id: type: string format: uuid + example: 2f45ef7a-7f9b-4667-9156-152c87fe1ca5 preview_image: type: string DatabaseAccessDto: @@ -5283,6 +5359,7 @@ components: $ref: '#/components/schemas/UserBriefDto' type: type: string + example: read enum: - read - write_own @@ -5335,6 +5412,22 @@ components: - id type: object properties: + jdbcMethod: + type: string + example: mariadb + host: + type: string + example: data-db + port: + type: integer + format: int32 + example: 3306 + username: + type: string + example: username + database: + type: string + example: air_quality id: type: string format: uuid @@ -5608,6 +5701,7 @@ components: id: type: integer format: int64 + example: 1 registry: type: string example: docker.io/library @@ -6531,6 +6625,7 @@ components: id: type: integer format: int64 + example: 11 firstname: type: string example: Josiah @@ -6584,6 +6679,7 @@ components: id: type: integer format: int64 + example: 3 description: type: string example: 'Air quality reports at Stephansplatz, Vienna' @@ -6789,13 +6885,18 @@ components: required: - creators - database_id + - descriptions + - funders - id + - language + - licenses - owner - publication_year - publisher - query - query_hash - query_normalized + - status - titles - type type: object @@ -6803,8 +6904,10 @@ components: id: type: integer format: int64 + example: 2 type: type: string + example: database enum: - database - subset @@ -7036,6 +7139,7 @@ components: $ref: '#/components/schemas/CreatorDto' status: type: string + example: draft enum: - draft - published @@ -7095,6 +7199,7 @@ components: id: type: integer format: int64 + example: 2 funder_name: type: string example: European Commission @@ -7130,6 +7235,7 @@ components: id: type: integer format: int64 + example: 8 value: type: string example: 10.70124/dc4zh-9ce78 @@ -7219,7 +7325,6 @@ components: example: true ViewColumnDto: required: - - auto_generated - database_id - id - internal_name @@ -7232,11 +7337,12 @@ components: id: type: integer format: int64 + example: 12 name: maxLength: 64 minLength: 0 type: string - example: Date + example: Given Name size: type: integer format: int64 @@ -7253,6 +7359,7 @@ components: database_id: type: integer format: int64 + example: 1 ord: type: integer format: int32 @@ -7261,19 +7368,18 @@ components: maxLength: 64 minLength: 0 type: string - example: mdb_date - auto_generated: - type: boolean - example: false + example: given_name index_length: type: integer format: int64 + example: 255 length: type: integer format: int64 + example: 255 type: type: string - example: string + example: varchar enum: - char - varchar @@ -7313,6 +7419,7 @@ components: - columns - database_id - id + - identifiers - internal_name - name - owner @@ -7320,9 +7427,26 @@ components: - query_hash type: object properties: + jdbcMethod: + type: string + example: mariadb + host: + type: string + example: data-db + port: + type: integer + format: int32 + example: 3306 + username: + type: string + example: username + database: + type: string + example: air_quality id: type: integer format: int64 + example: 4 name: type: string example: Air Quality @@ -7345,6 +7469,7 @@ components: database_id: type: integer format: int64 + example: 1 internal_name: type: string example: air_quality @@ -7393,6 +7518,7 @@ components: id: type: integer format: int64 + example: 3 name: type: string example: Air Quality @@ -7402,6 +7528,7 @@ components: database_id: type: integer format: int64 + example: 2 internal_name: type: string example: air_quality @@ -7417,6 +7544,7 @@ components: owned_by: type: string format: uuid + example: 78337b80-5699-45db-8111-cec86439ab6b ColumnSemanticsUpdateDto: type: object properties: @@ -7473,12 +7601,18 @@ components: example: Column comment enums: type: array + example: + - val1 items: type: string + example: '["val1"]' sets: type: array + example: + - val1 items: type: string + example: '["val1"]' database_id: type: integer format: int64 @@ -7615,13 +7749,14 @@ components: properties: key: type: string - UpdateDatabaseAccessDto: + CreateAccessDto: required: - type type: object properties: type: type: string + example: read enum: - read - write_own @@ -8047,6 +8182,7 @@ components: id: type: integer format: int64 + example: 4 name: type: string example: Air Quality @@ -8056,6 +8192,7 @@ components: database_id: type: integer format: int64 + example: 1 internal_name: type: string example: air_quality @@ -8075,6 +8212,7 @@ components: owned_by: type: string format: uuid + example: ac750fcf-ea02-4fce-85ac-d73857e18b35 ColumnCreateDto: required: - name @@ -8246,7 +8384,7 @@ components: is_schema_public: type: boolean example: true - ContainerCreateDto: + CreateContainerDto: required: - host - image_id @@ -8262,10 +8400,12 @@ components: host: type: string description: Hostname of container + example: data-db2 port: type: integer description: Port of container format: int32 + example: 3306 quota: type: integer format: int64 @@ -8274,11 +8414,14 @@ components: type: integer description: Image ID format: int64 + example: 1 ui_host: type: string + example: example.com ui_port: type: integer format: int32 + example: 3306 privileged_username: type: string description: Username of privileged user @@ -8286,6 +8429,7 @@ components: privileged_password: type: string description: Password of privileged user + example: dbrepo ContainerDto: required: - count @@ -8296,9 +8440,26 @@ components: - quota type: object properties: + jdbcMethod: + type: string + example: mariadb + host: + type: string + example: data-db + port: + type: integer + format: int32 + example: 3306 + username: + type: string + example: username + database: + type: string + example: air_quality id: type: integer format: int64 + example: 4 name: type: string example: Air Quality @@ -8317,42 +8478,52 @@ components: format: date-time internal_name: type: string - example: data-db + example: air_quality ui_host: type: string + example: example.com ui_port: type: integer format: int32 + example: 3306 ColumnBriefDto: required: - - column_type - database_id - id - internal_name - name - table_id + - type type: object properties: id: type: integer format: int64 + example: 1 name: + maxLength: 64 + minLength: 0 type: string - example: date + example: Given Name alias: type: string + example: firstname database_id: type: integer format: int64 + example: 2 table_id: type: integer format: int64 + example: 3 internal_name: + maxLength: 64 + minLength: 0 type: string - example: mdb_date - column_type: + example: given_name + type: type: string - example: date + example: varchar enum: - char - varchar @@ -8512,6 +8683,7 @@ components: id: type: integer format: int64 + example: 5 name: type: string example: mariadb @@ -8596,8 +8768,11 @@ components: checks: uniqueItems: true type: array + example: + - value > 1 items: type: string + example: '["value > 1"]' foreign_keys: type: array items: @@ -8613,6 +8788,7 @@ components: id: type: integer format: int64 + example: 8 ForeignKeyDto: required: - name @@ -8624,8 +8800,10 @@ components: id: type: integer format: int64 + example: 4 name: type: string + example: fk_name references: type: array items: @@ -8636,6 +8814,7 @@ components: $ref: '#/components/schemas/TableBriefDto' on_update: type: string + example: restrict enum: - restrict - cascade @@ -8644,6 +8823,7 @@ components: - set_default on_delete: type: string + example: restrict enum: - restrict - cascade @@ -8660,6 +8840,7 @@ components: id: type: integer format: int64 + example: 8 column: $ref: '#/components/schemas/ColumnBriefDto' foreign_key: @@ -8675,6 +8856,7 @@ components: id: type: integer format: int64 + example: 8 table: $ref: '#/components/schemas/TableBriefDto' column: @@ -8695,14 +8877,32 @@ components: - routing_key type: object properties: + jdbcMethod: + type: string + example: mariadb + host: + type: string + example: data-db + port: + type: integer + format: int32 + example: 3306 + username: + type: string + example: username + database: + type: string + example: air_quality id: type: integer format: int64 + example: 3 name: type: string example: Air Quality alias: type: string + example: a identifiers: type: array items: @@ -8726,6 +8926,7 @@ components: database_id: type: integer format: int64 + example: 2 internal_name: type: string example: air_quality @@ -8777,14 +8978,16 @@ components: id: type: integer format: int64 + example: 5 name: type: string + example: uk_name table: $ref: '#/components/schemas/TableBriefDto' columns: type: array items: - $ref: '#/components/schemas/ColumnDto' + $ref: '#/components/schemas/ColumnBriefDto' TableColumnEntityDto: required: - column_id @@ -8828,6 +9031,7 @@ components: id: type: integer format: int64 + example: 4 hash: type: string example: f829dd8a884182d0da846f365dee1221fd16610a14c81b8f9f295ff162749e50 diff --git a/dbrepo-data-service/rest-service/src/main/java/at/tuwien/endpoints/AccessEndpoint.java b/dbrepo-data-service/rest-service/src/main/java/at/tuwien/endpoints/AccessEndpoint.java index 99df658030a904139e60b660c42774c51fa9ac4d..4d3803a1e1c7159903ae090515edf5d9f353b068 100644 --- a/dbrepo-data-service/rest-service/src/main/java/at/tuwien/endpoints/AccessEndpoint.java +++ b/dbrepo-data-service/rest-service/src/main/java/at/tuwien/endpoints/AccessEndpoint.java @@ -1,7 +1,7 @@ package at.tuwien.endpoints; +import at.tuwien.api.database.CreateAccessDto; import at.tuwien.api.database.DatabaseDto; -import at.tuwien.api.database.UpdateDatabaseAccessDto; import at.tuwien.api.error.ApiErrorDto; import at.tuwien.api.user.UserDto; import at.tuwien.exception.*; @@ -76,7 +76,7 @@ public class AccessEndpoint extends RestEndpoint { }) public ResponseEntity<Void> create(@NotNull @PathVariable("databaseId") Long databaseId, @PathVariable("userId") UUID userId, - @Valid @RequestBody UpdateDatabaseAccessDto data) + @Valid @RequestBody CreateAccessDto data) throws NotAllowedException, DatabaseUnavailableException, DatabaseNotFoundException, RemoteUnavailableException, UserNotFoundException, DatabaseMalformedException, MetadataServiceException { log.debug("endpoint give access to database, databaseId={}, userId={}", databaseId, userId); @@ -132,7 +132,7 @@ public class AccessEndpoint extends RestEndpoint { }) public ResponseEntity<Void> update(@NotNull @PathVariable("databaseId") Long databaseId, @PathVariable("userId") UUID userId, - @Valid @RequestBody UpdateDatabaseAccessDto access) throws NotAllowedException, + @Valid @RequestBody CreateAccessDto access) throws NotAllowedException, DatabaseUnavailableException, DatabaseNotFoundException, RemoteUnavailableException, UserNotFoundException, DatabaseMalformedException, MetadataServiceException { log.debug("endpoint modify access to database, databaseId={}, userId={}, access.type={}", databaseId, userId, diff --git a/dbrepo-data-service/rest-service/src/main/java/at/tuwien/endpoints/TableEndpoint.java b/dbrepo-data-service/rest-service/src/main/java/at/tuwien/endpoints/TableEndpoint.java index 077ec5b8190064145b29b98cb8d5a50879b06689..35c646674712a531ed475532220afed30ab01295 100644 --- a/dbrepo-data-service/rest-service/src/main/java/at/tuwien/endpoints/TableEndpoint.java +++ b/dbrepo-data-service/rest-service/src/main/java/at/tuwien/endpoints/TableEndpoint.java @@ -288,7 +288,7 @@ public class TableEndpoint extends RestEndpoint { headers.set("Access-Control-Expose-Headers", "X-Headers"); headers.set("X-Headers", String.join(",", table.getColumns().stream().map(ColumnDto::getInternalName).toList())); final Dataset<Row> dataset = tableService.getData(credentialService.getDatabase(table.getTdbid()), - table.getInternalName(), timestamp, null, null, null, null); + table.getInternalName(), timestamp, page, size, null, null); metricsService.countTableGetData(databaseId, tableId); return ResponseEntity.ok() .headers(headers) diff --git a/dbrepo-data-service/services/src/main/java/at/tuwien/mapper/DataMapper.java b/dbrepo-data-service/services/src/main/java/at/tuwien/mapper/DataMapper.java index 5b96a5934b83e2c4636590f7515f70c04aef5826..e287cd9d9c1cbcace2f0440785776a80388608ee 100644 --- a/dbrepo-data-service/services/src/main/java/at/tuwien/mapper/DataMapper.java +++ b/dbrepo-data-service/services/src/main/java/at/tuwien/mapper/DataMapper.java @@ -176,7 +176,6 @@ public interface DataMapper { default ViewDto resultSetToTable(ResultSet resultSet, ViewDto view, QueryConfig queryConfig) throws SQLException { final ViewColumnDto column = ViewColumnDto.builder() .ordinalPosition(resultSet.getInt(1) - 1) /* start at zero */ - .autoGenerated(resultSet.getString(2) != null && resultSet.getString(2).startsWith("nextval")) .isNullAllowed(resultSet.getString(3).equals("YES")) .columnType(ColumnTypeDto.valueOf(resultSet.getString(4).toUpperCase())) .d(resultSet.getString(7) != null ? resultSet.getLong(7) : null) @@ -256,7 +255,7 @@ public interface DataMapper { if (optional2.isPresent()) { optional2.get() .getColumns() - .add(column); + .add(columnDtoToColumnBriefDto(column)); return table; } if (type.equals("UNIQUE")) { @@ -264,7 +263,7 @@ public interface DataMapper { .getUniques() .add(UniqueDto.builder() .name(name) - .columns(new LinkedList<>(List.of(column))) + .columns(new LinkedList<>(List.of(columnDtoToColumnBriefDto(column)))) .build()); return table; } diff --git a/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/CacheableDto.java b/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/CacheableDto.java index 66de637504b45ce516c2e1bbcef7abea81f747aa..4ff6f699d68d8b26ec576e6be1d40134722b0640 100644 --- a/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/CacheableDto.java +++ b/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/CacheableDto.java @@ -2,6 +2,7 @@ package at.tuwien.api; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; +import io.swagger.v3.oas.annotations.media.Schema; import lombok.EqualsAndHashCode; import lombok.Getter; import lombok.Setter; @@ -16,22 +17,23 @@ import java.time.Instant; public abstract class CacheableDto { @JsonProperty("last_retrieved") + @Schema(example = "2025-01-23T12:09:01") private Instant lastRetrieved; @ToString.Exclude - @JsonIgnore + @Schema(example = "mariadb") private String jdbcMethod; @ToString.Exclude - @JsonIgnore + @Schema(example = "data-db") private String host; @ToString.Exclude - @JsonIgnore + @Schema(example = "3306") private Integer port; @ToString.Exclude - @JsonIgnore + @Schema(example = "username") private String username; @ToString.Exclude @@ -39,7 +41,7 @@ public abstract class CacheableDto { private String password; @ToString.Exclude - @JsonIgnore + @Schema(example = "air_quality") private String database; } diff --git a/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/container/ContainerBriefDto.java b/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/container/ContainerBriefDto.java index 9b1f8fcd4791d018970cb8559b5a7dcd1b1d7210..71e7601b164bbda3a1efd21557d9695322ad0715 100644 --- a/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/container/ContainerBriefDto.java +++ b/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/container/ContainerBriefDto.java @@ -22,6 +22,7 @@ import java.time.Instant; public class ContainerBriefDto { @NotNull + @Schema(example = "4") private Long id; @NotNull diff --git a/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/container/ContainerDto.java b/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/container/ContainerDto.java index da782c2bb7a7c7bce6b5ed58f5986093c084e9ae..56d0df315f3875ac93e07e3e9a80b94179586c9b 100644 --- a/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/container/ContainerDto.java +++ b/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/container/ContainerDto.java @@ -2,7 +2,6 @@ package at.tuwien.api.container; import at.tuwien.api.CacheableDto; import at.tuwien.api.container.image.ImageDto; -import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; import io.swagger.v3.oas.annotations.media.Schema; @@ -16,6 +15,7 @@ import java.time.Instant; @Getter @Setter @Builder +@EqualsAndHashCode(callSuper = true) @NoArgsConstructor @AllArgsConstructor @Jacksonized @@ -23,6 +23,7 @@ import java.time.Instant; public class ContainerDto extends CacheableDto { @NotNull + @Schema(example = "4") private Long id; @NotBlank @@ -31,19 +32,15 @@ public class ContainerDto extends CacheableDto { @NotBlank @JsonProperty("internal_name") - @Schema(example = "data-db") + @Schema(example = "air_quality") private String internalName; - @NotBlank - private String host; - - @NotNull - private Integer port; - @JsonProperty("ui_host") + @Schema(example = "example.com") private String uiHost; @JsonProperty("ui_port") + @Schema(example = "3306") private Integer uiPort; @NotNull @@ -60,14 +57,23 @@ public class ContainerDto extends CacheableDto { /* lombok limitations prevent from convenient builder functions */ @JsonProperty("last_retrieved") + @Schema(example = "2025-01-23T12:09:01") private Instant lastRetrieved; @ToString.Exclude - @JsonIgnore + @Schema(example = "mariadb") private String jdbcMethod; @ToString.Exclude - @JsonIgnore + @Schema(example = "data-db") + private String host; + + @ToString.Exclude + @Schema(example = "3306") + private Integer port; + + @ToString.Exclude + @Schema(example = "username") private String username; @ToString.Exclude @@ -75,7 +81,7 @@ public class ContainerDto extends CacheableDto { private String password; @ToString.Exclude - @JsonIgnore + @Schema(example = "air_quality") private String database; } diff --git a/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/container/ContainerCreateDto.java b/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/container/CreateContainerDto.java similarity index 68% rename from dbrepo-metadata-service/api/src/main/java/at/tuwien/api/container/ContainerCreateDto.java rename to dbrepo-metadata-service/api/src/main/java/at/tuwien/api/container/CreateContainerDto.java index 86b50bea70209334a41458c47610c07f44f1799f..23062ffd9082098f13524ddd283b39310ecf39d5 100644 --- a/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/container/ContainerCreateDto.java +++ b/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/container/CreateContainerDto.java @@ -14,7 +14,7 @@ import lombok.extern.jackson.Jacksonized; @AllArgsConstructor @Jacksonized @ToString -public class ContainerCreateDto { +public class CreateContainerDto { @NotBlank @Schema(example = "Air Quality") @@ -22,20 +22,22 @@ public class ContainerCreateDto { @NotNull @JsonProperty("image_id") - @Schema(description = "Image ID") + @Schema(example = "1", description = "Image ID") private Long imageId; @NotBlank - @Schema(description = "Hostname of container") + @Schema(example = "data-db2", description = "Hostname of container") private String host; - @Schema(description = "Port of container") + @Schema(example = "3306", description = "Port of container") private Integer port; @JsonProperty("ui_host") + @Schema(example = "example.com") private String uiHost; @JsonProperty("ui_port") + @Schema(example = "3306") private Integer uiPort; @NotNull @@ -44,11 +46,11 @@ public class ContainerCreateDto { @NotBlank @JsonProperty("privileged_username") - @Schema(description = "Username of privileged user", example = "root") + @Schema(example = "root", description = "Username of privileged user") private String privilegedUsername; @NotBlank @JsonProperty("privileged_password") - @Schema(description = "Password of privileged user") + @Schema(example = "dbrepo", description = "Password of privileged user") private String privilegedPassword; } diff --git a/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/container/image/ImageBriefDto.java b/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/container/image/ImageBriefDto.java index 880db11fbd9818ed432f8dab7a910c48a51bf72e..6a9a970c0f5b3931bbcab7f53be099138d568c12 100644 --- a/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/container/image/ImageBriefDto.java +++ b/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/container/image/ImageBriefDto.java @@ -18,6 +18,7 @@ import lombok.extern.jackson.Jacksonized; public class ImageBriefDto { @NotNull + @Schema(example = "5") private Long id; @NotBlank diff --git a/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/container/image/ImageDto.java b/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/container/image/ImageDto.java index 3baa76171b1ad00ab575a0fafa403c675e16f640..a9c37fb8485db0e90b4b5d56b91b53ad4ec47940 100644 --- a/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/container/image/ImageDto.java +++ b/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/container/image/ImageDto.java @@ -20,6 +20,7 @@ import java.util.List; public class ImageDto { @NotNull + @Schema(example = "1") private Long id; @NotBlank diff --git a/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/database/AccessTypeDto.java b/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/database/AccessTypeDto.java index a93e89ec96fd19a78767f135366422301d42d959..fa0f6fea49e0aaf1823ba26f70aa918ecd96d98d 100644 --- a/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/database/AccessTypeDto.java +++ b/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/database/AccessTypeDto.java @@ -1,9 +1,11 @@ package at.tuwien.api.database; import com.fasterxml.jackson.annotation.JsonProperty; +import io.swagger.v3.oas.annotations.media.Schema; import lombok.Getter; @Getter +@Schema public enum AccessTypeDto { @JsonProperty("read") diff --git a/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/database/UpdateDatabaseAccessDto.java b/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/database/CreateAccessDto.java similarity index 72% rename from dbrepo-metadata-service/api/src/main/java/at/tuwien/api/database/UpdateDatabaseAccessDto.java rename to dbrepo-metadata-service/api/src/main/java/at/tuwien/api/database/CreateAccessDto.java index 32084c865feafc27fd1ae0a1a534229b347d3538..965e10afd50884605ca8788a4653b2b2dc3b9f09 100644 --- a/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/database/UpdateDatabaseAccessDto.java +++ b/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/database/CreateAccessDto.java @@ -1,5 +1,6 @@ package at.tuwien.api.database; +import io.swagger.v3.oas.annotations.media.Schema; import jakarta.validation.constraints.NotNull; import lombok.*; import lombok.extern.jackson.Jacksonized; @@ -12,9 +13,10 @@ import lombok.extern.jackson.Jacksonized; @AllArgsConstructor @Jacksonized @ToString -public class UpdateDatabaseAccessDto { +public class CreateAccessDto { @NotNull + @Schema(example = "read") private AccessTypeDto type; diff --git a/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/database/DatabaseAccessDto.java b/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/database/DatabaseAccessDto.java index 7e929eb74843d7ad5589652c269f59d8bd7db498..d065a5892afb0cb342c12975f562820d1eeb6b10 100644 --- a/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/database/DatabaseAccessDto.java +++ b/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/database/DatabaseAccessDto.java @@ -3,6 +3,7 @@ package at.tuwien.api.database; import at.tuwien.api.user.UserBriefDto; import com.fasterxml.jackson.annotation.JsonIgnore; +import io.swagger.v3.oas.annotations.media.Schema; import jakarta.validation.constraints.NotNull; import lombok.*; import lombok.extern.jackson.Jacksonized; @@ -31,6 +32,7 @@ public class DatabaseAccessDto { private UserBriefDto user; @NotNull + @Schema(example = "read") private AccessTypeDto type; } diff --git a/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/database/DatabaseBriefDto.java b/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/database/DatabaseBriefDto.java index 7b47a617ec2a5a55256c04554357cd26a467a0fa..4cff48db18b1b337de7ae9d3a50c986e4c329028 100644 --- a/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/database/DatabaseBriefDto.java +++ b/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/database/DatabaseBriefDto.java @@ -23,6 +23,7 @@ import java.util.UUID; public class DatabaseBriefDto { @NotNull + @Schema(example = "3") private Long id; @NotBlank @@ -47,6 +48,7 @@ public class DatabaseBriefDto { @Schema(example = "true") private Boolean isSchemaPublic; + @NotNull private List<IdentifierBriefDto> identifiers; @NotNull @@ -54,6 +56,7 @@ public class DatabaseBriefDto { @NotNull @JsonProperty("owner_id") + @Schema(example = "2f45ef7a-7f9b-4667-9156-152c87fe1ca5") private UUID ownerId; @JsonProperty("preview_image") diff --git a/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/database/DatabaseDto.java b/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/database/DatabaseDto.java index 044e52df382cad09207487005ab496915b93dd99..c6866c494b179db858875e555f87aa761dd3e5db 100644 --- a/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/database/DatabaseDto.java +++ b/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/database/DatabaseDto.java @@ -27,6 +27,7 @@ import java.util.List; public class DatabaseDto extends CacheableDto { @NotNull + @Schema(example = "3") private Long id; @NotBlank @@ -50,8 +51,10 @@ public class DatabaseDto extends CacheableDto { @Schema(example = "Air Quality") private String description; + @NotNull private List<TableDto> tables; + @NotNull private List<ViewDto> views; @NotNull @@ -67,10 +70,13 @@ public class DatabaseDto extends CacheableDto { @NotNull private ContainerDto container; + @NotNull private List<DatabaseAccessDto> accesses; + @NotNull private List<IdentifierDto> identifiers; + @NotNull private List<IdentifierDto> subsets; @NotNull @@ -85,22 +91,23 @@ public class DatabaseDto extends CacheableDto { /* lombok limitations prevent from convenient builder functions */ @JsonProperty("last_retrieved") + @Schema(example = "2025-01-23T12:09:01") private Instant lastRetrieved; @ToString.Exclude - @JsonIgnore + @Schema(example = "mariadb") private String jdbcMethod; @ToString.Exclude - @JsonIgnore + @Schema(example = "data-db") private String host; @ToString.Exclude - @JsonIgnore + @Schema(example = "3306") private Integer port; @ToString.Exclude - @JsonIgnore + @Schema(example = "username") private String username; @ToString.Exclude @@ -108,7 +115,7 @@ public class DatabaseDto extends CacheableDto { private String password; @ToString.Exclude - @JsonIgnore + @Schema(example = "air_quality") private String database; } diff --git a/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/database/ViewBriefDto.java b/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/database/ViewBriefDto.java index 9b7c9fca89472a956b5d142e69c498c616fce81a..f68067e8a870f01b402b23a3b27bd0a065e186fd 100644 --- a/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/database/ViewBriefDto.java +++ b/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/database/ViewBriefDto.java @@ -20,10 +20,12 @@ import java.util.UUID; public class ViewBriefDto { @NotNull + @Schema(example = "4") private Long id; @NotNull @JsonProperty("database_id") + @Schema(example = "1") private Long vdbid; @NotBlank @@ -31,8 +33,8 @@ public class ViewBriefDto { private String name; @NotBlank - @JsonProperty("internal_name") @Schema(example = "air_quality") + @JsonProperty("internal_name") private String internalName; @JsonProperty("is_public") @@ -57,6 +59,7 @@ public class ViewBriefDto { private String queryHash; @JsonProperty("owned_by") + @Schema(example = "ac750fcf-ea02-4fce-85ac-d73857e18b35") private UUID ownedBy; } diff --git a/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/database/ViewColumnDto.java b/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/database/ViewColumnDto.java index 4005433afedbd5440b939d97bcd874f570a56c29..24cca8e4cc7325904c83845d42d060814753d171 100644 --- a/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/database/ViewColumnDto.java +++ b/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/database/ViewColumnDto.java @@ -20,42 +20,41 @@ import lombok.extern.jackson.Jacksonized; public class ViewColumnDto { @NotNull + @Schema(example = "12") private Long id; @NotNull @JsonProperty("database_id") + @Schema(example = "1") private Long databaseId; @NotNull - @Schema(example = "0") @JsonProperty("ord") + @Schema(example = "0") private Integer ordinalPosition; @NotBlank @Size(max = 64) - @Schema(example = "Date") + @Schema(example = "Given Name") private String name; @NotBlank @Size(max = 64) @JsonProperty("internal_name") - @Schema(example = "mdb_date") + @Schema(example = "given_name") private String internalName; - @NotNull - @JsonProperty("auto_generated") - @Schema(example = "false") - private Boolean autoGenerated; - @JsonProperty("index_length") + @Schema(example = "255") private Long indexLength; @JsonProperty("length") + @Schema(example = "255") private Long length; @NotNull @JsonProperty("type") - @Schema(example = "string") + @Schema(example = "varchar") private ColumnTypeDto columnType; @Schema(example = "255") diff --git a/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/database/ViewDto.java b/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/database/ViewDto.java index 13e64911f5f9e43fb8141ed1879b84bd3410e8fd..2785cf71075f3f254986290bacc184954b3d10bf 100644 --- a/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/database/ViewDto.java +++ b/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/database/ViewDto.java @@ -25,16 +25,19 @@ import java.util.List; public class ViewDto extends CacheableDto { @NotNull + @Schema(example = "4") private Long id; @NotNull @JsonProperty("database_id") + @Schema(example = "1") private Long vdbid; @NotBlank @Schema(example = "Air Quality") private String name; + @NotNull private List<IdentifierDto> identifiers; @NotBlank @@ -72,22 +75,23 @@ public class ViewDto extends CacheableDto { /* lombok limitations prevent from convenient builder functions */ @JsonProperty("last_retrieved") + @Schema(example = "2025-01-23T12:09:01") private Instant lastRetrieved; @ToString.Exclude - @JsonIgnore + @Schema(example = "mariadb") private String jdbcMethod; @ToString.Exclude - @JsonIgnore + @Schema(example = "data-db") private String host; @ToString.Exclude - @JsonIgnore + @Schema(example = "3306") private Integer port; @ToString.Exclude - @JsonIgnore + @Schema(example = "username") private String username; @ToString.Exclude @@ -95,7 +99,7 @@ public class ViewDto extends CacheableDto { private String password; @ToString.Exclude - @JsonIgnore + @Schema(example = "air_quality") private String database; } diff --git a/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/database/query/ImportDto.java b/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/database/query/ImportDto.java index 39cb6683a1cb2d5250054b8dd555bffbad929fad..20817e017622ff5619cf1eaf284f238ba02dff4b 100644 --- a/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/database/query/ImportDto.java +++ b/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/database/query/ImportDto.java @@ -22,7 +22,7 @@ public class ImportDto { private String location; @NotNull - @Schema(description = "If true, the first line contains the column names, otherwise it contains only data") + @Schema(example = "true", description = "If true, the first line contains the column names, otherwise it contains only data") private Boolean header; @NotNull diff --git a/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/database/query/QueryDto.java b/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/database/query/QueryDto.java index cd1659e73c6a1e0a13e220e4a83aaaf5b5aacc2f..41cb641a5d8cdf8ccc6187c2f083447e4cdb4714 100644 --- a/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/database/query/QueryDto.java +++ b/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/database/query/QueryDto.java @@ -24,10 +24,12 @@ import java.util.List; public class QueryDto { @NotNull + @Schema(example = "4") private Long id; @NotNull @JsonProperty("database_id") + @Schema(example = "1") private Long databaseId; @NotNull diff --git a/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/database/query/QueryTypeDto.java b/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/database/query/QueryTypeDto.java index afc03ab97f9742d5d4d639b546ae983fa7525f35..4df28733cdba0830b0e1579805284a92581c42bb 100644 --- a/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/database/query/QueryTypeDto.java +++ b/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/database/query/QueryTypeDto.java @@ -1,7 +1,9 @@ package at.tuwien.api.database.query; import com.fasterxml.jackson.annotation.JsonProperty; +import io.swagger.v3.oas.annotations.media.Schema; +@Schema public enum QueryTypeDto { @JsonProperty("query") diff --git a/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/database/table/TableBriefDto.java b/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/database/table/TableBriefDto.java index 29531012f1f2912cc7d7f0c326661cee868ec72d..98932f30a294febdc3df41290888c0d6d3ae7e5d 100644 --- a/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/database/table/TableBriefDto.java +++ b/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/database/table/TableBriefDto.java @@ -20,10 +20,12 @@ import java.util.UUID; public class TableBriefDto { @NotNull + @Schema(example = "3") private Long id; @NotNull @JsonProperty("database_id") + @Schema(example = "2") private Long databaseId; @NotBlank @@ -55,5 +57,6 @@ public class TableBriefDto { @NotNull @JsonProperty("owned_by") + @Schema(example = "78337b80-5699-45db-8111-cec86439ab6b") private UUID ownedBy; } diff --git a/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/database/table/TableDto.java b/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/database/table/TableDto.java index cf18e321a42fea956345bdafa1ff265a3f6426b2..ba80f473b8f248c2295359b2e8162c987324a3f4 100644 --- a/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/database/table/TableDto.java +++ b/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/database/table/TableDto.java @@ -28,10 +28,12 @@ import java.util.List; public class TableDto extends CacheableDto { @NotNull + @Schema(example = "3") private Long id; @NotNull @JsonProperty("database_id") + @Schema(example = "2") private Long tdbid; @NotBlank @@ -43,7 +45,7 @@ public class TableDto extends CacheableDto { @Schema(example = "air_quality") private String internalName; - @Schema + @Schema(example = "a") private String alias; private List<IdentifierDto> identifiers; @@ -109,22 +111,23 @@ public class TableDto extends CacheableDto { /* lombok limitations prevent from convenient builder functions */ @JsonProperty("last_retrieved") + @Schema(example = "2025-01-23T12:09:01") private Instant lastRetrieved; @ToString.Exclude - @JsonIgnore + @Schema(example = "mariadb") private String jdbcMethod; @ToString.Exclude - @JsonIgnore + @Schema(example = "data-db") private String host; @ToString.Exclude - @JsonIgnore + @Schema(example = "3306") private Integer port; @ToString.Exclude - @JsonIgnore + @Schema(example = "username") private String username; @ToString.Exclude @@ -132,7 +135,7 @@ public class TableDto extends CacheableDto { private String password; @ToString.Exclude - @JsonIgnore + @Schema(example = "air_quality") private String database; } diff --git a/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/database/table/TupleDeleteDto.java b/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/database/table/TupleDeleteDto.java index 6c3a946e1257dd2a9a90175a1904d88cf2f1a339..f74ffb3d89a1cfc5582be30e89ff0cb6a573f8c5 100644 --- a/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/database/table/TupleDeleteDto.java +++ b/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/database/table/TupleDeleteDto.java @@ -1,5 +1,6 @@ package at.tuwien.api.database.table; +import io.swagger.v3.oas.annotations.media.Schema; import jakarta.validation.constraints.NotNull; import lombok.*; import lombok.extern.jackson.Jacksonized; @@ -17,6 +18,7 @@ import java.util.Map; public class TupleDeleteDto { @NotNull + @Schema(example = "{\"id\": 1}") private Map<String, Object> keys; } diff --git a/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/database/table/TupleDto.java b/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/database/table/TupleDto.java index 62f57434b67dfe69e95bd212afb795f004da87d7..13dc2b9723e763a5b255c762f1d94974ef90d074 100644 --- a/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/database/table/TupleDto.java +++ b/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/database/table/TupleDto.java @@ -1,5 +1,6 @@ package at.tuwien.api.database.table; +import io.swagger.v3.oas.annotations.media.Schema; import jakarta.validation.constraints.NotNull; import lombok.*; import lombok.extern.jackson.Jacksonized; @@ -17,6 +18,7 @@ import java.util.Map; public class TupleDto { @NotNull + @Schema(example = "{\"key\": \"value\"}") private Map<String, Object> data; } diff --git a/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/database/table/TupleUpdateDto.java b/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/database/table/TupleUpdateDto.java index be50791b944db8eada4316ca6ee975dedf95a113..ab3f1ae8758c69a9bfa0958e9a53e5326d8c91a9 100644 --- a/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/database/table/TupleUpdateDto.java +++ b/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/database/table/TupleUpdateDto.java @@ -1,5 +1,6 @@ package at.tuwien.api.database.table; +import io.swagger.v3.oas.annotations.media.Schema; import jakarta.validation.constraints.NotNull; import lombok.*; import lombok.extern.jackson.Jacksonized; @@ -17,9 +18,11 @@ import java.util.Map; public class TupleUpdateDto { @NotNull + @Schema(example = "{\"key\": \"value\"}") private Map<String, Object> data; @NotNull + @Schema(example = "{\"id\": 1}") private Map<String, Object> keys; } \ No newline at end of file diff --git a/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/database/table/columns/ColumnBriefDto.java b/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/database/table/columns/ColumnBriefDto.java index 4dee5f0837148f9c2d1095fdbe12d6ab664672ef..bc13700bdd83dfac5fe23c133509c0184834b7a9 100644 --- a/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/database/table/columns/ColumnBriefDto.java +++ b/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/database/table/columns/ColumnBriefDto.java @@ -4,6 +4,7 @@ import com.fasterxml.jackson.annotation.JsonProperty; import io.swagger.v3.oas.annotations.media.Schema; import jakarta.validation.constraints.NotBlank; import jakarta.validation.constraints.NotNull; +import jakarta.validation.constraints.Size; import lombok.*; import lombok.extern.jackson.Jacksonized; @@ -18,31 +19,36 @@ import lombok.extern.jackson.Jacksonized; public class ColumnBriefDto { @NotNull + @Schema(example = "1") private Long id; - @JsonProperty("database_id") @NotNull + @Schema(example = "2") + @JsonProperty("database_id") private Long databaseId; - @JsonProperty("table_id") @NotNull + @Schema(example = "3") + @JsonProperty("table_id") private Long tableId; @NotBlank - @Schema(example = "date") + @Size(max = 64) + @Schema(example = "Given Name") private String name; @NotBlank + @Size(max = 64) @JsonProperty("internal_name") - @Schema(example = "mdb_date") + @Schema(example = "given_name") private String internalName; - @Schema + @Schema(example = "firstname") private String alias; @NotNull - @JsonProperty("column_type") - @Schema(example = "date") + @JsonProperty("type") + @Schema(example = "varchar") private ColumnTypeDto columnType; } diff --git a/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/database/table/columns/ColumnDto.java b/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/database/table/columns/ColumnDto.java index 465bd3bd1e3287dcf6b700e8c44d91ab25ad67c6..462821b53c0a8a01a7acb36f15a25641ac895cd8 100644 --- a/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/database/table/columns/ColumnDto.java +++ b/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/database/table/columns/ColumnDto.java @@ -29,18 +29,18 @@ public class ColumnDto { private Long id; @NotNull - @Schema(example = "2") @JsonProperty("database_id") + @Schema(example = "2") private Long databaseId; @NotNull - @Schema(example = "3") @JsonProperty("table_id") + @Schema(example = "3") private Long tableId; @NotNull - @Schema(example = "0") @JsonProperty("ord") + @Schema(example = "0") private Integer ordinalPosition; @NotBlank @@ -119,9 +119,11 @@ public class ColumnDto { @Schema(example = "false") private Boolean isNullAllowed; + @Schema(example = "[\"val1\"]") @Parameter(description = "enum values, only considered when type = ENUM") private List<String> enums; + @Schema(example = "[\"val1\"]") @Parameter(description = "enum values, only considered when type = ENUM") private List<String> sets; diff --git a/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/database/table/columns/ColumnTypeDto.java b/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/database/table/columns/ColumnTypeDto.java index d44b25b84ed4c51075ab4c075433750c4aafca42..a96337082937c085e28957b7768a354dc5ed8dd6 100644 --- a/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/database/table/columns/ColumnTypeDto.java +++ b/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/database/table/columns/ColumnTypeDto.java @@ -1,10 +1,12 @@ package at.tuwien.api.database.table.columns; import com.fasterxml.jackson.annotation.JsonProperty; +import io.swagger.v3.oas.annotations.media.Schema; import lombok.Getter; /* MYSQL 8 */ @Getter +@Schema public enum ColumnTypeDto { @JsonProperty("char") diff --git a/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/database/table/constraints/ConstraintsDto.java b/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/database/table/constraints/ConstraintsDto.java index 3cd36f6d687892224e668100e6171552c090b449..b9288b659bb7e2accb18c14e8258f631327d10f3 100644 --- a/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/database/table/constraints/ConstraintsDto.java +++ b/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/database/table/constraints/ConstraintsDto.java @@ -4,6 +4,7 @@ import at.tuwien.api.database.table.constraints.foreign.ForeignKeyDto; import at.tuwien.api.database.table.constraints.primary.PrimaryKeyDto; import at.tuwien.api.database.table.constraints.unique.UniqueDto; import com.fasterxml.jackson.annotation.JsonProperty; +import io.swagger.v3.oas.annotations.media.Schema; import lombok.*; import lombok.extern.jackson.Jacksonized; @@ -24,6 +25,7 @@ public class ConstraintsDto { @JsonProperty("foreign_keys") private List<ForeignKeyDto> foreignKeys; + @Schema(example = "[\"value > 1\"]") private Set<String> checks; @JsonProperty("primary_key") diff --git a/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/database/table/constraints/foreign/ForeignKeyBriefDto.java b/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/database/table/constraints/foreign/ForeignKeyBriefDto.java index 58a4d5b2453f617297673891f4a879fb02409f10..a22b8749ae7f09186771bf18343b1f77376d77dd 100644 --- a/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/database/table/constraints/foreign/ForeignKeyBriefDto.java +++ b/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/database/table/constraints/foreign/ForeignKeyBriefDto.java @@ -1,5 +1,6 @@ package at.tuwien.api.database.table.constraints.foreign; +import io.swagger.v3.oas.annotations.media.Schema; import lombok.*; import lombok.extern.jackson.Jacksonized; @@ -12,5 +13,7 @@ import lombok.extern.jackson.Jacksonized; @ToString public class ForeignKeyBriefDto { + @NonNull + @Schema(example = "8") private Long id; } diff --git a/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/database/table/constraints/foreign/ForeignKeyDto.java b/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/database/table/constraints/foreign/ForeignKeyDto.java index 8016de91316bb0a5cbac30fc4148ecc39acdc33b..254666f9eb6b056501bc08ecebb745c5eac61345 100644 --- a/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/database/table/constraints/foreign/ForeignKeyDto.java +++ b/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/database/table/constraints/foreign/ForeignKeyDto.java @@ -4,6 +4,7 @@ import at.tuwien.api.database.table.TableBriefDto; import at.tuwien.api.database.table.TableDto; import at.tuwien.api.database.table.columns.ColumnDto; import com.fasterxml.jackson.annotation.JsonProperty; +import io.swagger.v3.oas.annotations.media.Schema; import jakarta.validation.constraints.NotNull; import lombok.*; import lombok.extern.jackson.Jacksonized; @@ -19,9 +20,11 @@ import java.util.List; @ToString public class ForeignKeyDto { + @Schema(example = "4") private Long id; @NotNull + @Schema(example = "fk_name") private String name; @NotNull @@ -35,8 +38,10 @@ public class ForeignKeyDto { private TableBriefDto referencedTable; @JsonProperty("on_update") + @Schema(example = "restrict") private ReferenceTypeDto onUpdate; @JsonProperty("on_delete") + @Schema(example = "restrict") private ReferenceTypeDto onDelete; } diff --git a/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/database/table/constraints/foreign/ForeignKeyReferenceDto.java b/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/database/table/constraints/foreign/ForeignKeyReferenceDto.java index 55fcc46ecf85fc097eeef7677b9d0c897c612aa3..f0d5b249cdbc41222a5c71c6d41855f1aa5cc5df 100644 --- a/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/database/table/constraints/foreign/ForeignKeyReferenceDto.java +++ b/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/database/table/constraints/foreign/ForeignKeyReferenceDto.java @@ -2,6 +2,7 @@ package at.tuwien.api.database.table.constraints.foreign; import at.tuwien.api.database.table.columns.ColumnBriefDto; import com.fasterxml.jackson.annotation.JsonProperty; +import io.swagger.v3.oas.annotations.media.Schema; import jakarta.validation.constraints.NotNull; import lombok.*; import lombok.extern.jackson.Jacksonized; @@ -15,6 +16,7 @@ import lombok.extern.jackson.Jacksonized; @ToString public class ForeignKeyReferenceDto { + @Schema(example = "8") private Long id; @NotNull diff --git a/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/database/table/constraints/primary/PrimaryKeyDto.java b/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/database/table/constraints/primary/PrimaryKeyDto.java index 80df5d443b70146c2ce2cda6e96bbf75c1816e28..86d1d49960d2c9496ce5d23e26fa99edadec344e 100644 --- a/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/database/table/constraints/primary/PrimaryKeyDto.java +++ b/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/database/table/constraints/primary/PrimaryKeyDto.java @@ -2,6 +2,7 @@ package at.tuwien.api.database.table.constraints.primary; import at.tuwien.api.database.table.TableBriefDto; import at.tuwien.api.database.table.columns.ColumnBriefDto; +import io.swagger.v3.oas.annotations.media.Schema; import jakarta.validation.constraints.NotNull; import lombok.*; import lombok.extern.jackson.Jacksonized; @@ -15,6 +16,7 @@ import lombok.extern.jackson.Jacksonized; @ToString public class PrimaryKeyDto { + @Schema(example = "8") private Long id; @NotNull diff --git a/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/database/table/constraints/unique/UniqueDto.java b/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/database/table/constraints/unique/UniqueDto.java index 2bcc9d6cf4fb4d130c398dc2ed0341af46f61df9..755f3a31b7a9634bff74c8992bb384719297c256 100644 --- a/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/database/table/constraints/unique/UniqueDto.java +++ b/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/database/table/constraints/unique/UniqueDto.java @@ -1,13 +1,11 @@ - package at.tuwien.api.database.table.constraints.unique; import at.tuwien.api.database.table.TableBriefDto; -import at.tuwien.api.database.table.TableDto; -import at.tuwien.api.database.table.columns.ColumnDto; +import at.tuwien.api.database.table.columns.ColumnBriefDto; +import io.swagger.v3.oas.annotations.media.Schema; import jakarta.validation.constraints.NotNull; import lombok.*; import lombok.extern.jackson.Jacksonized; -import org.springframework.data.annotation.Id; import java.util.List; @@ -21,14 +19,16 @@ import java.util.List; public class UniqueDto { @NotNull + @Schema(example = "5") private Long id; @NotNull + @Schema(example = "uk_name") private String name; @NotNull private TableBriefDto table; @NotNull - private List<ColumnDto> columns; + private List<ColumnBriefDto> columns; } diff --git a/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/identifier/CreatorBriefDto.java b/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/identifier/CreatorBriefDto.java new file mode 100644 index 0000000000000000000000000000000000000000..8265a1106bc8daef632f887e9c38c148d765fb01 --- /dev/null +++ b/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/identifier/CreatorBriefDto.java @@ -0,0 +1,53 @@ +package at.tuwien.api.identifier; + +import com.fasterxml.jackson.annotation.JsonProperty; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.NotNull; +import lombok.*; +import lombok.extern.jackson.Jacksonized; + + +@Getter +@Setter +@Builder +@EqualsAndHashCode +@NoArgsConstructor +@AllArgsConstructor +@Jacksonized +@ToString +public class CreatorBriefDto { + + @NotNull + @Schema(example = "11") + private Long id; + + @NotBlank + @JsonProperty("creator_name") + @Schema(example = "Carberry, Josiah") + private String creatorName; + + @JsonProperty("name_type") + @Schema(example = "Personal") + private NameTypeDto nameType; + + @JsonProperty("name_identifier") + @Schema(example = "0000-0002-1825-0097") + private String nameIdentifier; + + @JsonProperty("name_identifier_scheme") + @Schema(example = "ORCID") + private NameIdentifierSchemeTypeDto nameIdentifierScheme; + + @Schema(example = "Brown University") + private String affiliation; + + @JsonProperty("affiliation_identifier") + @Schema(example = "https://ror.org/05gq02987") + private String affiliationIdentifier; + + @JsonProperty("affiliation_identifier_scheme") + @Schema(example = "ROR") + private AffiliationIdentifierSchemeTypeDto affiliationIdentifierScheme; + +} diff --git a/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/identifier/CreatorDto.java b/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/identifier/CreatorDto.java index 9c166f869c5bcec81c1e67212616e03833fe64c7..a3a2976901aee60e60162788dd10df239206e826 100644 --- a/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/identifier/CreatorDto.java +++ b/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/identifier/CreatorDto.java @@ -21,6 +21,7 @@ import org.springframework.data.annotation.Id; public class CreatorDto { @NotNull + @Schema(example = "11") private Long id; @Schema(example = "Josiah") diff --git a/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/identifier/IdentifierBriefDto.java b/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/identifier/IdentifierBriefDto.java index 82ff3b0fe7947af8e6d9e79ec4b2efa5a001f38b..97f35026747aaf86f33b714dc83b1b3f173dda2f 100644 --- a/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/identifier/IdentifierBriefDto.java +++ b/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/identifier/IdentifierBriefDto.java @@ -20,6 +20,7 @@ import java.util.UUID; public class IdentifierBriefDto { @NotNull + @Schema(example = "2") private Long id; @NotNull @@ -40,8 +41,12 @@ public class IdentifierBriefDto { private Long viewId; @NotNull + @Schema(example = "database") private IdentifierTypeDto type; + @NotNull + private List<CreatorBriefDto> creators; + @NotNull private List<IdentifierTitleDto> titles; @@ -57,10 +62,13 @@ public class IdentifierBriefDto { @Schema(example = "2022") private Integer publicationYear; + @NotNull + @Schema(example = "draft") private IdentifierStatusTypeDto status; @NotNull - @JsonProperty("created_by") - private UUID createdBy; + @JsonProperty("owned_by") + @Schema(example = "2f45ef7a-7f9b-4667-9156-152c87fe1ca5") + private UUID ownedBy; } diff --git a/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/identifier/IdentifierDescriptionDto.java b/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/identifier/IdentifierDescriptionDto.java index 55e6ff76214a8af82ec32991c62aa265909d75f6..fbcbb3afe7b6cb9ca27aee16b2875c5ed5d03c1b 100644 --- a/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/identifier/IdentifierDescriptionDto.java +++ b/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/identifier/IdentifierDescriptionDto.java @@ -19,6 +19,7 @@ import org.springframework.data.annotation.Id; public class IdentifierDescriptionDto { @NotNull + @Schema(example = "3") private Long id; @Schema(example = "Air quality reports at Stephansplatz, Vienna") diff --git a/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/identifier/IdentifierDto.java b/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/identifier/IdentifierDto.java index 87baf4870661e292dbb69d180cfb1be43ac15f16..53d40ecd781169f531a6cf215d370fd69be9d2b0 100644 --- a/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/identifier/IdentifierDto.java +++ b/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/identifier/IdentifierDto.java @@ -25,6 +25,7 @@ import java.util.List; public class IdentifierDto { @NotNull + @Schema(example = "2") private Long id; @NotNull @@ -45,13 +46,16 @@ public class IdentifierDto { private Long viewId; @NotNull + @Schema(example = "database") private IdentifierTypeDto type; @NotNull private List<IdentifierTitleDto> titles; + @NotNull private List<IdentifierDescriptionDto> descriptions; + @NotNull private List<IdentifierFunderDto> funders; @NotBlank @@ -106,13 +110,17 @@ public class IdentifierDto { @Schema(example = "2022") private Integer publicationYear; + @NotNull private LanguageTypeDto language; + @NotNull private List<LicenseDto> licenses; @NotNull private List<CreatorDto> creators; + @NotNull + @Schema(example = "draft") private IdentifierStatusTypeDto status; } diff --git a/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/identifier/IdentifierFunderDto.java b/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/identifier/IdentifierFunderDto.java index 921ba3eb983840dee342071bfde0a75f478946b4..93084d2d17679b94d825600761c1aa03c3b1bdde 100644 --- a/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/identifier/IdentifierFunderDto.java +++ b/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/identifier/IdentifierFunderDto.java @@ -19,6 +19,7 @@ import org.springframework.data.annotation.Id; public class IdentifierFunderDto { @NotNull + @Schema(example = "2") private Long id; @NotBlank diff --git a/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/identifier/IdentifierTitleDto.java b/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/identifier/IdentifierTitleDto.java index 9333a05ce961a403b84463a10abc86ddb2a2e86c..27e3b323eaca7d9ab481af61059a05fbe576c42d 100644 --- a/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/identifier/IdentifierTitleDto.java +++ b/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/identifier/IdentifierTitleDto.java @@ -19,6 +19,7 @@ import org.springframework.data.annotation.Id; public class IdentifierTitleDto { @NotNull + @Schema(example = "4") private Long id; @Schema(example = "Airquality Demonstrator") diff --git a/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/identifier/RelatedIdentifierDto.java b/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/identifier/RelatedIdentifierDto.java index 74525bf711988a0690aeba9c403a44156885b0f3..6ff5d9aed1297f5a12755d76d03cc668a273e0e5 100644 --- a/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/identifier/RelatedIdentifierDto.java +++ b/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/identifier/RelatedIdentifierDto.java @@ -24,6 +24,7 @@ import java.time.Instant; public class RelatedIdentifierDto { @NotNull + @Schema(example = "8") private Long id; @NotNull diff --git a/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/user/UserDto.java b/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/user/UserDto.java index 43fb10201ba0ebbbb69c2286c629ff0d99fb57b1..26192f460f011b493056cd9778aa76e0f056c4ae 100644 --- a/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/user/UserDto.java +++ b/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/user/UserDto.java @@ -25,10 +25,6 @@ public class UserDto extends CacheableDto { @Schema(example = "1ffc7b0e-9aeb-4e8b-b8f1-68f3936155b4") private UUID id; - @NotNull - @Schema(example = "jcarberry", description = "Only contains lowercase characters") - private String username; - @Schema(example = "Josiah Carberry") private String name; @@ -44,14 +40,37 @@ public class UserDto extends CacheableDto { @Schema(example = "Carberry") private String lastname; - @ToString.Exclude - @JsonIgnore - private String password; - @NotNull private UserAttributesDto attributes; + /* lombok limitations prevent from convenient builder functions */ + @JsonProperty("last_retrieved") + @Schema(example = "2025-01-23T12:09:01") private Instant lastRetrieved; + @ToString.Exclude + @Schema(example = "mariadb") + private String jdbcMethod; + + @ToString.Exclude + @Schema(example = "data-db") + private String host; + + @ToString.Exclude + @Schema(example = "3306") + private Integer port; + + @ToString.Exclude + @Schema(example = "username") + private String username; + + @ToString.Exclude + @JsonIgnore + private String password; + + @ToString.Exclude + @Schema(example = "air_quality") + private String database; + } diff --git a/dbrepo-metadata-service/repositories/src/main/java/at/tuwien/mapper/MetadataMapper.java b/dbrepo-metadata-service/repositories/src/main/java/at/tuwien/mapper/MetadataMapper.java index ab13affe7e095cd0112827f8ccb49d760071a5ac..75f589e4c5dba7f08f2a0e799f4f6238569eb38b 100644 --- a/dbrepo-metadata-service/repositories/src/main/java/at/tuwien/mapper/MetadataMapper.java +++ b/dbrepo-metadata-service/repositories/src/main/java/at/tuwien/mapper/MetadataMapper.java @@ -2,7 +2,7 @@ package at.tuwien.mapper; import at.tuwien.api.auth.SignupRequestDto; import at.tuwien.api.container.ContainerBriefDto; -import at.tuwien.api.container.ContainerCreateDto; +import at.tuwien.api.container.CreateContainerDto; import at.tuwien.api.container.ContainerDto; import at.tuwien.api.container.image.DataTypeDto; import at.tuwien.api.container.image.ImageBriefDto; @@ -12,6 +12,7 @@ import at.tuwien.api.crossref.CrossrefDto; import at.tuwien.api.database.*; import at.tuwien.api.database.table.TableBriefDto; import at.tuwien.api.database.table.TableDto; +import at.tuwien.api.database.table.columns.ColumnBriefDto; import at.tuwien.api.database.table.columns.ColumnCreateDto; import at.tuwien.api.database.table.columns.ColumnDto; import at.tuwien.api.database.table.columns.concepts.ConceptDto; @@ -109,7 +110,7 @@ public interface MetadataMapper { @Mappings({ @Mapping(target = "internalName", source = "name", qualifiedByName = "internalMapping") }) - Container containerCreateRequestDtoToContainer(ContainerCreateDto data); + Container containerCreateRequestDtoToContainer(CreateContainerDto data); ContainerDto containerToContainerDto(Container data); @@ -302,7 +303,8 @@ public interface MetadataMapper { IdentifierDto identifierToIdentifierDto(Identifier data); @Mappings({ - @Mapping(target = "databaseId", source = "database.id") + @Mapping(target = "databaseId", source = "database.id"), + @Mapping(target = "ownedBy", source = "owner.id") }) IdentifierBriefDto identifierToIdentifierBriefDto(Identifier data); @@ -492,7 +494,7 @@ public interface MetadataMapper { .name(data.getName()) .columns(data.getColumns() .stream() - .map(this::tableColumnToColumnDto) + .map(this::tableColumnToColumnBriefDto) .toList()) .table(tableToTableBriefDto(data.getTable())) .build(); @@ -726,6 +728,12 @@ public interface MetadataMapper { }) ColumnDto tableColumnToColumnDto(TableColumn data); + @Mappings({ + @Mapping(target = "tableId", source = "table.id"), + @Mapping(target = "databaseId", source = "table.database.id") + }) + ColumnBriefDto tableColumnToColumnBriefDto(TableColumn data); + @Mappings({ @Mapping(target = "id", expression = "java(null)"), @Mapping(target = "columnType", source = "data.type"), diff --git a/dbrepo-metadata-service/rest-service/src/main/java/at/tuwien/endpoints/AccessEndpoint.java b/dbrepo-metadata-service/rest-service/src/main/java/at/tuwien/endpoints/AccessEndpoint.java index f184ffc3372ac10e35f2d6686b0c79e2ecaca818..9c109c87d68664793b3033d7be123d71a7b02d69 100644 --- a/dbrepo-metadata-service/rest-service/src/main/java/at/tuwien/endpoints/AccessEndpoint.java +++ b/dbrepo-metadata-service/rest-service/src/main/java/at/tuwien/endpoints/AccessEndpoint.java @@ -1,7 +1,7 @@ package at.tuwien.endpoints; import at.tuwien.api.database.DatabaseAccessDto; -import at.tuwien.api.database.UpdateDatabaseAccessDto; +import at.tuwien.api.database.CreateAccessDto; import at.tuwien.api.error.ApiErrorDto; import at.tuwien.entities.database.Database; import at.tuwien.entities.database.DatabaseAccess; @@ -91,7 +91,7 @@ public class AccessEndpoint extends AbstractEndpoint { }) public ResponseEntity<DatabaseAccessDto> create(@NotNull @PathVariable("databaseId") Long databaseId, @PathVariable("userId") UUID userId, - @Valid @RequestBody UpdateDatabaseAccessDto data, + @Valid @RequestBody CreateAccessDto data, @NotNull Principal principal) throws NotAllowedException, DataServiceException, DataServiceConnectionException, DatabaseNotFoundException, UserNotFoundException, AccessNotFoundException, SearchServiceException, SearchServiceConnectionException { @@ -153,7 +153,7 @@ public class AccessEndpoint extends AbstractEndpoint { }) public ResponseEntity<Void> update(@NotNull @PathVariable("databaseId") Long databaseId, @PathVariable("userId") UUID userId, - @Valid @RequestBody UpdateDatabaseAccessDto data, + @Valid @RequestBody CreateAccessDto data, @NotNull Principal principal) throws NotAllowedException, DataServiceException, DataServiceConnectionException, DatabaseNotFoundException, UserNotFoundException, AccessNotFoundException, SearchServiceException, SearchServiceConnectionException { diff --git a/dbrepo-metadata-service/rest-service/src/main/java/at/tuwien/endpoints/ContainerEndpoint.java b/dbrepo-metadata-service/rest-service/src/main/java/at/tuwien/endpoints/ContainerEndpoint.java index 3c506cfd0a910d10bba6401eebe5467d1c97e738..b5d153318cc9688d13784a80df41c6f28a862de3 100644 --- a/dbrepo-metadata-service/rest-service/src/main/java/at/tuwien/endpoints/ContainerEndpoint.java +++ b/dbrepo-metadata-service/rest-service/src/main/java/at/tuwien/endpoints/ContainerEndpoint.java @@ -1,7 +1,7 @@ package at.tuwien.endpoints; import at.tuwien.api.container.ContainerBriefDto; -import at.tuwien.api.container.ContainerCreateDto; +import at.tuwien.api.container.CreateContainerDto; import at.tuwien.api.container.ContainerDto; import at.tuwien.api.error.ApiErrorDto; import at.tuwien.entities.container.Container; @@ -105,7 +105,7 @@ public class ContainerEndpoint extends AbstractEndpoint { mediaType = "application/json", schema = @Schema(implementation = ApiErrorDto.class))}), }) - public ResponseEntity<ContainerDto> create(@Valid @RequestBody ContainerCreateDto data) + public ResponseEntity<ContainerDto> create(@Valid @RequestBody CreateContainerDto data) throws ImageNotFoundException, ContainerAlreadyExistsException { log.debug("endpoint create container, data={}", data); return ResponseEntity.status(HttpStatus.CREATED) diff --git a/dbrepo-metadata-service/rest-service/src/main/resources/application.yml b/dbrepo-metadata-service/rest-service/src/main/resources/application.yml index 290864eea961100236eea2764297d01251c1ccbc..01d2de7d8a0f73dcc667b69ed499ae350a81d317 100644 --- a/dbrepo-metadata-service/rest-service/src/main/resources/application.yml +++ b/dbrepo-metadata-service/rest-service/src/main/resources/application.yml @@ -3,7 +3,7 @@ application: version: '@project.version@' spring: datasource: - url: "jdbc:mariadb://${METADATA_HOST:metadata-db}:${METADATA_PORT:3306}/${METADATA_DB:dbrepo}${METADATA_JDBC_EXTRA_ARGS}" + url: "jdbc:mariadb://${METADATA_HOST:localhost}:${METADATA_PORT:3306}/${METADATA_DB:dbrepo}${METADATA_JDBC_EXTRA_ARGS:}" driver-class-name: org.mariadb.jdbc.Driver username: "${METADATA_USERNAME:root}" password: "${METADATA_DB_PASSWORD:dbrepo}" @@ -18,7 +18,7 @@ spring: application: name: metadata-service rabbitmq: - host: "${BROKER_HOST:broker-service}" + host: "${BROKER_HOST:localhost}" virtual-host: "${BROKER_VIRTUALHOST:dbrepo}" username: "${BROKER_USERNAME:admin}" password: "${BROKER_PASSWORD:admin}" diff --git a/dbrepo-metadata-service/rest-service/src/test/java/at/tuwien/endpoints/ContainerEndpointUnitTest.java b/dbrepo-metadata-service/rest-service/src/test/java/at/tuwien/endpoints/ContainerEndpointUnitTest.java index ab3f4485b2cf35134c2d0ee126ee30af04636165..98ece39e1e78b5a2c2719974daf0a9443cd9c2ac 100644 --- a/dbrepo-metadata-service/rest-service/src/test/java/at/tuwien/endpoints/ContainerEndpointUnitTest.java +++ b/dbrepo-metadata-service/rest-service/src/test/java/at/tuwien/endpoints/ContainerEndpointUnitTest.java @@ -1,8 +1,8 @@ package at.tuwien.endpoints; +import at.tuwien.api.container.CreateContainerDto; import at.tuwien.test.AbstractUnitTest; import at.tuwien.api.container.ContainerBriefDto; -import at.tuwien.api.container.ContainerCreateDto; import at.tuwien.api.container.ContainerDto; import at.tuwien.entities.container.Container; import at.tuwien.exception.*; @@ -122,7 +122,7 @@ public class ContainerEndpointUnitTest extends AbstractUnitTest { @Test @WithAnonymousUser public void create_anonymous_fails() { - final ContainerCreateDto request = ContainerCreateDto.builder() + final CreateContainerDto request = CreateContainerDto.builder() .name(CONTAINER_1_NAME) .imageId(IMAGE_1_ID) .build(); @@ -136,7 +136,7 @@ public class ContainerEndpointUnitTest extends AbstractUnitTest { @Test @WithMockUser(username = USER_1_USERNAME, authorities = {"create-container"}) public void create_hasRole_succeeds() throws ContainerAlreadyExistsException, ImageNotFoundException { - final ContainerCreateDto request = ContainerCreateDto.builder() + final CreateContainerDto request = CreateContainerDto.builder() .name(CONTAINER_1_NAME) .imageId(IMAGE_1_ID) .build(); @@ -148,7 +148,7 @@ public class ContainerEndpointUnitTest extends AbstractUnitTest { @Test @WithMockUser(username = USER_4_USERNAME) public void create_noRole_fails() { - final ContainerCreateDto request = ContainerCreateDto.builder() + final CreateContainerDto request = CreateContainerDto.builder() .name(CONTAINER_1_NAME) .imageId(IMAGE_1_ID) .build(); @@ -221,7 +221,7 @@ public class ContainerEndpointUnitTest extends AbstractUnitTest { assertEquals(CONTAINER_2_INTERNALNAME, container2.getInternalName()); } - public void create_generic(ContainerCreateDto data) throws ContainerAlreadyExistsException, ImageNotFoundException { + public void create_generic(CreateContainerDto data) throws ContainerAlreadyExistsException, ImageNotFoundException { /* mock */ when(containerService.create(data)) diff --git a/dbrepo-metadata-service/rest-service/src/test/java/at/tuwien/mvc/PrometheusEndpointMvcTest.java b/dbrepo-metadata-service/rest-service/src/test/java/at/tuwien/mvc/PrometheusEndpointMvcTest.java index 5ae4aad0187cc52749416bdb3208d3ff678d5285..dc41121b90133b3c759ad556a71c081d0ed9aeae 100644 --- a/dbrepo-metadata-service/rest-service/src/test/java/at/tuwien/mvc/PrometheusEndpointMvcTest.java +++ b/dbrepo-metadata-service/rest-service/src/test/java/at/tuwien/mvc/PrometheusEndpointMvcTest.java @@ -1,11 +1,8 @@ package at.tuwien.mvc; import at.tuwien.api.auth.RefreshTokenRequestDto; -import at.tuwien.api.database.table.TableStatisticDto; -import at.tuwien.api.database.table.columns.ColumnStatisticDto; -import at.tuwien.api.semantics.TableColumnEntityDto; +import at.tuwien.api.container.CreateContainerDto; import at.tuwien.test.AbstractUnitTest; -import at.tuwien.api.container.ContainerCreateDto; import at.tuwien.api.database.*; import at.tuwien.api.database.table.columns.concepts.ColumnSemanticsUpdateDto; import at.tuwien.config.MetricsConfig; @@ -173,7 +170,7 @@ public class PrometheusEndpointMvcTest extends AbstractUnitTest { /* ignore */ } try { - containerEndpoint.create(ContainerCreateDto.builder().name(CONTAINER_1_NAME).imageId(IMAGE_1_ID).build()); + containerEndpoint.create(CreateContainerDto.builder().name(CONTAINER_1_NAME).imageId(IMAGE_1_ID).build()); } catch (Exception e) { /* ignore */ } diff --git a/dbrepo-metadata-service/rest-service/src/test/java/at/tuwien/service/ContainerServiceUnitTest.java b/dbrepo-metadata-service/rest-service/src/test/java/at/tuwien/service/ContainerServiceUnitTest.java index a4f067689355776977c648bfedb0a218941a1cbb..bb19a404ddf23f29e257808974c0ebd787e3c416 100644 --- a/dbrepo-metadata-service/rest-service/src/test/java/at/tuwien/service/ContainerServiceUnitTest.java +++ b/dbrepo-metadata-service/rest-service/src/test/java/at/tuwien/service/ContainerServiceUnitTest.java @@ -1,7 +1,7 @@ package at.tuwien.service; +import at.tuwien.api.container.CreateContainerDto; import at.tuwien.test.AbstractUnitTest; -import at.tuwien.api.container.ContainerCreateDto; import at.tuwien.entities.container.Container; import at.tuwien.exception.*; import at.tuwien.repository.ContainerRepository; @@ -48,7 +48,7 @@ public class ContainerServiceUnitTest extends AbstractUnitTest { @Test public void create_succeeds() throws ContainerAlreadyExistsException, ImageNotFoundException { - final ContainerCreateDto request = ContainerCreateDto.builder() + final CreateContainerDto request = CreateContainerDto.builder() .imageId(IMAGE_1_ID) .name(CONTAINER_1_NAME) .build(); @@ -68,7 +68,7 @@ public class ContainerServiceUnitTest extends AbstractUnitTest { @Test public void create_containerExists_fails() { - final ContainerCreateDto request = ContainerCreateDto.builder() + final CreateContainerDto request = CreateContainerDto.builder() .imageId(IMAGE_1_ID) .name(CONTAINER_1_NAME) .build(); @@ -85,7 +85,7 @@ public class ContainerServiceUnitTest extends AbstractUnitTest { @Test public void create_imageNotFound_fails() { - final ContainerCreateDto request = ContainerCreateDto.builder() + final CreateContainerDto request = CreateContainerDto.builder() .name(CONTAINER_3_NAME) .imageId(9999L) .build(); diff --git a/dbrepo-metadata-service/services/src/main/java/at/tuwien/gateway/impl/DataServiceGatewayImpl.java b/dbrepo-metadata-service/services/src/main/java/at/tuwien/gateway/impl/DataServiceGatewayImpl.java index 2b0cd72dda4c3896ae104e477d3f825dab0cb995..191f42fea30fa711cb67b8b62284302a074c25dc 100644 --- a/dbrepo-metadata-service/services/src/main/java/at/tuwien/gateway/impl/DataServiceGatewayImpl.java +++ b/dbrepo-metadata-service/services/src/main/java/at/tuwien/gateway/impl/DataServiceGatewayImpl.java @@ -48,7 +48,7 @@ public class DataServiceGatewayImpl implements DataServiceGateway { log.trace("create access at endpoint {} with path {}", gatewayConfig.getDataEndpoint(), path); try { response = restTemplate.exchange(path, HttpMethod.POST, - new HttpEntity<>(UpdateDatabaseAccessDto.builder().type(access).build()), Void.class); + new HttpEntity<>(CreateAccessDto.builder().type(access).build()), Void.class); } catch (HttpServerErrorException e) { log.error("Failed to create access: {}", e.getMessage()); throw new DataServiceConnectionException("Failed to create access: " + e.getMessage(), e); @@ -73,7 +73,7 @@ public class DataServiceGatewayImpl implements DataServiceGateway { log.trace("update access at endpoint {} with path {}", gatewayConfig.getDataEndpoint(), path); try { response = restTemplate.exchange(path, HttpMethod.PUT, - new HttpEntity<>(UpdateDatabaseAccessDto.builder().type(access).build()), Void.class); + new HttpEntity<>(CreateAccessDto.builder().type(access).build()), Void.class); } catch (HttpServerErrorException e) { log.error("Failed to update access: {}", e.getMessage()); throw new DataServiceConnectionException("Failed to update access: " + e.getMessage(), e); diff --git a/dbrepo-metadata-service/services/src/main/java/at/tuwien/service/ContainerService.java b/dbrepo-metadata-service/services/src/main/java/at/tuwien/service/ContainerService.java index aa5a3295c49688f91d47960f2e254f5a5721604f..9aa2dc6c89839999c255595d65deb7399e702feb 100644 --- a/dbrepo-metadata-service/services/src/main/java/at/tuwien/service/ContainerService.java +++ b/dbrepo-metadata-service/services/src/main/java/at/tuwien/service/ContainerService.java @@ -1,11 +1,9 @@ package at.tuwien.service; -import at.tuwien.api.container.ContainerCreateDto; +import at.tuwien.api.container.CreateContainerDto; import at.tuwien.entities.container.Container; -import at.tuwien.entities.user.User; import at.tuwien.exception.*; -import java.security.Principal; import java.util.List; public interface ContainerService { @@ -18,7 +16,7 @@ public interface ContainerService { * @throws ImageNotFoundException The image of the container was not found in the metadata database. * @throws ContainerAlreadyExistsException A container with this name already exists. */ - Container create(ContainerCreateDto createDto) throws ImageNotFoundException, + Container create(CreateContainerDto createDto) throws ImageNotFoundException, ContainerAlreadyExistsException; /** diff --git a/dbrepo-metadata-service/services/src/main/java/at/tuwien/service/impl/ContainerServiceImpl.java b/dbrepo-metadata-service/services/src/main/java/at/tuwien/service/impl/ContainerServiceImpl.java index 91db7736db7d9a4a4e931c744a938e78d72308c9..2a3c3215367605b943a3a2701c47b139c20c1b5d 100644 --- a/dbrepo-metadata-service/services/src/main/java/at/tuwien/service/impl/ContainerServiceImpl.java +++ b/dbrepo-metadata-service/services/src/main/java/at/tuwien/service/impl/ContainerServiceImpl.java @@ -1,6 +1,6 @@ package at.tuwien.service.impl; -import at.tuwien.api.container.ContainerCreateDto; +import at.tuwien.api.container.CreateContainerDto; import at.tuwien.entities.container.Container; import at.tuwien.entities.container.image.ContainerImage; import at.tuwien.exception.ContainerAlreadyExistsException; @@ -38,7 +38,7 @@ public class ContainerServiceImpl implements ContainerService { @Override @Transactional - public Container create(ContainerCreateDto data) throws ImageNotFoundException, + public Container create(CreateContainerDto data) throws ImageNotFoundException, ContainerAlreadyExistsException { final String containerName = "dbrepo-userdb-" + metadataMapper.nameToInternalName(data.getName()); /* check */ diff --git a/dbrepo-metadata-service/test/src/main/java/at/tuwien/test/BaseTest.java b/dbrepo-metadata-service/test/src/main/java/at/tuwien/test/BaseTest.java index 12dbd35efce4c2dfbbec8edb933be4c1eba59c07..bab95a366bee9597b5c4b7f6b671ae282a1fc4db 100644 --- a/dbrepo-metadata-service/test/src/main/java/at/tuwien/test/BaseTest.java +++ b/dbrepo-metadata-service/test/src/main/java/at/tuwien/test/BaseTest.java @@ -262,15 +262,15 @@ public abstract class BaseTest { public final static String ROLE_DEFAULT_RESEARCHER_ROLES_NAME = "default-researcher-roles"; public final static UUID ROLE_DEFAULT_RESEARCHER_ROLES_REALM_ID = REALM_DBREPO_ID; - public final static UpdateDatabaseAccessDto UPDATE_DATABASE_ACCESS_READ_DTO = UpdateDatabaseAccessDto.builder() + public final static CreateAccessDto UPDATE_DATABASE_ACCESS_READ_DTO = CreateAccessDto.builder() .type(AccessTypeDto.READ) .build(); - public final static UpdateDatabaseAccessDto UPDATE_DATABASE_ACCESS_WRITE_OWN_DTO = UpdateDatabaseAccessDto.builder() + public final static CreateAccessDto UPDATE_DATABASE_ACCESS_WRITE_OWN_DTO = CreateAccessDto.builder() .type(AccessTypeDto.WRITE_OWN) .build(); - public final static UpdateDatabaseAccessDto UPDATE_DATABASE_ACCESS_WRITE_ALL_DTO = UpdateDatabaseAccessDto.builder() + public final static CreateAccessDto UPDATE_DATABASE_ACCESS_WRITE_ALL_DTO = CreateAccessDto.builder() .type(AccessTypeDto.WRITE_ALL) .build(); @@ -3373,6 +3373,31 @@ public abstract class BaseTest { .sets(null) .build()); + public final static List<ColumnBriefDto> TABLE_2_COLUMNS_BRIEF_DTO = List.of(ColumnBriefDto.builder() + .id(COLUMN_2_1_ID) + .tableId(TABLE_2_ID) + .databaseId(DATABASE_1_ID) + .name("location") + .internalName("location") + .columnType(ColumnTypeDto.VARCHAR) + .build(), + ColumnBriefDto.builder() + .id(COLUMN_2_2_ID) + .tableId(TABLE_2_ID) + .databaseId(DATABASE_1_ID) + .name("lat") + .internalName("lat") + .columnType(ColumnTypeDto.DOUBLE) + .build(), + ColumnBriefDto.builder() + .id(COLUMN_2_3_ID) + .tableId(TABLE_2_ID) + .databaseId(DATABASE_1_ID) + .name("lng") + .internalName("lng") + .columnType(ColumnTypeDto.DOUBLE) + .build()); + public final static Long COLUMN_3_1_ID = 9L; public final static Long COLUMN_3_2_ID = 10L; @@ -8104,7 +8129,7 @@ public abstract class BaseTest { .id(1L) .table(TABLE_2_BRIEF_DTO) .name("uk_1") - .columns(new LinkedList<>(List.of(TABLE_2_COLUMNS_DTO.get(1)))) + .columns(new LinkedList<>(List.of(TABLE_2_COLUMNS_BRIEF_DTO.get(1)))) .build()))) .primaryKey(new LinkedHashSet<>(Set.of(PrimaryKeyDto.builder() .table(TABLE_2_BRIEF_DTO) diff --git a/dbrepo-ui/components/identifier/Citation.vue b/dbrepo-ui/components/identifier/Citation.vue index 5722351f0ab1d3697783f3f0f82c54c5452981d4..9ee434c943da8c011e0bfece1c88c06b525845a9 100644 --- a/dbrepo-ui/components/identifier/Citation.vue +++ b/dbrepo-ui/components/identifier/Citation.vue @@ -4,7 +4,7 @@ <v-col v-if="!loading" md="10"> - <pre>{{ citation }}</pre> + {{ citation }} </v-col> <v-col v-if="!$vuetify.display.mdAndDown" diff --git a/dbrepo-ui/composables/identifier-service.ts b/dbrepo-ui/composables/identifier-service.ts index 3853d9df751aef86b62e2cb30394cf0be1896efb..3ae194ff2fcaf85110e61eb710f7981ffc74e67a 100644 --- a/dbrepo-ui/composables/identifier-service.ts +++ b/dbrepo-ui/composables/identifier-service.ts @@ -103,7 +103,7 @@ export const useIdentifierService = (): any => { }) } - function identifierToCreators(identifier: IdentifierDto) { + function identifierToCreators(identifier: IdentifierDto): string | null { if (!identifier) { return null } diff --git a/dbrepo-ui/nuxt.config.ts b/dbrepo-ui/nuxt.config.ts index 4bce6ec5c5b3dc7f025734d9bf15d8e914123f79..70084f3ccae68656ef23158b5a2ec29379d7e449 100644 --- a/dbrepo-ui/nuxt.config.ts +++ b/dbrepo-ui/nuxt.config.ts @@ -3,19 +3,19 @@ import vuetify from 'vite-plugin-vuetify' const proxy: any = {} -/* proxies the backend calls, >>NOT<< the frontend calls (clicking) */ -if (process.env.NODE_ENV === 'development') { - const api = 'http://localhost' - proxy['/api'] = api - proxy['/pid'] = { - target: api + '/api', - changeOrigin: true, - pathRewrite: { - '^/pid': '/pid' - } - } - process.env.NUXT_PUBLIC_API_SERVER = api -} +// /* proxies the backend calls, >>NOT<< the frontend calls (clicking) */ +// if (process.env.NODE_ENV === 'development') { +// const api = 'http://localhost' +// proxy['/api'] = api +// proxy['/pid'] = { +// target: api + '/api', +// changeOrigin: true, +// pathRewrite: { +// '^/pid': '/pid' +// } +// } +// process.env.NUXT_PUBLIC_API_SERVER = api +// } /** * https://nuxt.com/docs/guide/concepts/rendering#hybrid-rendering @@ -75,8 +75,8 @@ export default defineNuxtConfig({ } }, api: { - client: 'http://localhost', - server: 'http://gateway-service', + client: 'https://dbrepo1.ec.tuwien.ac.at', + server: 'https://dbrepo1.ec.tuwien.ac.at', }, upload: { client: 'http://localhost/api/upload/files', diff --git a/dbrepo-ui/pages/database/[database_id]/table/[table_id]/data.vue b/dbrepo-ui/pages/database/[database_id]/table/[table_id]/data.vue index 2e76d4ebd4a62d0744813740d7c4b55e950d54ca..2eea6a69bf58411451d4a33d06bb62282b8dd872 100644 --- a/dbrepo-ui/pages/database/[database_id]/table/[table_id]/data.vue +++ b/dbrepo-ui/pages/database/[database_id]/table/[table_id]/data.vue @@ -127,6 +127,7 @@ export default { data () { return { loading: true, + error: true, loadingData: false, loadingCount: false, loadingDelete: false, diff --git a/lib/python/dbrepo/RestClient.py b/lib/python/dbrepo/RestClient.py index bc6940b7d034bcb85fec9f9c31c3b5a8aff0dcc3..1f9f778a84460f018f8463153f14fb13533bb8a7 100644 --- a/lib/python/dbrepo/RestClient.py +++ b/lib/python/dbrepo/RestClient.py @@ -1091,7 +1091,7 @@ class RestClient: :raises ResponseCodeError: If something went wrong with the insert. """ url = f'/api/database/{database_id}/table/{table_id}/data' - response = self._wrapper(method="post", url=url, force_auth=True, payload=CreateData(data=data)) + response = self._wrapper(method="post", url=url, force_auth=True, payload=Tuple(data=data)) if response.status_code == 201: return if response.status_code == 400: @@ -1279,7 +1279,7 @@ class RestClient: :raises ResponseCodeError: If something went wrong with the update. """ url = f'/api/database/{database_id}/table/{table_id}/data' - response = self._wrapper(method="put", url=url, force_auth=True, payload=UpdateData(data=data, keys=keys)) + response = self._wrapper(method="put", url=url, force_auth=True, payload=TupleUpdate(data=data, keys=keys)) if response.status_code == 202: return if response.status_code == 400: @@ -1309,7 +1309,7 @@ class RestClient: :raises ResponseCodeError: If something went wrong with the deletion. """ url = f'/api/database/{database_id}/table/{table_id}/data' - response = self._wrapper(method="delete", url=url, force_auth=True, payload=DeleteData(keys=keys)) + response = self._wrapper(method="delete", url=url, force_auth=True, payload=TupleDelete(keys=keys)) if response.status_code == 202: return if response.status_code == 400: diff --git a/lib/python/dbrepo/api/dto.py b/lib/python/dbrepo/api/dto.py index a8518ec79e923231552d827c68c8ab6e0b75a3b1..76f6d37a3a1ff2368beef7391769655229c9f16d 100644 --- a/lib/python/dbrepo/api/dto.py +++ b/lib/python/dbrepo/api/dto.py @@ -463,16 +463,16 @@ class License(BaseModel): description: str -class CreateData(BaseModel): +class Tuple(BaseModel): data: dict -class UpdateData(BaseModel): +class TupleUpdate(BaseModel): data: dict keys: dict -class DeleteData(BaseModel): +class TupleDelete(BaseModel): keys: dict @@ -528,7 +528,26 @@ class CreateTableConstraints(BaseModel): foreign_keys: List[CreateForeignKey] = field(default_factory=list) -class IdentifierCreator(BaseModel): +class NameIdentifierSchemeType(str, Enum): + """ + Enumeration of name identifier scheme types. + """ + ORCID = "ORCID" + ROR = "ROR" + ISNI = "ISNI" + GRID = "GRID" + + +class AffiliationIdentifierSchemeType(str, Enum): + """ + Enumeration of affiliation identifier scheme types. + """ + ROR = "ROR" + ISNI = "ISNI" + GRID = "GRID" + + +class Creator(BaseModel): id: int creator_name: str firstname: Optional[str] = None @@ -536,13 +555,24 @@ class IdentifierCreator(BaseModel): affiliation: Optional[str] = None name_type: Optional[str] = None name_identifier: Optional[str] = None - name_identifier_scheme: Optional[str] = None + name_identifier_scheme: Optional[NameIdentifierSchemeType] = None name_identifier_scheme_uri: Optional[str] = None affiliation_identifier: Optional[str] = None affiliation_identifier_scheme: Optional[str] = None affiliation_identifier_scheme_uri: Optional[str] = None +class CreatorBrief(BaseModel): + id: int + creator_name: str + affiliation: Optional[str] = None + name_type: Optional[str] = None + name_identifier: Optional[str] = None + name_identifier_scheme: Optional[NameIdentifierSchemeType] = None + affiliation_identifier: Optional[str] = None + affiliation_identifier_scheme: Optional[str] = None + + class CreateIdentifierCreator(BaseModel): creator_name: str firstname: Optional[str] = None @@ -603,7 +633,7 @@ class Identifier(BaseModel): status: IdentifierStatusType publication_year: int publisher: str - creators: List[IdentifierCreator] + creators: List[Creator] titles: List[IdentifierTitle] descriptions: List[IdentifierDescription] funders: Optional[List[IdentifierFunder]] = field(default_factory=list) @@ -627,7 +657,7 @@ class IdentifierBrief(BaseModel): id: int database_id: int type: IdentifierType - created_by: str + owned_by: str status: IdentifierStatusType publication_year: int publisher: str @@ -872,7 +902,7 @@ class Query(BaseModel): result_hash: str query_normalized: str result_number: Optional[int] = None - identifiers: List[Identifier] = field(default_factory=list) + identifiers: List[IdentifierBrief] = field(default_factory=list) class UpdateQuery(BaseModel): @@ -966,36 +996,17 @@ class Table(BaseModel): avg_row_length: Optional[int] = None -class TableMinimal(BaseModel): - id: int - database_id: int - - -class ColumnMinimal(BaseModel): - id: int - table_id: int - database_id: int - - class DatabaseBrief(BaseModel): id: int name: str - owner: UserBrief contact: UserBrief - exchange_name: str + owner_id: str internal_name: str is_public: bool is_schema_public: bool - container: ContainerBrief identifiers: Optional[List[IdentifierBrief]] = field(default_factory=list) - subsets: Optional[List[IdentifierBrief]] = field(default_factory=list) preview_image: Optional[str] = None description: Optional[str] = None - tables: Optional[List[TableBrief]] = field(default_factory=list) - views: Optional[List[ViewBrief]] = field(default_factory=list) - image: Optional[str] = None - accesses: Optional[List[DatabaseAccess]] = field(default_factory=list) - exchange_name: Optional[str] = None class Database(BaseModel): @@ -1014,22 +1025,21 @@ class Database(BaseModel): description: Optional[str] = None tables: Optional[List[Table]] = field(default_factory=list) views: Optional[List[View]] = field(default_factory=list) - image: Optional[str] = None accesses: Optional[List[DatabaseAccess]] = field(default_factory=list) exchange_name: Optional[str] = None class Unique(BaseModel): id: int - table: TableMinimal - columns: List[ColumnMinimal] + table: TableBrief + columns: List[ColumnBrief] class ForeignKeyReference(BaseModel): id: int - foreign_key: ForeignKeyMinimal - column: ColumnMinimal - referenced_column: ColumnMinimal + foreign_key: ForeignKeyBrief + column: ColumnBrief + referenced_column: ColumnBrief class ReferenceType(str, Enum): @@ -1043,7 +1053,7 @@ class ReferenceType(str, Enum): SET_DEFAULT = "set_default" -class ForeignKeyMinimal(BaseModel): +class ForeignKeyBrief(BaseModel): id: int @@ -1051,8 +1061,8 @@ class ForeignKey(BaseModel): id: int name: str references: List[ForeignKeyReference] - table: TableMinimal - referenced_table: TableMinimal + table: TableBrief + referenced_table: TableBrief on_update: Optional[ReferenceType] = None on_delete: Optional[ReferenceType] = None @@ -1067,8 +1077,8 @@ class CreateForeignKey(BaseModel): class PrimaryKey(BaseModel): id: int - table: TableMinimal - column: ColumnMinimal + table: TableBrief + column: ColumnBrief class Constraints(BaseModel): diff --git a/lib/python/tests/test_dtos.py b/lib/python/tests/test_dtos.py index f338c30dcc3d643a9d9771b763909c608b7742a1..54208a1d9a6baaebd6ecb7df7d505ded83594a3c 100644 --- a/lib/python/tests/test_dtos.py +++ b/lib/python/tests/test_dtos.py @@ -1,44 +1,94 @@ import inspect +import logging import sys import unittest +from logging.config import dictConfig +from math import floor from yaml import safe_load from dbrepo.api import dto +logging.addLevelName(level=logging.NOTSET, levelName='TRACE') +logging.basicConfig(level=logging.DEBUG) + +# logging configuration +dictConfig({ + 'version': 1, + 'formatters': { + 'default': { + 'format': '[%(asctime)s] %(levelname)s in %(module)s: %(message)s', + }, + 'simple': { + 'format': '[%(asctime)s] %(levelname)s: %(message)s', + }, + }, + 'handlers': {'console': { + 'class': 'logging.StreamHandler', + 'stream': 'ext://sys.stdout', + 'formatter': 'simple' # default + }}, + 'root': { + 'level': 'DEBUG', + 'handlers': ['console'] + } +}) + class AnalyseUnitTest(unittest.TestCase): schemas = None models: [()] = [] found: int = 0 - skipped: int = 0 + skipped: [str] = [] def setUp(self): with open('../../../.docs/.openapi/api.yaml', 'r') as f: self.schemas = safe_load(f)['components']['schemas'] for name, obj in inspect.getmembers(sys.modules[dto.__name__]): + self.found += 1 if not inspect.isclass(obj): - self.found += 1 continue if f'{name}Dto' not in self.schemas: - self.skipped += 1 + logging.debug(f'skip model {name}: OpenAPI schema definition {name}Dto not found') + self.skipped.append(f'{name}Dto') continue self.models.append((name, obj)) def build_model(self, name: str, obj: any, definition: any) -> dict: model_dict = dict() for property in definition['properties']: - if 'example' not in definition['properties'][property]: + if 'example' in definition['properties'][property]: if '$ref' not in definition['properties'][property]: - self.fail(f'OpenAPI model {name}Dto does not have example for property: {property}') + model_dict[property] = definition['properties'][property]['example'] + continue + ref = definition['properties'][property]['$ref'][len('#/components/schemas/'):-3] + # recursive call + model_dict[property] = self.build_model(ref, self.get_model(ref), self.schemas[f'{ref}Dto']) + continue + if 'items' in definition['properties'][property]: + if '$ref' not in definition['properties'][property]['items']: + continue + ref = definition['properties'][property]['items']['$ref'][len('#/components/schemas/'):-3] + # recursive call + model_dict[property] = [self.build_model(ref, self.get_model(ref), self.schemas[f'{ref}Dto'])] + continue + if '$ref' in definition['properties'][property]: ref = definition['properties'][property]['$ref'][len('#/components/schemas/'):-3] # recursive call - model_dict[property] = self.build_model(ref, obj, self.schemas[f'{name}Dto']) - model_dict[property] = definition['properties'][property]['example'] - model = obj(**model_dict) + model_dict[property] = self.build_model(ref, self.get_model(ref), self.schemas[f'{ref}Dto']) + return model_dict - def test_dtos_succeeds(self): + def get_model(self, ref: str): for name, obj in self.models: - self.build_model(name, obj, self.schemas[f'{name}Dto']) + if name == ref: + return obj + return None - pass + def test_dtos_succeeds(self): + logging.info(f'Found {self.found} model(s) in {dto.__name__}') + for name, obj in self.models: + logging.debug(f'building model: {name} against OpenAPI schema definition {name}Dto') + model = obj(**self.build_model(name, obj, self.schemas[f'{name}Dto'])) + logging.warning(f'Unable to find {len(self.skipped)} OpenAPI schema definition(s): {self.skipped}') + logging.info(f'Coverage: {floor((1 - len(self.skipped) / self.found) * 100)}%') + pass