From 9c9c698d16b06a6e90a28d58b6eaf6cb4eb83696 Mon Sep 17 00:00:00 2001 From: Vincent HEMERY Date: Tue, 21 May 2024 10:11:03 +0200 Subject: [PATCH] feat(application): Update REST API for advanced applications. (#168) * feat(application): Update REST API for advanced applications. Relates to [BPM-94](https://bonitasoft.atlassian.net/browse/BPM-94) --- .../schemas/AbstractApplication.yaml | 53 ++++++++++++++++ .../schemas/AdvancedApplication.yaml | 28 +++++++++ openapi/components/schemas/Application.yaml | 60 +------------------ .../components/schemas/LegacyApplication.yaml | 47 +++++++++++++++ openapi/paths/API@living@application.yaml | 42 +++++++++++-- .../paths/API@living@application@{id}.yaml | 2 +- 6 files changed, 170 insertions(+), 62 deletions(-) create mode 100644 openapi/components/schemas/AbstractApplication.yaml create mode 100644 openapi/components/schemas/AdvancedApplication.yaml create mode 100644 openapi/components/schemas/LegacyApplication.yaml diff --git a/openapi/components/schemas/AbstractApplication.yaml b/openapi/components/schemas/AbstractApplication.yaml new file mode 100644 index 0000000..e05d85b --- /dev/null +++ b/openapi/components/schemas/AbstractApplication.yaml @@ -0,0 +1,53 @@ +type: object +properties: + # advanced is in the children schemas to ensure it uses the correct constant value + createdBy: + description: Author user ID + type: string + maxLength: 250 + pattern: '^[A-Za-z0-9\_\-\.]{0,250}$' + creationDate: + description: creation date of the application + type: string + description: + description: description of the application + type: string + displayName: + description: display name of the application + type: string + id: + description: id of the application + type: string + maxLength: 250 + pattern: '^[A-Za-z0-9\_\-\.]{0,250}$' + lastUpdateDate: + description: last update date of the application + type: string + profileId: + description: profile authorized to access this application + type: string + maxLength: 250 + pattern: '^[A-Za-z0-9\_\-\.]{0,250}$' + token: + description: token of the application used to build the application URL + type: string + updatedBy: + description: Last updating user ID + type: string + version: + description: version of the application + type: string + state: + description: application state + type: string + enum: [ ACTIVATED, DEACTIVATED ] + visibility: + description: visibility of the Application. This value is purely indicative, changing it in the application object won't change the accessibility to the actual application. + enum: [ ALL, TECHNICAL_USER, RESTRICTED ] + x-enumDescriptions: + ALL: Everyone can use the application + TECHNICAL_USER: Only the technical user can use the application + RESTRICTED: Access to the application is determined by the user profile + editable: + description: Indicates whether the application can be modified + type: boolean \ No newline at end of file diff --git a/openapi/components/schemas/AdvancedApplication.yaml b/openapi/components/schemas/AdvancedApplication.yaml new file mode 100644 index 0000000..0338ab2 --- /dev/null +++ b/openapi/components/schemas/AdvancedApplication.yaml @@ -0,0 +1,28 @@ +title: Advanced application +description: Contains the meta information of an advanced Bonita Living Application. +allOf: + - type: object + properties: + advanced: + description: true for an advanced application + type: boolean + enum: [ true ] + - $ref: ./AbstractApplication.yaml + - type: object + description: Contains the meta information of an advanced Bonita Living Application. +example: + id: "306" + advanced: true + creationDate: "1411548289900" + icon: "" + createdBy": "1" + profileId: "2" + description: "My advanced application description" + token: "myadvapp" + state: "ACTIVATED" + displayName: "My advanced app" + updatedBy: "1" + visibility: "ALL" + editable: true + lastUpdateDate: "1411548289900" + version: "1.0" diff --git a/openapi/components/schemas/Application.yaml b/openapi/components/schemas/Application.yaml index ffe17f2..90b2a10 100644 --- a/openapi/components/schemas/Application.yaml +++ b/openapi/components/schemas/Application.yaml @@ -1,57 +1,3 @@ -type: object -properties: - createdBy: - description: Author user ID - type: string - maxLength: 250 - pattern: '^[A-Za-z0-9\_\-\.]{0,250}$' - creationDate: - description: creation date of the application - type: string - description: - description: description of the application - type: string - displayName: - description: display name of the application - type: string - homePageId: - description: id of the application page used as the home page - type: string - maxLength: 250 - pattern: '^[A-Za-z0-9\_\-\.]{0,250}$' - id: - description: id of the application - type: string - maxLength: 250 - pattern: '^[A-Za-z0-9\_\-\.]{0,250}$' - lastUpdateDate: - description: last update date of the application - type: string - profileId: - description: profile authorized to access this application - type: string - maxLength: 250 - pattern: '^[A-Za-z0-9\_\-\.]{0,250}$' - token: - description: token of the application used to build the application URL - type: string - updatedBy: - description: Last updating user ID - type: string - version: - description: version of the application - type: string -example: - id: "305" - creationDate: "1411548289900" - iconPath: "" - createdBy": "1" - profileId: "2" - description: "My application description" - token: "myapp" - state: "DEACTIVATED" - displayName: "My app" - updatedBy: "1" - lastUpdateDate: "1411548289900" - version: "1.0" - homePageId: "-1" +oneOf: + - $ref: ./AdvancedApplication.yaml + - $ref: ./LegacyApplication.yaml \ No newline at end of file diff --git a/openapi/components/schemas/LegacyApplication.yaml b/openapi/components/schemas/LegacyApplication.yaml new file mode 100644 index 0000000..7756c6f --- /dev/null +++ b/openapi/components/schemas/LegacyApplication.yaml @@ -0,0 +1,47 @@ +title: Legacy application +description: Contains the meta information of a legacy Bonita Living Application. +allOf: + - type: object + properties: + advanced: + description: false for a legacy application + type: boolean + enum: [ false ] + - $ref: ./AbstractApplication.yaml + - type: object + description: Contains the meta information of a legacy Bonita Living Application. + properties: + homePageId: + description: id of the application page used as the home page + type: string + maxLength: 250 + pattern: '^[A-Za-z0-9\_\-\.]{0,250}$' + layoutId: + description: id of the layout used by the application + type: string + maxLength: 250 + pattern: '^[A-Za-z0-9\_\-\.]{0,250}$' + themeId: + description: id of the theme used by the application + type: string + maxLength: 250 + pattern: '^[A-Za-z0-9\_\-\.]{0,250}$' +example: + id: "305" + advanced: false + creationDate: "1411548289900" + icon: "" + createdBy": "1" + profileId: "2" + description: "My application description" + token: "myapp" + state: "DEACTIVATED" + displayName: "My app" + updatedBy: "1" + visibility: "ALL" + editable: true + lastUpdateDate: "1411548289900" + version: "1.0" + homePageId: "26" + themeId: "1" + layoutId: "3" diff --git a/openapi/paths/API@living@application.yaml b/openapi/paths/API@living@application.yaml index 3fef569..5cdaab6 100644 --- a/openapi/paths/API@living@application.yaml +++ b/openapi/paths/API@living@application.yaml @@ -5,9 +5,9 @@ get: description: | Finds living applications with pagination params and filters - - can order on `id`,`creationDate`, `createdBy`, `profileId`, `token`, `displayName`, `updatedBy`, `lastUpdateDate`, `version` - - can search on `token`, `displayName`, `version` - - can filter on `token`, `displayName`, `version`, `profileId`, `creationDate`, `createdBy`, `updatedBy` , `lastUpdateDate`, `userId` + - can order on `id`,`creationDate`, `createdBy`, `profileId`, `token`, `displayName`, `updatedBy`, `lastUpdateDate`, `version`, `advanced` + - can search on `token`, `displayName`, `version`, `advanced` + - can filter on `token`, `displayName`, `version`, `advanced`, `profileId`, `creationDate`, `createdBy`, `updatedBy` , `lastUpdateDate`, `userId` operationId: searchApplications parameters: @@ -31,6 +31,40 @@ get: type: array items: $ref: '../components/schemas/Application.yaml' + example: + - id: "306" + advanced: true + creationDate: "1411548289900" + icon: "" + createdBy": "1" + profileId: "2" + description: "My advanced application description" + token: "myadvapp" + state: "ACTIVATED" + displayName: "My advanced app" + updatedBy: "1" + visibility: "ALL" + editable: true + lastUpdateDate: "1411548289900" + version: "1.0" + - id: "305" + advanced: false + creationDate: "1411548289900" + icon: "" + createdBy": "1" + profileId: "2" + description: "My application description" + token: "myapp" + state: "DEACTIVATED" + displayName: "My app" + updatedBy: "1" + visibility: "ALL" + editable: true + lastUpdateDate: "1411548289900" + version: "1.0" + homePageId: "26" + themeId: "1" + layoutId: "3" '401': $ref: '../components/responses/Unauthorized.yaml' '403': @@ -61,7 +95,7 @@ post: content: application/json: schema: - $ref: '../components/schemas/Application.yaml' + $ref: '../components/schemas/LegacyApplication.yaml' description: "Success " '401': $ref: '../components/responses/Unauthorized.yaml' diff --git a/openapi/paths/API@living@application@{id}.yaml b/openapi/paths/API@living@application@{id}.yaml index 8ef77af..5407576 100644 --- a/openapi/paths/API@living@application@{id}.yaml +++ b/openapi/paths/API@living@application@{id}.yaml @@ -91,7 +91,7 @@ put: content: application/json: schema: - $ref: '../components/schemas/Application.yaml' + $ref: '../components/schemas/LegacyApplication.yaml' description: "Success " '401': $ref: '../components/responses/Unauthorized.yaml'