diff --git a/boat-maven-plugin/src/it/example/boat-artifact-input/artifact-input/pom.xml b/boat-maven-plugin/src/it/example/boat-artifact-input/artifact-input/pom.xml new file mode 100644 index 000000000..9e4491ffe --- /dev/null +++ b/boat-maven-plugin/src/it/example/boat-artifact-input/artifact-input/pom.xml @@ -0,0 +1,49 @@ + + + 4.0.0 + + + com.backbase.oss.boat.example + boat-artifact-input + 1.0.0-SNAPSHOT + + + artifact-input + pom + + BOAT :: Input artifact + + + + + com.backbase.oss + boat-maven-plugin + + + generate-docs-from-zip + generate-sources + + doc + + + + com.backbase.oss.boat.example + openapi-zips + 1.0.0-SNAPSHOT + api + zip + presentation-client-api/openapi.yaml + + + + + + + + + + + + diff --git a/boat-maven-plugin/src/it/example/boat-artifact-input/openapi-specs/openapi-spec-bom/pom.xml b/boat-maven-plugin/src/it/example/boat-artifact-input/openapi-specs/openapi-spec-bom/pom.xml new file mode 100644 index 000000000..e213c287b --- /dev/null +++ b/boat-maven-plugin/src/it/example/boat-artifact-input/openapi-specs/openapi-spec-bom/pom.xml @@ -0,0 +1,32 @@ + + + 4.0.0 + + com.backbase.oss.boat.example + openapi-spec-bom + 1.0.0-SNAPSHOT + + + 1.0.0-SNAPSHOT + + + pom + + BOAT :: OpenAPI Bill-Of-Materials + + + + + com.backbase.oss.boat.example + openapi-zips + ${openapi-spec.version} + + + + + + + + diff --git a/boat-maven-plugin/src/it/example/boat-artifact-input/openapi-specs/openapi-zips/pom.xml b/boat-maven-plugin/src/it/example/boat-artifact-input/openapi-specs/openapi-zips/pom.xml new file mode 100644 index 000000000..8a0113446 --- /dev/null +++ b/boat-maven-plugin/src/it/example/boat-artifact-input/openapi-specs/openapi-zips/pom.xml @@ -0,0 +1,40 @@ + + + 4.0.0 + + com.backbase.oss.boat.example + + + openapi-zips + 1.0.0-SNAPSHOT + + + BOAT :: OpenAPI Example + + + + + maven-assembly-plugin + 3.1.0 + + + create-archive + package + + single + + + + src/assembly/build.xml + + + + + + + + + + diff --git a/boat-maven-plugin/src/it/example/boat-artifact-input/openapi-specs/openapi-zips/src/assembly/build.xml b/boat-maven-plugin/src/it/example/boat-artifact-input/openapi-specs/openapi-zips/src/assembly/build.xml new file mode 100644 index 000000000..8a0b62203 --- /dev/null +++ b/boat-maven-plugin/src/it/example/boat-artifact-input/openapi-specs/openapi-zips/src/assembly/build.xml @@ -0,0 +1,18 @@ + + api + + zip + + false + + + src/main/resources/ + ${artifactId} + + **/** + + + + \ No newline at end of file diff --git a/boat-maven-plugin/src/it/example/boat-artifact-input/openapi-specs/openapi-zips/src/main/resources/presentation-client-api/index.html b/boat-maven-plugin/src/it/example/boat-artifact-input/openapi-specs/openapi-zips/src/main/resources/presentation-client-api/index.html new file mode 100644 index 000000000..80aa61995 --- /dev/null +++ b/boat-maven-plugin/src/it/example/boat-artifact-input/openapi-specs/openapi-zips/src/main/resources/presentation-client-api/index.html @@ -0,0 +1,24 @@ + + + + Wallet Test Client API + + + + + + + + + + + + + \ No newline at end of file diff --git a/boat-maven-plugin/src/it/example/boat-artifact-input/openapi-specs/openapi-zips/src/main/resources/presentation-client-api/openapi.yaml b/boat-maven-plugin/src/it/example/boat-artifact-input/openapi-specs/openapi-zips/src/main/resources/presentation-client-api/openapi.yaml new file mode 100644 index 000000000..eed41ab6d --- /dev/null +++ b/boat-maven-plugin/src/it/example/boat-artifact-input/openapi-specs/openapi-zips/src/main/resources/presentation-client-api/openapi.yaml @@ -0,0 +1,1223 @@ +openapi: 3.0.3 +info: + title: Wallet Test Client API + description: No description available + version: 2.19.0 +servers: +- url: /artifact-service/ + description: The server +tags: +- name: wallet test client api +paths: + /client-api/v1/wallet/paymentcards: + summary: Payment Cards + description: No description available + get: + tags: + - wallet + summary: "Returns available payment card details for user, optionally filtered\ + \ by nameOnCard." + description: "Returns available payment card details for user, optionally filtered\ + \ by nameOnCard" + operationId: getPaymentCards + parameters: + - name: nameOnCard + in: query + description: "Filter by the cardholder's name (case-insensitive), can be the\ + \ first one or more characters of one of the words/names" + required: false + schema: + type: string + examples: + example: + summary: example + value: Smi + - name: dateTimeOnly + in: query + description: Creation date in datetime-only format + required: false + schema: + type: string + format: date-time + examples: + example: + summary: example + value: 2017-10-04T14:54:36 + - name: dateTime + in: query + description: Creation date in Zoned RFC3339 Date-time format + required: false + schema: + type: string + format: date-time + examples: + example: + summary: example + value: 2017-10-04T14:54:36Z + - name: dateTime2616 + in: query + description: Zoned RFC2616 Date-time param example + required: false + schema: + type: string + format: date-time + examples: + example: + summary: example + value: "Wed, 4 Jul 2001 12:08:56 PDT" + - name: date + in: query + description: Date-only param example + required: false + schema: + type: string + format: date + examples: + example: + summary: example + value: 2017-10-04 + - name: time + in: query + description: time-only param example + required: false + schema: + type: string + format: date-time + examples: + example: + summary: example + value: 14:54:36 + - name: orderBy + in: query + description: "Order by field: nameOnCard\n" + required: false + schema: + type: string + examples: + example: + summary: example + - name: direction + in: query + description: Direction + required: false + schema: + type: string + default: DESC + enum: + - ASC + - DESC + examples: + example: + summary: example + responses: + "200": + description: No description available + content: + application/json: + schema: + $ref: '#/components/schemas/PaymentCards' + examples: + example: + value: "[ {\n \"id\" : \"a5b0fe7d-c4dd-40a7-bd80-dfc7869327e1\"\ + ,\n \"pan\" : \"5434111122223333\",\n \"cvc\" : \"123\",\n \ + \ \"startDate\" : \"0116\",\n \"expiryDate\" : \"1219\",\n \"\ + nameOnCard\" : \"Mr Timmy Tester\",\n \"creationDate\" : \"2011-05-30T12:13:14+03:00\"\ + ,\n \"balance\" : {\n \"amount\" : \"2001\",\n \"currencyCode\"\ + \ : \"EUR\"\n },\n \"apr\" : 12.75\n}, {\n \"id\" : \"d593c212-70ad-41a6-a547-d5d9232414cb\"\ + ,\n \"pan\" : \"5434111122224444\",\n \"cvc\" : \"101\",\n \ + \ \"startDate\" : \"0216\",\n \"expiryDate\" : \"0120\",\n \"\ + nameOnCard\" : \"Mr Timmothy Tester\",\n \"creationDate\" : \"\ + 2011-05-30T12:13:14+03:00\",\n \"balance\" : {\n \"amount\"\ + \ : \"4.4399999999999995\",\n \"currencyCode\" : \"GBP\"\n\ + \ },\n \"apr\" : 12.75\n}, {\n \"id\" : \"9635966b-28e9-4479-8121-bb7bc9beeb62\"\ + ,\n \"pan\" : \"5434121212121212\",\n \"cvc\" : \"121\",\n \ + \ \"startDate\" : \"0115\",\n \"expiryDate\" : \"1218\",\n \"\ + nameOnCard\" : \"Mr Timmy Tester\",\n \"creationDate\" : \"2011-05-30T12:13:14+03:00\"\ + ,\n \"balance\" : {\n \"amount\" : \"1981\",\n \"currencyCode\"\ + \ : \"EUR\"\n },\n \"apr\" : 12.75\n} ]" + "400": + description: BadRequest + content: + application/json: + schema: + $ref: '#/components/schemas/BadRequestError' + examples: + example: + value: "{\n \"message\" : \"Bad Request\",\n \"errors\" : [ {\n\ + \ \"message\" : \"Value Exceeded. Must be between {min} and\ + \ {max}.\",\n \"key\" : \"common.api.shoesize\",\n \"context\"\ + \ : {\n \"max\" : \"50\",\n \"min\" : \"1\"\n }\n\ + \ } ]\n}" + "406": + description: NotAcceptable + content: + application/json: + schema: + $ref: '#/components/schemas/NotAcceptableError' + examples: + example: + value: "{\n \"message\" : \"Could not find acceptable representation\"\ + ,\n \"supportedMediaTypes\" : [ \"application/json\" ]\n}" + "500": + description: InternalServerError + content: + application/json: + schema: + $ref: '#/components/schemas/InternalServerError' + examples: + example: + value: "{\n \"message\" : \"Description of error\"\n}" + "403": + description: Forbidden + content: + application/json: + schema: + $ref: '#/components/schemas/ForbiddenError' + examples: + example: + value: "{\n \"message\" : \"Access to requested resource denied.\"\ + ,\n \"errors\" : [ {\n \"message\" : \"Resource access denied\ + \ due to an insufficient user quota of {quota}.\",\n \"key\"\ + \ : \"common.api.quota\",\n \"context\" : {\n \"quota\"\ + \ : \"someQuota\"\n }\n } ]\n}" + "415": + description: UnsupportedMediaType + content: + application/json: + schema: + $ref: '#/components/schemas/UnsupportedMediaTypeError' + examples: + example: + value: "{\n \"message\" : \"Unsupported media type.\",\n \"errors\"\ + \ : [ {\n \"message\" : \"The request entity has a media type\ + \ {mediaType} which the resource does not support.\",\n \"\ + key\" : \"common.api.mediaType\",\n \"context\" : {\n \ + \ \"mediaType\" : \"application/javascript\"\n }\n } ]\n}" + "404": + description: NotFound + content: + application/json: + schema: + $ref: '#/components/schemas/NotFoundError' + examples: + example: + value: "{\n \"message\" : \"Resource not found.\",\n \"errors\"\ + \ : [ {\n \"message\" : \"Unable to find the resource requested\ + \ resource: {resource}.\",\n \"key\" : \"common.api.resource\"\ + ,\n \"context\" : {\n \"resource\" : \"aResource\"\n \ + \ }\n } ]\n}" + "401": + description: Unauthorized + content: + application/json: + schema: + $ref: '#/components/schemas/UnauthorizedAltError' + examples: + example: + value: "{\n \"message\" : \"Access to requested resource denied.\"\ + ,\n \"errors\" : [ {\n \"message\" : \"Resource access denied\ + \ due to invalid credentials.\",\n \"key\" : \"common.api.token\"\ + ,\n \"context\" : {\n \"accessToken\" : \"expired\"\n\ + \ }\n } ]\n}" + x-bb-access-control-resource: WALLET + x-bb-access-control-function: MANAGE_PAYMENT_CARDS + x-bb-access-control-privilege: READ_PAYMENT_CARD + post: + tags: + - wallet + summary: Adds a payment card to the user's wallet. + description: Adds a payment card to the user's wallet + operationId: postPaymentCards + parameters: + - name: X-Request-Id + in: header + description: Correlates HTTP requests between a client and server. + required: false + schema: + type: string + examples: + example: + summary: example + value: f058ebd6-02f7-4d3f-942e-904344e8cde5 + requestBody: + description: Adds a payment card to the user's wallet + content: + application/json: + schema: + $ref: '#/components/schemas/PaymentCard' + examples: + example: + value: "{\n \"id\" : \"a5b0fe7d-c4dd-40a7-bd80-dfc7869327e1\",\n\ + \ \"pan\" : \"5434111122223333\",\n \"cvc\" : \"123\",\n \"startDate\"\ + \ : \"0116\",\n \"expiryDate\" : \"1219\",\n \"nameOnCard\" :\ + \ \"Mr Timmy Tester\",\n \"creationDate\" : \"2011-05-30T12:13:14+03:00\"\ + ,\n \"balance\" : {\n \"amount\" : \"1000\",\n \"currencyCode\"\ + \ : \"EUR\"\n },\n \"apr\" : 12.75\n}" + responses: + "201": + description: request to create payment card accepted + content: + application/json: + schema: + $ref: '#/components/schemas/PaymentCardsPostResponseBody' + examples: + example: + value: "{\n \"id\" : \"a5b0fe7d-c4dd-40a7-bd80-dfc7869327e1\"\n\ + }" + "400": + description: BadRequest + content: + application/json: + schema: + $ref: '#/components/schemas/BadRequestError' + examples: + example: + value: "{\n \"message\" : \"Bad Request\",\n \"errors\" : [ {\n\ + \ \"message\" : \"Value Exceeded. Must be between {min} and\ + \ {max}.\",\n \"key\" : \"common.api.shoesize\",\n \"context\"\ + \ : {\n \"max\" : \"50\",\n \"min\" : \"1\"\n }\n\ + \ } ]\n}" + "500": + description: InternalServerError + content: + application/json: + schema: + $ref: '#/components/schemas/InternalServerError' + examples: + example: + value: "{\n \"message\" : \"Description of error\"\n}" + "403": + description: Forbidden + content: + application/json: + schema: + $ref: '#/components/schemas/ForbiddenError' + examples: + example: + value: "{\n \"message\" : \"Access to requested resource denied.\"\ + ,\n \"errors\" : [ {\n \"message\" : \"Resource access denied\ + \ due to an insufficient user quota of {quota}.\",\n \"key\"\ + \ : \"common.api.quota\",\n \"context\" : {\n \"quota\"\ + \ : \"someQuota\"\n }\n } ]\n}" + "415": + description: UnsupportedMediaType + content: + application/json: + schema: + $ref: '#/components/schemas/UnsupportedMediaTypeError' + examples: + example: + value: "{\n \"message\" : \"Unsupported media type.\",\n \"errors\"\ + \ : [ {\n \"message\" : \"The request entity has a media type\ + \ {mediaType} which the resource does not support.\",\n \"\ + key\" : \"common.api.mediaType\",\n \"context\" : {\n \ + \ \"mediaType\" : \"application/javascript\"\n }\n } ]\n}" + "404": + description: NotFound + content: + application/json: + schema: + $ref: '#/components/schemas/NotFoundError' + examples: + example: + value: "{\n \"message\" : \"Resource not found.\",\n \"errors\"\ + \ : [ {\n \"message\" : \"Unable to find the resource requested\ + \ resource: {resource}.\",\n \"key\" : \"common.api.resource\"\ + ,\n \"context\" : {\n \"resource\" : \"aResource\"\n \ + \ }\n } ]\n}" + "401": + description: Unauthorized + content: + application/json: + schema: + $ref: '#/components/schemas/UnauthorizedAltError' + examples: + example: + value: "{\n \"message\" : \"Access to requested resource denied.\"\ + ,\n \"errors\" : [ {\n \"message\" : \"Resource access denied\ + \ due to invalid credentials.\",\n \"key\" : \"common.api.token\"\ + ,\n \"context\" : {\n \"accessToken\" : \"expired\"\n\ + \ }\n } ]\n}" + x-bb-access-control-resource: WALLET + x-bb-access-control-function: MANAGE_PAYMENT_CARDS + x-bb-access-control-privilege: WRITE_PAYMENT_CARD + /client-api/v1/wallet/paymentcards/{cardId}: + summary: Payment Card + description: No description available + get: + tags: + - wallet + summary: Returns details of a specific payment card. + description: Returns details of a specific payment card + operationId: getPaymentCard + responses: + "200": + description: No description available + content: + application/json: + schema: + $ref: '#/components/schemas/PaymentCard' + examples: + example: + value: "{\n \"id\" : \"a5b0fe7d-c4dd-40a7-bd80-dfc7869327e1\",\n\ + \ \"pan\" : \"5434111122223333\",\n \"cvc\" : \"123\",\n \"\ + startDate\" : \"0116\",\n \"expiryDate\" : \"1219\",\n \"nameOnCard\"\ + \ : \"Mr Timmy Tester\",\n \"creationDate\" : \"2011-05-30T12:13:14+03:00\"\ + ,\n \"balance\" : {\n \"amount\" : \"1000\",\n \"currencyCode\"\ + \ : \"EUR\"\n },\n \"apr\" : 12.75\n}" + "400": + description: BadRequest + content: + application/json: + schema: + $ref: '#/components/schemas/BadRequestError' + examples: + example: + value: "{\n \"message\" : \"Bad Request\",\n \"errors\" : [ {\n\ + \ \"message\" : \"Value Exceeded. Must be between {min} and\ + \ {max}.\",\n \"key\" : \"common.api.shoesize\",\n \"context\"\ + \ : {\n \"max\" : \"50\",\n \"min\" : \"1\"\n }\n\ + \ } ]\n}" + "500": + description: InternalServerError + content: + application/json: + schema: + $ref: '#/components/schemas/InternalServerError' + examples: + example: + value: "{\n \"message\" : \"Description of error\"\n}" + "403": + description: Forbidden + content: + application/json: + schema: + $ref: '#/components/schemas/ForbiddenError' + examples: + example: + value: "{\n \"message\" : \"Access to requested resource denied.\"\ + ,\n \"errors\" : [ {\n \"message\" : \"Resource access denied\ + \ due to an insufficient user quota of {quota}.\",\n \"key\"\ + \ : \"common.api.quota\",\n \"context\" : {\n \"quota\"\ + \ : \"someQuota\"\n }\n } ]\n}" + "415": + description: UnsupportedMediaType + content: + application/json: + schema: + $ref: '#/components/schemas/UnsupportedMediaTypeError' + examples: + example: + value: "{\n \"message\" : \"Unsupported media type.\",\n \"errors\"\ + \ : [ {\n \"message\" : \"The request entity has a media type\ + \ {mediaType} which the resource does not support.\",\n \"\ + key\" : \"common.api.mediaType\",\n \"context\" : {\n \ + \ \"mediaType\" : \"application/javascript\"\n }\n } ]\n}" + "404": + description: NotFound + content: + application/json: + schema: + $ref: '#/components/schemas/NotFoundError' + examples: + example: + value: "{\n \"message\" : \"Resource not found.\",\n \"errors\"\ + \ : [ {\n \"message\" : \"Unable to find the resource requested\ + \ resource: {resource}.\",\n \"key\" : \"common.api.resource\"\ + ,\n \"context\" : {\n \"resource\" : \"aResource\"\n \ + \ }\n } ]\n}" + "401": + description: Unauthorized + content: + application/json: + schema: + $ref: '#/components/schemas/UnauthorizedAltError' + examples: + example: + value: "{\n \"message\" : \"Access to requested resource denied.\"\ + ,\n \"errors\" : [ {\n \"message\" : \"Resource access denied\ + \ due to invalid credentials.\",\n \"key\" : \"common.api.token\"\ + ,\n \"context\" : {\n \"accessToken\" : \"expired\"\n\ + \ }\n } ]\n}" + x-bb-access-control-resource: WALLET + x-bb-access-control-function: MANAGE_PAYMENT_CARDS + x-bb-access-control-privilege: READ_PAYMENT_CARD + delete: + tags: + - wallet + summary: Deletes a payment card with a given id. + description: Deletes a payment card with a given id + operationId: deletePaymentCard + responses: + "204": + description: Payment card is succesfully deleted + "400": + description: BadRequest + content: + application/json: + schema: + $ref: '#/components/schemas/BadRequestError' + examples: + example: + value: "{\n \"message\" : \"Bad Request\",\n \"errors\" : [ {\n\ + \ \"message\" : \"Value Exceeded. Must be between {min} and\ + \ {max}.\",\n \"key\" : \"common.api.shoesize\",\n \"context\"\ + \ : {\n \"max\" : \"50\",\n \"min\" : \"1\"\n }\n\ + \ } ]\n}" + "500": + description: InternalServerError + content: + application/json: + schema: + $ref: '#/components/schemas/InternalServerError' + examples: + example: + value: "{\n \"message\" : \"Description of error\"\n}" + "403": + description: Forbidden + content: + application/json: + schema: + $ref: '#/components/schemas/ForbiddenError' + examples: + example: + value: "{\n \"message\" : \"Access to requested resource denied.\"\ + ,\n \"errors\" : [ {\n \"message\" : \"Resource access denied\ + \ due to an insufficient user quota of {quota}.\",\n \"key\"\ + \ : \"common.api.quota\",\n \"context\" : {\n \"quota\"\ + \ : \"someQuota\"\n }\n } ]\n}" + "415": + description: UnsupportedMediaType + content: + application/json: + schema: + $ref: '#/components/schemas/UnsupportedMediaTypeError' + examples: + example: + value: "{\n \"message\" : \"Unsupported media type.\",\n \"errors\"\ + \ : [ {\n \"message\" : \"The request entity has a media type\ + \ {mediaType} which the resource does not support.\",\n \"\ + key\" : \"common.api.mediaType\",\n \"context\" : {\n \ + \ \"mediaType\" : \"application/javascript\"\n }\n } ]\n}" + "404": + description: NotFound + content: + application/json: + schema: + $ref: '#/components/schemas/NotFoundError' + examples: + example: + value: "{\n \"message\" : \"Resource not found.\",\n \"errors\"\ + \ : [ {\n \"message\" : \"Unable to find the resource requested\ + \ resource: {resource}.\",\n \"key\" : \"common.api.resource\"\ + ,\n \"context\" : {\n \"resource\" : \"aResource\"\n \ + \ }\n } ]\n}" + "401": + description: Unauthorized + content: + application/json: + schema: + $ref: '#/components/schemas/UnauthorizedAltError' + examples: + example: + value: "{\n \"message\" : \"Access to requested resource denied.\"\ + ,\n \"errors\" : [ {\n \"message\" : \"Resource access denied\ + \ due to invalid credentials.\",\n \"key\" : \"common.api.token\"\ + ,\n \"context\" : {\n \"accessToken\" : \"expired\"\n\ + \ }\n } ]\n}" + x-bb-access-control-resource: WALLET + x-bb-access-control-function: MANAGE_PAYMENT_CARDS + x-bb-access-control-privilege: DELETE_PAYMENT_CARD + parameters: + - name: cardId + in: path + description: No description available + required: true + schema: + type: string + examples: + example: + summary: example + /client-api/v1/bbt/build-info: + summary: /build-info + description: No description available + get: + tags: + - bbt + summary: Build Information. + description: Build Information + operationId: getBuildinfo + responses: + "200": + description: No description available + content: + application/json: + schema: + $ref: '#/components/schemas/BbtBuild-infoGetGetResponseBody' + examples: + example: + value: "{\n \"build-info\" : {\n \"build.version\" : \"1.1.111-SNAPSHOT\"\ + \n }\n}" + /client-api/v1/patch: + summary: patch + description: PATCH endpoint for test operations + patch: + tags: + - patch + summary: patch + description: Patch Test + operationId: patchpatch + parameters: + - name: X-Request-Id + in: header + description: Correlates HTTP requests between a client and server. + required: false + schema: + type: string + examples: + example: + summary: example + value: f058ebd6-02f7-4d3f-942e-904344e8cde5 + responses: + "200": + description: No description available + content: {} + "400": + description: BadRequest + content: + application/json: + schema: + $ref: '#/components/schemas/BadRequestError' + examples: + example: + value: "{\n \"message\" : \"Bad Request\",\n \"errors\" : [ {\n\ + \ \"message\" : \"Value Exceeded. Must be between {min} and\ + \ {max}.\",\n \"key\" : \"common.api.shoesize\",\n \"context\"\ + \ : {\n \"max\" : \"50\",\n \"min\" : \"1\"\n }\n\ + \ } ]\n}" + "500": + description: InternalServerError + content: + application/json: + schema: + $ref: '#/components/schemas/InternalServerError' + examples: + example: + value: "{\n \"message\" : \"Description of error\"\n}" + "403": + description: Forbidden + content: + application/json: + schema: + $ref: '#/components/schemas/ForbiddenError' + examples: + example: + value: "{\n \"message\" : \"Access to requested resource denied.\"\ + ,\n \"errors\" : [ {\n \"message\" : \"Resource access denied\ + \ due to an insufficient user quota of {quota}.\",\n \"key\"\ + \ : \"common.api.quota\",\n \"context\" : {\n \"quota\"\ + \ : \"someQuota\"\n }\n } ]\n}" + "415": + description: UnsupportedMediaType + content: + application/json: + schema: + $ref: '#/components/schemas/UnsupportedMediaTypeError' + examples: + example: + value: "{\n \"message\" : \"Unsupported media type.\",\n \"errors\"\ + \ : [ {\n \"message\" : \"The request entity has a media type\ + \ {mediaType} which the resource does not support.\",\n \"\ + key\" : \"common.api.mediaType\",\n \"context\" : {\n \ + \ \"mediaType\" : \"application/javascript\"\n }\n } ]\n}" + "404": + description: NotFound + content: + application/json: + schema: + $ref: '#/components/schemas/NotFoundError' + examples: + example: + value: "{\n \"message\" : \"Resource not found.\",\n \"errors\"\ + \ : [ {\n \"message\" : \"Unable to find the resource requested\ + \ resource: {resource}.\",\n \"key\" : \"common.api.resource\"\ + ,\n \"context\" : {\n \"resource\" : \"aResource\"\n \ + \ }\n } ]\n}" + "401": + description: Unauthorized + content: + application/json: + schema: + $ref: '#/components/schemas/UnauthorizedAltError' + examples: + example: + value: "{\n \"message\" : \"Access to requested resource denied.\"\ + ,\n \"errors\" : [ {\n \"message\" : \"Resource access denied\ + \ due to invalid credentials.\",\n \"key\" : \"common.api.token\"\ + ,\n \"context\" : {\n \"accessToken\" : \"expired\"\n\ + \ }\n } ]\n}" + /client-api/v1/test/required-boolean-query-param: + summary: required boolean query param + description: arbitrary tests + get: + tags: + - test + description: No description available + operationId: getrequiredBooleanQueryParam + parameters: + - name: bool + in: query + description: Required boolean parameter with no default value + required: true + schema: + type: boolean + examples: + example: + summary: example + value: false + responses: + "200": + description: No description available + content: + application/json: + schema: + $ref: '#/components/schemas/RequiredbooleanqueryparamGetResponseBody' + "400": + description: BadRequest + content: + application/json: + schema: + $ref: '#/components/schemas/BadRequestError' + examples: + example: + value: "{\n \"message\" : \"Bad Request\",\n \"errors\" : [ {\n\ + \ \"message\" : \"Value Exceeded. Must be between {min} and\ + \ {max}.\",\n \"key\" : \"common.api.shoesize\",\n \"context\"\ + \ : {\n \"max\" : \"50\",\n \"min\" : \"1\"\n }\n\ + \ } ]\n}" + "500": + description: InternalServerError + content: + application/json: + schema: + $ref: '#/components/schemas/InternalServerError' + examples: + example: + value: "{\n \"message\" : \"Description of error\"\n}" + "403": + description: Forbidden + content: + application/json: + schema: + $ref: '#/components/schemas/ForbiddenError' + examples: + example: + value: "{\n \"message\" : \"Access to requested resource denied.\"\ + ,\n \"errors\" : [ {\n \"message\" : \"Resource access denied\ + \ due to an insufficient user quota of {quota}.\",\n \"key\"\ + \ : \"common.api.quota\",\n \"context\" : {\n \"quota\"\ + \ : \"someQuota\"\n }\n } ]\n}" + "415": + description: UnsupportedMediaType + content: + application/json: + schema: + $ref: '#/components/schemas/UnsupportedMediaTypeError' + examples: + example: + value: "{\n \"message\" : \"Unsupported media type.\",\n \"errors\"\ + \ : [ {\n \"message\" : \"The request entity has a media type\ + \ {mediaType} which the resource does not support.\",\n \"\ + key\" : \"common.api.mediaType\",\n \"context\" : {\n \ + \ \"mediaType\" : \"application/javascript\"\n }\n } ]\n}" + "404": + description: NotFound + content: + application/json: + schema: + $ref: '#/components/schemas/NotFoundError' + examples: + example: + value: "{\n \"message\" : \"Resource not found.\",\n \"errors\"\ + \ : [ {\n \"message\" : \"Unable to find the resource requested\ + \ resource: {resource}.\",\n \"key\" : \"common.api.resource\"\ + ,\n \"context\" : {\n \"resource\" : \"aResource\"\n \ + \ }\n } ]\n}" + "401": + description: Unauthorized + content: + application/json: + schema: + $ref: '#/components/schemas/UnauthorizedAltError' + examples: + example: + value: "{\n \"message\" : \"Access to requested resource denied.\"\ + ,\n \"errors\" : [ {\n \"message\" : \"Resource access denied\ + \ due to invalid credentials.\",\n \"key\" : \"common.api.token\"\ + ,\n \"context\" : {\n \"accessToken\" : \"expired\"\n\ + \ }\n } ]\n}" + /client-api/v1/test/values: + summary: Test Values + description: Test Values + get: + tags: + - test + description: No description available + operationId: getTestValues + responses: + "200": + description: No description available + content: + application/json: + schema: + $ref: '#/components/schemas/TestValuesGetResponseBody' + examples: + example: + value: "{\n \"message\" : \"a5b0fe7d-c4dd-40a7-bd80-dfc7869327e1\"\ + ,\n \"number\" : \"102.4\"\n}" + "500": + description: InternalServerError + content: + application/json: + schema: + $ref: '#/components/schemas/InternalServerError' + examples: + example: + value: "{\n \"message\" : \"Description of error\"\n}" + /client-api/v1/test/headers: + summary: Test header propagation + description: Test header propagation + get: + tags: + - test + description: No description available + operationId: getTestHeaderPropagation + parameters: + - name: addHops + in: query + description: number of additional hops to perform + required: false + schema: + type: integer + format: int32 + examples: + example: + summary: example + responses: + "200": + description: No description available + content: + application/json: + schema: + $ref: '#/components/schemas/TestHeadersResponseBody' + examples: + example: + value: "{\n \"requests\" : [ {\n \"name\" : \"building-blocks-test-wallet-presentation-service\"\ + ,\n \"url\" : \"/client-api/v1/test/headers\",\n \"headers\"\ + \ : {\n \"correlation-id\" : [ \"2ed475b714a3945a\" ],\n\ + \ \"accept\" : [ \"application/json\" ],\n \"x-bbt-test\"\ + \ : [ \"X-BBT-contentVal2\" ],\n \"connection\" : [ \"keep-alive\"\ + \ ]\n }\n }, {\n \"name\" : \"building-blocks-test-wallet-pandp-service\"\ + ,\n \"url\" : \"/service-api/v1/test/headers\",\n \"headers\"\ + \ : {\n \"authorization\" : [ \"Bearer eyJh\" ],\n \"\ + accept\" : [ \"application/xml, text/xml, application/json, application/*+xml,\ + \ application/*+json\" ],\n \"content-type\" : [ \"application/json\"\ + \ ],\n \"x-cxt-user-token\" : [ \"Bearer ey\" ],\n \"\ + x-cxt-remote-user\" : [ \"admin\" ],\n \"x-cxt-requestuuid\"\ + \ : [ \"72002652-131a-4f28-bd00-16b8080932f5\" ],\n \"correlation-id\"\ + \ : [ \"2ed475b714a3945a\" ],\n \"x-bbt-test\" : [ \"X-BBT-contentVal2\"\ + \ ]\n }\n }, {\n \"name\" : \"building-blocks-test-wallet-pandp-service\"\ + ,\n \"url\" : \"/service-api/v1/test/headers\",\n \"headers\"\ + \ : {\n \"authorization\" : [ \"Bearer eyJh\" ],\n \"\ + accept\" : [ \"application/xml, text/xml, application/json, application/*+xml,\ + \ application/*+json\" ],\n \"content-type\" : [ \"application/json\"\ + \ ],\n \"x-cxt-user-token\" : [ \"Bearer ey\" ],\n \"\ + x-cxt-remote-user\" : [ \"admin\" ],\n \"x-cxt-requestuuid\"\ + \ : [ \"72002652-131a-4f28-bd00-16b8080932f5\" ],\n \"correlation-id\"\ + \ : [ \"2ed475b714a3945a\" ],\n \"x-bbt-test\" : [ \"X-BBT-contentVal2\"\ + \ ]\n }\n } ]\n}" + "500": + description: InternalServerError + content: + application/json: + schema: + $ref: '#/components/schemas/InternalServerError' + examples: + example: + value: "{\n \"message\" : \"Description of error\"\n}" + /client-api/v1/test/date-query-params: + summary: dateQueryParam + description: | + Tests for date/time query parameters in service-apis. Sends the same query parameters to the equivalent endpoint + in the pandp service which echoes the given values back in the response body. Values echoed by the pandp service + are then returned in the response to this request. + get: + tags: + - test + description: No description available + operationId: getdateQueryParam + parameters: + - name: dateTimeOnly + in: query + description: Creation date in datetime-only format + required: false + schema: + type: string + format: date-time + examples: + example: + summary: example + value: 2017-10-04T14:54:36 + - name: dateTime + in: query + description: Creation date in Zoned RFC3339 Date-time format + required: false + schema: + type: string + format: date-time + examples: + example: + summary: example + value: 2017-10-04T14:54:36Z + - name: dateTime2616 + in: query + description: Zoned RFC2616 Date-time param example + required: false + schema: + type: string + format: date-time + examples: + example: + summary: example + value: "Wed, 4 Jul 2001 12:08:56 PDT" + - name: date + in: query + description: Date-only param example + required: false + schema: + type: string + format: date + examples: + example: + summary: example + value: 2017-10-04 + - name: time + in: query + description: time-only param example + required: false + schema: + type: string + format: date-time + examples: + example: + summary: example + value: 14:54:36 + responses: + "200": + description: No description available + content: + application/json: + schema: + $ref: '#/components/schemas/DateQueryParamGetResponseBody' +components: + schemas: + BadRequestError: + required: + - message + type: object + properties: + message: + type: string + description: Any further information + errors: + type: array + description: Detailed error information + items: + $ref: '#/components/schemas/ErrorItem' + BbAccessControl: + required: + - function + - privilege + - resource + type: object + properties: + resource: + type: string + description: "Resource being protected, e.g. 'User'" + function: + type: string + description: "Business function, e.g. 'Manage Users'" + privilege: + type: string + description: "The privilege required, e.g. 'view'" + BbApiDeprecation: + required: + - deprecatedFromVersion + - description + - reason + - removedFromVersion + type: object + properties: + deprecatedFromVersion: + type: string + description: Version of the product from which the endpoint has been deprecated + and should no longer be used + deprecated: true + removedFromVersion: + type: string + description: Version of the product from which the API endpoint will be + removed + reason: + type: string + description: The reason the API endpoint was deprecated + deprecated: true + description: + type: string + description: "Any further information, e.g. migration information" + BbtBuild-infoGetGetResponseBody: + type: object + properties: + build-info: + type: object + example: + build-info: + build.version: 1.1.111-SNAPSHOT + BbtbuildInfogetgetresponsebody: + type: object + properties: + build-info: + type: object + example: + build-info: + build.version: 1.1.111-SNAPSHOT + Currency: + title: Monetary Amount + required: + - amount + - currencyCode + type: object + properties: + amount: + type: string + description: The amount in the specified currency + currencyCode: + pattern: "^[A-Z]{3}$" + type: string + description: The alpha-3 code (complying with ISO 4217) of the currency + that qualifies the amount + description: Schema defining monetary amount in given currency. + DateQueryParamGetResponseBody: + type: object + properties: + dateTimeOnly: + type: string + dateTimeOnlyParsedValue: + type: string + dateTime: + type: string + dateTimeParsedValue: + type: string + dateTime2616: + type: string + dateTime2616ParsedValue: + type: string + date: + type: string + dateParsedValue: + type: string + time: + type: string + timeParsedValue: + type: string + formatDateTime: + type: string + description: "The dateTime parameter formatted as 'date-time', java.util.Date\ + \ or java.time.ZoneDateTime" + format: date-time + formatDate: + type: string + description: "The date parameter formatted as 'date', String or java.time.LocalDate" + format: date + formatTime: + type: string + description: "The time parameter formatted as 'time', String or java.time.LocalTime" + formatUtcMillisec: + type: string + description: "The dateTime parameter formatted as 'date', long" + ErrorItem: + type: object + properties: + message: + type: string + description: Default Message. Any further information. + key: + type: string + description: "{capability-name}.api.{api-key-name}. For generated validation\ + \ errors this is the path in the document the error resolves to. e.g.\ + \ object name + '.' + field" + context: + type: object + description: Context can be anything used to construct localised messages. + description: A validation error + ForbiddenError: + type: object + properties: + message: + type: string + description: Any further information + errors: + type: array + description: Detailed error information + items: + $ref: '#/components/schemas/ErrorItem' + InternalServerError: + required: + - message + type: object + properties: + message: + type: string + description: Further Information + description: Represents HTTP 500 Internal Server Error + NotAcceptableError: + type: object + properties: + message: + type: string + supportedMediaTypes: + type: array + description: List of supported media types for this endpoint + items: + type: string + NotFoundError: + type: object + properties: + message: + type: string + description: Any further information + errors: + type: array + description: Detailed error information + items: + $ref: '#/components/schemas/ErrorItem' + ObjectWrappingException: + type: object + properties: + message: + type: string + data: + type: object + PaymentCard: + required: + - cvc + - expiryDate + - id + - nameOnCard + - pan + - startDate + type: object + properties: + id: + type: string + pan: + maxLength: 19 + type: string + description: "Must be sixteen digits, optionally in blocks of 4 separated\ + \ by a dash" + cvc: + maxLength: 3 + minLength: 3 + type: string + description: Card Verification Code + startDate: + pattern: "^(0[1-9]|1[0-2])/?([0-9]{4}|[0-9]{2})$" + type: string + description: "Must be in one of these four formats: MM/YY MMYY MMYYYY MM/YYYY" + expiryDate: + pattern: "^(0[1-9]|1[0-2])/?([0-9]{4}|[0-9]{2})$" + type: string + description: "Must be in one of these four formats: MM/YY MMYY MMYYYY MM/YYYY" + nameOnCard: + type: string + creationDate: + type: string + format: date-time + balance: + $ref: '#/components/schemas/Currency' + apr: + type: number + cardtype: + type: string + enum: + - CREDIT + - DEBIT + - PREPAID + PaymentCards: + type: array + items: + $ref: '#/components/schemas/PaymentCard' + PaymentCardsPostResponseBody: + type: object + properties: + id: + type: string + example: + id: a5b0fe7d-c4dd-40a7-bd80-dfc7869327e1 + RequiredbooleanqueryparamGetResponseBody: + type: object + properties: + message: + type: string + TestHeadersResponseBody: + type: object + properties: + requests: + type: array + items: + type: object + properties: + name: + type: string + url: + type: string + headers: + type: object + TestValuesGetResponseBody: + type: object + properties: + message: + type: string + number: + type: string + example: + message: a5b0fe7d-c4dd-40a7-bd80-dfc7869327e1 + number: "102.4" + UnauthorizedAltError: + type: object + properties: + message: + type: string + description: Any further information + errors: + type: array + description: Detailed error information + items: + $ref: '#/components/schemas/ErrorItem' + UnauthorizedError: + required: + - message + type: object + properties: + message: + type: string + UnsupportedMediaTypeError: + type: object + properties: + message: + type: string + description: Any further information + errors: + type: array + description: Detailed error information + items: + $ref: '#/components/schemas/ErrorItem' diff --git a/boat-maven-plugin/src/it/example/boat-artifact-input/openapi-specs/openapi-zips/src/main/resources/presentation-integration-api/index.html b/boat-maven-plugin/src/it/example/boat-artifact-input/openapi-specs/openapi-zips/src/main/resources/presentation-integration-api/index.html new file mode 100644 index 000000000..ef9076b62 --- /dev/null +++ b/boat-maven-plugin/src/it/example/boat-artifact-input/openapi-specs/openapi-zips/src/main/resources/presentation-integration-api/index.html @@ -0,0 +1,24 @@ + + + + Example + + + + + + + + + + + + + \ No newline at end of file diff --git a/boat-maven-plugin/src/it/example/boat-artifact-input/openapi-specs/openapi-zips/src/main/resources/presentation-integration-api/openapi.yaml b/boat-maven-plugin/src/it/example/boat-artifact-input/openapi-specs/openapi-zips/src/main/resources/presentation-integration-api/openapi.yaml new file mode 100644 index 000000000..bf69079bf --- /dev/null +++ b/boat-maven-plugin/src/it/example/boat-artifact-input/openapi-specs/openapi-zips/src/main/resources/presentation-integration-api/openapi.yaml @@ -0,0 +1,48 @@ +openapi: 3.0.3 +info: + title: Example + description: | + # Example + Test Schema to test an integration-api + version: 2.19.0 +servers: +- url: /artifact-service/ + description: The server +tags: +- name: example +paths: + /integration-api/v1/items: + summary: items + description: Retrieve all items. + get: + tags: + - items + summary: Retrieve list of all items. + description: Retrieve list of all items. + operationId: getitems + responses: + "200": + description: Test Schema + content: + application/json: + schema: + $ref: '#/components/schemas/ItemsGetResponseBody' + examples: + example: + value: "{\n \"name\" : \"Example\",\n \"description\" : \"Example\ + \ description\"\n}" +components: + schemas: + ItemsGetResponseBody: + required: + - name + type: object + properties: + name: + type: string + description: + type: string + description: this models a simple item. + example: + name: Example + description: Example description diff --git a/boat-maven-plugin/src/it/example/boat-artifact-input/openapi-specs/openapi-zips/src/main/resources/presentation-service-api/index.html b/boat-maven-plugin/src/it/example/boat-artifact-input/openapi-specs/openapi-zips/src/main/resources/presentation-service-api/index.html new file mode 100644 index 000000000..c9863ec40 --- /dev/null +++ b/boat-maven-plugin/src/it/example/boat-artifact-input/openapi-specs/openapi-zips/src/main/resources/presentation-service-api/index.html @@ -0,0 +1,24 @@ + + + + Wallet Test Service API + + + + + + + + + + + + + \ No newline at end of file diff --git a/boat-maven-plugin/src/it/example/boat-artifact-input/openapi-specs/openapi-zips/src/main/resources/presentation-service-api/openapi.yaml b/boat-maven-plugin/src/it/example/boat-artifact-input/openapi-specs/openapi-zips/src/main/resources/presentation-service-api/openapi.yaml new file mode 100644 index 000000000..5a2175c02 --- /dev/null +++ b/boat-maven-plugin/src/it/example/boat-artifact-input/openapi-specs/openapi-zips/src/main/resources/presentation-service-api/openapi.yaml @@ -0,0 +1,885 @@ +openapi: 3.0.3 +info: + title: Wallet Test Service API + description: No description available + version: 2.19.0 +servers: +- url: /artifact-service/ + description: The server +tags: +- name: wallet test service api +paths: + /service-api/v1/wallet/admin/{userId}/paymentcards: + summary: Payment Cards + description: No description available + get: + tags: + - wallet + summary: "Returns available payment card details for user, optionally filtered\ + \ by nameOnCard." + description: "Returns available payment card details for user, optionally filtered\ + \ by nameOnCard" + operationId: getPaymentCards + parameters: + - name: nameOnCard + in: query + description: "Filter by the cardholder's name (case-insensitive), can be the\ + \ first one or more characters of one of the words/names" + required: false + schema: + type: string + examples: + example: + summary: example + value: Smi + - name: dateTimeOnly + in: query + description: Creation date in datetime-only format + required: false + schema: + type: string + format: date-time + examples: + example: + summary: example + value: 2017-10-04T14:54:36 + - name: dateTime + in: query + description: Creation date in Zoned RFC3339 Date-time format + required: false + schema: + type: string + format: date-time + examples: + example: + summary: example + value: 2017-10-04T14:54:36Z + - name: dateTime2616 + in: query + description: Zoned RFC2616 Date-time param example + required: false + schema: + type: string + format: date-time + examples: + example: + summary: example + value: "Wed, 4 Jul 2001 12:08:56 PDT" + - name: date + in: query + description: Date-only param example + required: false + schema: + type: string + format: date + examples: + example: + summary: example + value: 2017-10-04 + - name: time + in: query + description: time-only param example + required: false + schema: + type: string + format: date-time + examples: + example: + summary: example + value: 14:54:36 + - name: orderBy + in: query + description: "Order by field: nameOnCard\n" + required: false + schema: + type: string + examples: + example: + summary: example + - name: direction + in: query + description: Direction + required: false + schema: + type: string + default: DESC + enum: + - ASC + - DESC + examples: + example: + summary: example + responses: + "200": + description: No description available + content: + application/json: + schema: + $ref: '#/components/schemas/PaymentCards' + examples: + example: + value: "[ {\n \"id\" : \"a5b0fe7d-c4dd-40a7-bd80-dfc7869327e1\"\ + ,\n \"pan\" : \"5434111122223333\",\n \"cvc\" : \"123\",\n \ + \ \"startDate\" : \"0116\",\n \"expiryDate\" : \"1219\",\n \"\ + nameOnCard\" : \"Mr Timmy Tester\",\n \"creationDate\" : \"2011-05-30T12:13:14+03:00\"\ + ,\n \"balance\" : {\n \"amount\" : \"2001\",\n \"currencyCode\"\ + \ : \"EUR\"\n },\n \"apr\" : 12.75\n}, {\n \"id\" : \"d593c212-70ad-41a6-a547-d5d9232414cb\"\ + ,\n \"pan\" : \"5434111122224444\",\n \"cvc\" : \"101\",\n \ + \ \"startDate\" : \"0216\",\n \"expiryDate\" : \"0120\",\n \"\ + nameOnCard\" : \"Mr Timmothy Tester\",\n \"creationDate\" : \"\ + 2011-05-30T12:13:14+03:00\",\n \"balance\" : {\n \"amount\"\ + \ : \"4.4399999999999995\",\n \"currencyCode\" : \"GBP\"\n\ + \ },\n \"apr\" : 12.75\n}, {\n \"id\" : \"9635966b-28e9-4479-8121-bb7bc9beeb62\"\ + ,\n \"pan\" : \"5434121212121212\",\n \"cvc\" : \"121\",\n \ + \ \"startDate\" : \"0115\",\n \"expiryDate\" : \"1218\",\n \"\ + nameOnCard\" : \"Mr Timmy Tester\",\n \"creationDate\" : \"2011-05-30T12:13:14+03:00\"\ + ,\n \"balance\" : {\n \"amount\" : \"1981\",\n \"currencyCode\"\ + \ : \"EUR\"\n },\n \"apr\" : 12.75\n} ]" + "400": + description: BadRequest + content: + application/json: + schema: + $ref: '#/components/schemas/BadRequestError' + examples: + example: + value: "{\n \"message\" : \"Bad Request\",\n \"errors\" : [ {\n\ + \ \"message\" : \"Value Exceeded. Must be between {min} and\ + \ {max}.\",\n \"key\" : \"common.api.shoesize\",\n \"context\"\ + \ : {\n \"max\" : \"50\",\n \"min\" : \"1\"\n }\n\ + \ } ]\n}" + "406": + description: NotAcceptable + content: + application/json: + schema: + $ref: '#/components/schemas/NotAcceptableError' + examples: + example: + value: "{\n \"message\" : \"Could not find acceptable representation\"\ + ,\n \"supportedMediaTypes\" : [ \"application/json\" ]\n}" + "500": + description: InternalServerError + content: + application/json: + schema: + $ref: '#/components/schemas/InternalServerError' + examples: + example: + value: "{\n \"message\" : \"Description of error\"\n}" + "403": + description: Forbidden + content: + application/json: + schema: + $ref: '#/components/schemas/ForbiddenError' + examples: + example: + value: "{\n \"message\" : \"Access to requested resource denied.\"\ + ,\n \"errors\" : [ {\n \"message\" : \"Resource access denied\ + \ due to an insufficient user quota of {quota}.\",\n \"key\"\ + \ : \"common.api.quota\",\n \"context\" : {\n \"quota\"\ + \ : \"someQuota\"\n }\n } ]\n}" + "415": + description: UnsupportedMediaType + content: + application/json: + schema: + $ref: '#/components/schemas/UnsupportedMediaTypeError' + examples: + example: + value: "{\n \"message\" : \"Unsupported media type.\",\n \"errors\"\ + \ : [ {\n \"message\" : \"The request entity has a media type\ + \ {mediaType} which the resource does not support.\",\n \"\ + key\" : \"common.api.mediaType\",\n \"context\" : {\n \ + \ \"mediaType\" : \"application/javascript\"\n }\n } ]\n}" + "404": + description: NotFound + content: + application/json: + schema: + $ref: '#/components/schemas/NotFoundError' + examples: + example: + value: "{\n \"message\" : \"Resource not found.\",\n \"errors\"\ + \ : [ {\n \"message\" : \"Unable to find the resource requested\ + \ resource: {resource}.\",\n \"key\" : \"common.api.resource\"\ + ,\n \"context\" : {\n \"resource\" : \"aResource\"\n \ + \ }\n } ]\n}" + "401": + description: Unauthorized + content: + application/json: + schema: + $ref: '#/components/schemas/UnauthorizedAltError' + examples: + example: + value: "{\n \"message\" : \"Access to requested resource denied.\"\ + ,\n \"errors\" : [ {\n \"message\" : \"Resource access denied\ + \ due to invalid credentials.\",\n \"key\" : \"common.api.token\"\ + ,\n \"context\" : {\n \"accessToken\" : \"expired\"\n\ + \ }\n } ]\n}" + post: + tags: + - wallet + summary: Adds a payment card to the user's wallet. + description: Adds a payment card to the user's wallet + operationId: postPaymentCards + parameters: + - name: X-Request-Id + in: header + description: Correlates HTTP requests between a client and server. + required: false + schema: + type: string + examples: + example: + summary: example + value: f058ebd6-02f7-4d3f-942e-904344e8cde5 + requestBody: + description: Adds a payment card to the user's wallet + content: + application/json: + schema: + $ref: '#/components/schemas/PaymentCard' + examples: + example: + value: "{\n \"id\" : \"a5b0fe7d-c4dd-40a7-bd80-dfc7869327e1\",\n\ + \ \"pan\" : \"5434111122223333\",\n \"cvc\" : \"123\",\n \"startDate\"\ + \ : \"0116\",\n \"expiryDate\" : \"1219\",\n \"nameOnCard\" :\ + \ \"Mr Timmy Tester\",\n \"creationDate\" : \"2011-05-30T12:13:14+03:00\"\ + ,\n \"balance\" : {\n \"amount\" : \"1000\",\n \"currencyCode\"\ + \ : \"EUR\"\n },\n \"apr\" : 12.75\n}" + responses: + "201": + description: request to create payment card accepted + content: + application/json: + schema: + $ref: '#/components/schemas/PaymentCardsPostResponseBody' + examples: + example: + value: "{\n \"id\" : \"a5b0fe7d-c4dd-40a7-bd80-dfc7869327e1\"\n\ + }" + "400": + description: BadRequest + content: + application/json: + schema: + $ref: '#/components/schemas/BadRequestError' + examples: + example: + value: "{\n \"message\" : \"Bad Request\",\n \"errors\" : [ {\n\ + \ \"message\" : \"Value Exceeded. Must be between {min} and\ + \ {max}.\",\n \"key\" : \"common.api.shoesize\",\n \"context\"\ + \ : {\n \"max\" : \"50\",\n \"min\" : \"1\"\n }\n\ + \ } ]\n}" + "500": + description: InternalServerError + content: + application/json: + schema: + $ref: '#/components/schemas/InternalServerError' + examples: + example: + value: "{\n \"message\" : \"Description of error\"\n}" + "403": + description: Forbidden + content: + application/json: + schema: + $ref: '#/components/schemas/ForbiddenError' + examples: + example: + value: "{\n \"message\" : \"Access to requested resource denied.\"\ + ,\n \"errors\" : [ {\n \"message\" : \"Resource access denied\ + \ due to an insufficient user quota of {quota}.\",\n \"key\"\ + \ : \"common.api.quota\",\n \"context\" : {\n \"quota\"\ + \ : \"someQuota\"\n }\n } ]\n}" + "415": + description: UnsupportedMediaType + content: + application/json: + schema: + $ref: '#/components/schemas/UnsupportedMediaTypeError' + examples: + example: + value: "{\n \"message\" : \"Unsupported media type.\",\n \"errors\"\ + \ : [ {\n \"message\" : \"The request entity has a media type\ + \ {mediaType} which the resource does not support.\",\n \"\ + key\" : \"common.api.mediaType\",\n \"context\" : {\n \ + \ \"mediaType\" : \"application/javascript\"\n }\n } ]\n}" + "404": + description: NotFound + content: + application/json: + schema: + $ref: '#/components/schemas/NotFoundError' + examples: + example: + value: "{\n \"message\" : \"Resource not found.\",\n \"errors\"\ + \ : [ {\n \"message\" : \"Unable to find the resource requested\ + \ resource: {resource}.\",\n \"key\" : \"common.api.resource\"\ + ,\n \"context\" : {\n \"resource\" : \"aResource\"\n \ + \ }\n } ]\n}" + "401": + description: Unauthorized + content: + application/json: + schema: + $ref: '#/components/schemas/UnauthorizedAltError' + examples: + example: + value: "{\n \"message\" : \"Access to requested resource denied.\"\ + ,\n \"errors\" : [ {\n \"message\" : \"Resource access denied\ + \ due to invalid credentials.\",\n \"key\" : \"common.api.token\"\ + ,\n \"context\" : {\n \"accessToken\" : \"expired\"\n\ + \ }\n } ]\n}" + parameters: + - name: userId + in: path + description: No description available + required: true + schema: + type: string + examples: + example: + summary: example + /service-api/v1/wallet/admin/{userId}/paymentcards/{cardId}: + summary: Payment Card + description: No description available + get: + tags: + - wallet + summary: Returns details of a specific payment card. + description: Returns details of a specific payment card + operationId: getPaymentCard + responses: + "200": + description: No description available + content: + application/json: + schema: + $ref: '#/components/schemas/PaymentCard' + examples: + example: + value: "{\n \"id\" : \"a5b0fe7d-c4dd-40a7-bd80-dfc7869327e1\",\n\ + \ \"pan\" : \"5434111122223333\",\n \"cvc\" : \"123\",\n \"\ + startDate\" : \"0116\",\n \"expiryDate\" : \"1219\",\n \"nameOnCard\"\ + \ : \"Mr Timmy Tester\",\n \"creationDate\" : \"2011-05-30T12:13:14+03:00\"\ + ,\n \"balance\" : {\n \"amount\" : \"1000\",\n \"currencyCode\"\ + \ : \"EUR\"\n },\n \"apr\" : 12.75\n}" + "400": + description: BadRequest + content: + application/json: + schema: + $ref: '#/components/schemas/BadRequestError' + examples: + example: + value: "{\n \"message\" : \"Bad Request\",\n \"errors\" : [ {\n\ + \ \"message\" : \"Value Exceeded. Must be between {min} and\ + \ {max}.\",\n \"key\" : \"common.api.shoesize\",\n \"context\"\ + \ : {\n \"max\" : \"50\",\n \"min\" : \"1\"\n }\n\ + \ } ]\n}" + "500": + description: InternalServerError + content: + application/json: + schema: + $ref: '#/components/schemas/InternalServerError' + examples: + example: + value: "{\n \"message\" : \"Description of error\"\n}" + "403": + description: Forbidden + content: + application/json: + schema: + $ref: '#/components/schemas/ForbiddenError' + examples: + example: + value: "{\n \"message\" : \"Access to requested resource denied.\"\ + ,\n \"errors\" : [ {\n \"message\" : \"Resource access denied\ + \ due to an insufficient user quota of {quota}.\",\n \"key\"\ + \ : \"common.api.quota\",\n \"context\" : {\n \"quota\"\ + \ : \"someQuota\"\n }\n } ]\n}" + "415": + description: UnsupportedMediaType + content: + application/json: + schema: + $ref: '#/components/schemas/UnsupportedMediaTypeError' + examples: + example: + value: "{\n \"message\" : \"Unsupported media type.\",\n \"errors\"\ + \ : [ {\n \"message\" : \"The request entity has a media type\ + \ {mediaType} which the resource does not support.\",\n \"\ + key\" : \"common.api.mediaType\",\n \"context\" : {\n \ + \ \"mediaType\" : \"application/javascript\"\n }\n } ]\n}" + "404": + description: NotFound + content: + application/json: + schema: + $ref: '#/components/schemas/NotFoundError' + examples: + example: + value: "{\n \"message\" : \"Resource not found.\",\n \"errors\"\ + \ : [ {\n \"message\" : \"Unable to find the resource requested\ + \ resource: {resource}.\",\n \"key\" : \"common.api.resource\"\ + ,\n \"context\" : {\n \"resource\" : \"aResource\"\n \ + \ }\n } ]\n}" + "401": + description: Unauthorized + content: + application/json: + schema: + $ref: '#/components/schemas/UnauthorizedAltError' + examples: + example: + value: "{\n \"message\" : \"Access to requested resource denied.\"\ + ,\n \"errors\" : [ {\n \"message\" : \"Resource access denied\ + \ due to invalid credentials.\",\n \"key\" : \"common.api.token\"\ + ,\n \"context\" : {\n \"accessToken\" : \"expired\"\n\ + \ }\n } ]\n}" + delete: + tags: + - wallet + summary: Deletes a payment card with a given id. + description: Deletes a payment card with a given id + operationId: deletePaymentCard + responses: + "204": + description: Payment card is succesfully deleted + "400": + description: BadRequest + content: + application/json: + schema: + $ref: '#/components/schemas/BadRequestError' + examples: + example: + value: "{\n \"message\" : \"Bad Request\",\n \"errors\" : [ {\n\ + \ \"message\" : \"Value Exceeded. Must be between {min} and\ + \ {max}.\",\n \"key\" : \"common.api.shoesize\",\n \"context\"\ + \ : {\n \"max\" : \"50\",\n \"min\" : \"1\"\n }\n\ + \ } ]\n}" + "500": + description: InternalServerError + content: + application/json: + schema: + $ref: '#/components/schemas/InternalServerError' + examples: + example: + value: "{\n \"message\" : \"Description of error\"\n}" + "403": + description: Forbidden + content: + application/json: + schema: + $ref: '#/components/schemas/ForbiddenError' + examples: + example: + value: "{\n \"message\" : \"Access to requested resource denied.\"\ + ,\n \"errors\" : [ {\n \"message\" : \"Resource access denied\ + \ due to an insufficient user quota of {quota}.\",\n \"key\"\ + \ : \"common.api.quota\",\n \"context\" : {\n \"quota\"\ + \ : \"someQuota\"\n }\n } ]\n}" + "415": + description: UnsupportedMediaType + content: + application/json: + schema: + $ref: '#/components/schemas/UnsupportedMediaTypeError' + examples: + example: + value: "{\n \"message\" : \"Unsupported media type.\",\n \"errors\"\ + \ : [ {\n \"message\" : \"The request entity has a media type\ + \ {mediaType} which the resource does not support.\",\n \"\ + key\" : \"common.api.mediaType\",\n \"context\" : {\n \ + \ \"mediaType\" : \"application/javascript\"\n }\n } ]\n}" + "404": + description: NotFound + content: + application/json: + schema: + $ref: '#/components/schemas/NotFoundError' + examples: + example: + value: "{\n \"message\" : \"Resource not found.\",\n \"errors\"\ + \ : [ {\n \"message\" : \"Unable to find the resource requested\ + \ resource: {resource}.\",\n \"key\" : \"common.api.resource\"\ + ,\n \"context\" : {\n \"resource\" : \"aResource\"\n \ + \ }\n } ]\n}" + "401": + description: Unauthorized + content: + application/json: + schema: + $ref: '#/components/schemas/UnauthorizedAltError' + examples: + example: + value: "{\n \"message\" : \"Access to requested resource denied.\"\ + ,\n \"errors\" : [ {\n \"message\" : \"Resource access denied\ + \ due to invalid credentials.\",\n \"key\" : \"common.api.token\"\ + ,\n \"context\" : {\n \"accessToken\" : \"expired\"\n\ + \ }\n } ]\n}" + parameters: + - name: cardId + in: path + description: No description available + required: true + schema: + type: string + examples: + example: + summary: example + - name: userId + in: path + description: No description available + required: true + schema: + type: string + examples: + example: + summary: example + /service-api/v1/testQuery/required-boolean-query-param: + summary: required boolean query param + description: arbitrary tests + get: + tags: + - testQuery + description: No description available + operationId: getrequiredBooleanQueryParam + parameters: + - name: bool + in: query + description: Required boolean parameter with no default value + required: true + schema: + type: boolean + examples: + example: + summary: example + value: false + responses: + "200": + description: No description available + content: + application/json: + schema: + $ref: '#/components/schemas/RequiredbooleanqueryparamGetResponseBody' + "400": + description: BadRequest + content: + application/json: + schema: + $ref: '#/components/schemas/BadRequestError' + examples: + example: + value: "{\n \"message\" : \"Bad Request\",\n \"errors\" : [ {\n\ + \ \"message\" : \"Value Exceeded. Must be between {min} and\ + \ {max}.\",\n \"key\" : \"common.api.shoesize\",\n \"context\"\ + \ : {\n \"max\" : \"50\",\n \"min\" : \"1\"\n }\n\ + \ } ]\n}" + "500": + description: InternalServerError + content: + application/json: + schema: + $ref: '#/components/schemas/InternalServerError' + examples: + example: + value: "{\n \"message\" : \"Description of error\"\n}" + "403": + description: Forbidden + content: + application/json: + schema: + $ref: '#/components/schemas/ForbiddenError' + examples: + example: + value: "{\n \"message\" : \"Access to requested resource denied.\"\ + ,\n \"errors\" : [ {\n \"message\" : \"Resource access denied\ + \ due to an insufficient user quota of {quota}.\",\n \"key\"\ + \ : \"common.api.quota\",\n \"context\" : {\n \"quota\"\ + \ : \"someQuota\"\n }\n } ]\n}" + "415": + description: UnsupportedMediaType + content: + application/json: + schema: + $ref: '#/components/schemas/UnsupportedMediaTypeError' + examples: + example: + value: "{\n \"message\" : \"Unsupported media type.\",\n \"errors\"\ + \ : [ {\n \"message\" : \"The request entity has a media type\ + \ {mediaType} which the resource does not support.\",\n \"\ + key\" : \"common.api.mediaType\",\n \"context\" : {\n \ + \ \"mediaType\" : \"application/javascript\"\n }\n } ]\n}" + "404": + description: NotFound + content: + application/json: + schema: + $ref: '#/components/schemas/NotFoundError' + examples: + example: + value: "{\n \"message\" : \"Resource not found.\",\n \"errors\"\ + \ : [ {\n \"message\" : \"Unable to find the resource requested\ + \ resource: {resource}.\",\n \"key\" : \"common.api.resource\"\ + ,\n \"context\" : {\n \"resource\" : \"aResource\"\n \ + \ }\n } ]\n}" + "401": + description: Unauthorized + content: + application/json: + schema: + $ref: '#/components/schemas/UnauthorizedAltError' + examples: + example: + value: "{\n \"message\" : \"Access to requested resource denied.\"\ + ,\n \"errors\" : [ {\n \"message\" : \"Resource access denied\ + \ due to invalid credentials.\",\n \"key\" : \"common.api.token\"\ + ,\n \"context\" : {\n \"accessToken\" : \"expired\"\n\ + \ }\n } ]\n}" +components: + schemas: + BadRequestError: + required: + - message + type: object + properties: + message: + type: string + description: Any further information + errors: + type: array + description: Detailed error information + items: + $ref: '#/components/schemas/ErrorItem' + BbAccessControl: + required: + - function + - privilege + - resource + type: object + properties: + resource: + type: string + description: "Resource being protected, e.g. 'User'" + function: + type: string + description: "Business function, e.g. 'Manage Users'" + privilege: + type: string + description: "The privilege required, e.g. 'view'" + BbApiDeprecation: + required: + - deprecatedFromVersion + - description + - reason + - removedFromVersion + type: object + properties: + deprecatedFromVersion: + type: string + description: Version of the product from which the endpoint has been deprecated + and should no longer be used + deprecated: true + removedFromVersion: + type: string + description: Version of the product from which the API endpoint will be + removed + reason: + type: string + description: The reason the API endpoint was deprecated + deprecated: true + description: + type: string + description: "Any further information, e.g. migration information" + Currency: + title: Monetary Amount + required: + - amount + - currencyCode + type: object + properties: + amount: + type: string + description: The amount in the specified currency + currencyCode: + pattern: "^[A-Z]{3}$" + type: string + description: The alpha-3 code (complying with ISO 4217) of the currency + that qualifies the amount + description: Schema defining monetary amount in given currency. + ErrorItem: + type: object + properties: + message: + type: string + description: Default Message. Any further information. + key: + type: string + description: "{capability-name}.api.{api-key-name}. For generated validation\ + \ errors this is the path in the document the error resolves to. e.g.\ + \ object name + '.' + field" + context: + type: object + description: Context can be anything used to construct localised messages. + description: A validation error + ForbiddenError: + type: object + properties: + message: + type: string + description: Any further information + errors: + type: array + description: Detailed error information + items: + $ref: '#/components/schemas/ErrorItem' + InternalServerError: + required: + - message + type: object + properties: + message: + type: string + description: Further Information + description: Represents HTTP 500 Internal Server Error + NotAcceptableError: + type: object + properties: + message: + type: string + supportedMediaTypes: + type: array + description: List of supported media types for this endpoint + items: + type: string + NotFoundError: + type: object + properties: + message: + type: string + description: Any further information + errors: + type: array + description: Detailed error information + items: + $ref: '#/components/schemas/ErrorItem' + ObjectWrappingException: + type: object + properties: + message: + type: string + data: + type: object + PaymentCard: + required: + - cvc + - expiryDate + - id + - nameOnCard + - pan + - startDate + type: object + properties: + id: + type: string + pan: + maxLength: 19 + type: string + description: "Must be sixteen digits, optionally in blocks of 4 separated\ + \ by a dash" + cvc: + maxLength: 3 + minLength: 3 + type: string + description: Card Verification Code + startDate: + pattern: "^(0[1-9]|1[0-2])/?([0-9]{4}|[0-9]{2})$" + type: string + description: "Must be in one of these four formats: MM/YY MMYY MMYYYY MM/YYYY" + expiryDate: + pattern: "^(0[1-9]|1[0-2])/?([0-9]{4}|[0-9]{2})$" + type: string + description: "Must be in one of these four formats: MM/YY MMYY MMYYYY MM/YYYY" + nameOnCard: + type: string + creationDate: + type: string + format: date-time + balance: + $ref: '#/components/schemas/Currency' + apr: + type: number + cardtype: + type: string + enum: + - CREDIT + - DEBIT + - PREPAID + PaymentCards: + type: array + items: + $ref: '#/components/schemas/PaymentCard' + PaymentCardsPostResponseBody: + type: object + properties: + id: + type: string + example: + id: a5b0fe7d-c4dd-40a7-bd80-dfc7869327e1 + RequiredbooleanqueryparamGetResponseBody: + type: object + properties: + message: + type: string + TestHeadersResponseBody: + type: object + properties: + requests: + type: array + items: + type: object + properties: + name: + type: string + url: + type: string + headers: + type: object + UnauthorizedAltError: + type: object + properties: + message: + type: string + description: Any further information + errors: + type: array + description: Detailed error information + items: + $ref: '#/components/schemas/ErrorItem' + UnauthorizedError: + required: + - message + type: object + properties: + message: + type: string + UnsupportedMediaTypeError: + type: object + properties: + message: + type: string + description: Any further information + errors: + type: array + description: Detailed error information + items: + $ref: '#/components/schemas/ErrorItem' diff --git a/boat-maven-plugin/src/it/example/boat-artifact-input/openapi-specs/pom.xml b/boat-maven-plugin/src/it/example/boat-artifact-input/openapi-specs/pom.xml new file mode 100644 index 000000000..b9cd10ba3 --- /dev/null +++ b/boat-maven-plugin/src/it/example/boat-artifact-input/openapi-specs/pom.xml @@ -0,0 +1,23 @@ + + + 4.0.0 + + + com.backbase.oss.boat.example + boat-artifact-input + 1.0.0-SNAPSHOT + + + openapi-specs + pom + + + + openapi-zips + openapi-spec-bom + + + + diff --git a/boat-maven-plugin/src/it/example/boat-artifact-input/pom.xml b/boat-maven-plugin/src/it/example/boat-artifact-input/pom.xml new file mode 100644 index 000000000..073f0b85d --- /dev/null +++ b/boat-maven-plugin/src/it/example/boat-artifact-input/pom.xml @@ -0,0 +1,31 @@ + + + 4.0.0 + + + com.backbase.oss.boat.example + example + 1.0.0-SNAPSHOT + + + boat-artifact-input + pom + + BOAT :: DOCandLint + + + Example projects showing exporting RAML to OpenAPI from source files. + Specs can be in source files, or retrieved from dependencies + + + + + openapi-specs + artifact-input + + + + + diff --git a/boat-maven-plugin/src/it/example/boat-multiple-executions/pom.xml b/boat-maven-plugin/src/it/example/boat-multiple-executions/pom.xml new file mode 100644 index 000000000..97e6c0638 --- /dev/null +++ b/boat-maven-plugin/src/it/example/boat-multiple-executions/pom.xml @@ -0,0 +1,60 @@ + + + 4.0.0 + + + com.backbase.oss.boat.example + example + 1.0.0-SNAPSHOT + + + boat-multiple-executions + pom + + BOAT :: Execute multiple + + + + + com.backbase.oss + boat-maven-plugin + + + generate-rest-template-embedded + generate-sources + + doc + + + https://raw.githubusercontent.com/OAI/OpenAPI-Specification/master/examples/v3.0/api-with-examples.yaml + + + + lint + verify + + lint + + + ${project.basedir}/src/main/resources/presentation-client-api/openapi.yaml + + + + generate-docs + generate-sources + + doc + + + ${project.basedir}/src/main/resources/presentation-integration-api/openapi.yaml + + + + + + + + + \ No newline at end of file diff --git a/boat-maven-plugin/src/it/example/boat-multiple-executions/src/main/resources/presentation-client-api/index.html b/boat-maven-plugin/src/it/example/boat-multiple-executions/src/main/resources/presentation-client-api/index.html new file mode 100644 index 000000000..80aa61995 --- /dev/null +++ b/boat-maven-plugin/src/it/example/boat-multiple-executions/src/main/resources/presentation-client-api/index.html @@ -0,0 +1,24 @@ + + + + Wallet Test Client API + + + + + + + + + + + + + \ No newline at end of file diff --git a/boat-maven-plugin/src/it/example/boat-multiple-executions/src/main/resources/presentation-client-api/openapi.yaml b/boat-maven-plugin/src/it/example/boat-multiple-executions/src/main/resources/presentation-client-api/openapi.yaml new file mode 100644 index 000000000..eed41ab6d --- /dev/null +++ b/boat-maven-plugin/src/it/example/boat-multiple-executions/src/main/resources/presentation-client-api/openapi.yaml @@ -0,0 +1,1223 @@ +openapi: 3.0.3 +info: + title: Wallet Test Client API + description: No description available + version: 2.19.0 +servers: +- url: /artifact-service/ + description: The server +tags: +- name: wallet test client api +paths: + /client-api/v1/wallet/paymentcards: + summary: Payment Cards + description: No description available + get: + tags: + - wallet + summary: "Returns available payment card details for user, optionally filtered\ + \ by nameOnCard." + description: "Returns available payment card details for user, optionally filtered\ + \ by nameOnCard" + operationId: getPaymentCards + parameters: + - name: nameOnCard + in: query + description: "Filter by the cardholder's name (case-insensitive), can be the\ + \ first one or more characters of one of the words/names" + required: false + schema: + type: string + examples: + example: + summary: example + value: Smi + - name: dateTimeOnly + in: query + description: Creation date in datetime-only format + required: false + schema: + type: string + format: date-time + examples: + example: + summary: example + value: 2017-10-04T14:54:36 + - name: dateTime + in: query + description: Creation date in Zoned RFC3339 Date-time format + required: false + schema: + type: string + format: date-time + examples: + example: + summary: example + value: 2017-10-04T14:54:36Z + - name: dateTime2616 + in: query + description: Zoned RFC2616 Date-time param example + required: false + schema: + type: string + format: date-time + examples: + example: + summary: example + value: "Wed, 4 Jul 2001 12:08:56 PDT" + - name: date + in: query + description: Date-only param example + required: false + schema: + type: string + format: date + examples: + example: + summary: example + value: 2017-10-04 + - name: time + in: query + description: time-only param example + required: false + schema: + type: string + format: date-time + examples: + example: + summary: example + value: 14:54:36 + - name: orderBy + in: query + description: "Order by field: nameOnCard\n" + required: false + schema: + type: string + examples: + example: + summary: example + - name: direction + in: query + description: Direction + required: false + schema: + type: string + default: DESC + enum: + - ASC + - DESC + examples: + example: + summary: example + responses: + "200": + description: No description available + content: + application/json: + schema: + $ref: '#/components/schemas/PaymentCards' + examples: + example: + value: "[ {\n \"id\" : \"a5b0fe7d-c4dd-40a7-bd80-dfc7869327e1\"\ + ,\n \"pan\" : \"5434111122223333\",\n \"cvc\" : \"123\",\n \ + \ \"startDate\" : \"0116\",\n \"expiryDate\" : \"1219\",\n \"\ + nameOnCard\" : \"Mr Timmy Tester\",\n \"creationDate\" : \"2011-05-30T12:13:14+03:00\"\ + ,\n \"balance\" : {\n \"amount\" : \"2001\",\n \"currencyCode\"\ + \ : \"EUR\"\n },\n \"apr\" : 12.75\n}, {\n \"id\" : \"d593c212-70ad-41a6-a547-d5d9232414cb\"\ + ,\n \"pan\" : \"5434111122224444\",\n \"cvc\" : \"101\",\n \ + \ \"startDate\" : \"0216\",\n \"expiryDate\" : \"0120\",\n \"\ + nameOnCard\" : \"Mr Timmothy Tester\",\n \"creationDate\" : \"\ + 2011-05-30T12:13:14+03:00\",\n \"balance\" : {\n \"amount\"\ + \ : \"4.4399999999999995\",\n \"currencyCode\" : \"GBP\"\n\ + \ },\n \"apr\" : 12.75\n}, {\n \"id\" : \"9635966b-28e9-4479-8121-bb7bc9beeb62\"\ + ,\n \"pan\" : \"5434121212121212\",\n \"cvc\" : \"121\",\n \ + \ \"startDate\" : \"0115\",\n \"expiryDate\" : \"1218\",\n \"\ + nameOnCard\" : \"Mr Timmy Tester\",\n \"creationDate\" : \"2011-05-30T12:13:14+03:00\"\ + ,\n \"balance\" : {\n \"amount\" : \"1981\",\n \"currencyCode\"\ + \ : \"EUR\"\n },\n \"apr\" : 12.75\n} ]" + "400": + description: BadRequest + content: + application/json: + schema: + $ref: '#/components/schemas/BadRequestError' + examples: + example: + value: "{\n \"message\" : \"Bad Request\",\n \"errors\" : [ {\n\ + \ \"message\" : \"Value Exceeded. Must be between {min} and\ + \ {max}.\",\n \"key\" : \"common.api.shoesize\",\n \"context\"\ + \ : {\n \"max\" : \"50\",\n \"min\" : \"1\"\n }\n\ + \ } ]\n}" + "406": + description: NotAcceptable + content: + application/json: + schema: + $ref: '#/components/schemas/NotAcceptableError' + examples: + example: + value: "{\n \"message\" : \"Could not find acceptable representation\"\ + ,\n \"supportedMediaTypes\" : [ \"application/json\" ]\n}" + "500": + description: InternalServerError + content: + application/json: + schema: + $ref: '#/components/schemas/InternalServerError' + examples: + example: + value: "{\n \"message\" : \"Description of error\"\n}" + "403": + description: Forbidden + content: + application/json: + schema: + $ref: '#/components/schemas/ForbiddenError' + examples: + example: + value: "{\n \"message\" : \"Access to requested resource denied.\"\ + ,\n \"errors\" : [ {\n \"message\" : \"Resource access denied\ + \ due to an insufficient user quota of {quota}.\",\n \"key\"\ + \ : \"common.api.quota\",\n \"context\" : {\n \"quota\"\ + \ : \"someQuota\"\n }\n } ]\n}" + "415": + description: UnsupportedMediaType + content: + application/json: + schema: + $ref: '#/components/schemas/UnsupportedMediaTypeError' + examples: + example: + value: "{\n \"message\" : \"Unsupported media type.\",\n \"errors\"\ + \ : [ {\n \"message\" : \"The request entity has a media type\ + \ {mediaType} which the resource does not support.\",\n \"\ + key\" : \"common.api.mediaType\",\n \"context\" : {\n \ + \ \"mediaType\" : \"application/javascript\"\n }\n } ]\n}" + "404": + description: NotFound + content: + application/json: + schema: + $ref: '#/components/schemas/NotFoundError' + examples: + example: + value: "{\n \"message\" : \"Resource not found.\",\n \"errors\"\ + \ : [ {\n \"message\" : \"Unable to find the resource requested\ + \ resource: {resource}.\",\n \"key\" : \"common.api.resource\"\ + ,\n \"context\" : {\n \"resource\" : \"aResource\"\n \ + \ }\n } ]\n}" + "401": + description: Unauthorized + content: + application/json: + schema: + $ref: '#/components/schemas/UnauthorizedAltError' + examples: + example: + value: "{\n \"message\" : \"Access to requested resource denied.\"\ + ,\n \"errors\" : [ {\n \"message\" : \"Resource access denied\ + \ due to invalid credentials.\",\n \"key\" : \"common.api.token\"\ + ,\n \"context\" : {\n \"accessToken\" : \"expired\"\n\ + \ }\n } ]\n}" + x-bb-access-control-resource: WALLET + x-bb-access-control-function: MANAGE_PAYMENT_CARDS + x-bb-access-control-privilege: READ_PAYMENT_CARD + post: + tags: + - wallet + summary: Adds a payment card to the user's wallet. + description: Adds a payment card to the user's wallet + operationId: postPaymentCards + parameters: + - name: X-Request-Id + in: header + description: Correlates HTTP requests between a client and server. + required: false + schema: + type: string + examples: + example: + summary: example + value: f058ebd6-02f7-4d3f-942e-904344e8cde5 + requestBody: + description: Adds a payment card to the user's wallet + content: + application/json: + schema: + $ref: '#/components/schemas/PaymentCard' + examples: + example: + value: "{\n \"id\" : \"a5b0fe7d-c4dd-40a7-bd80-dfc7869327e1\",\n\ + \ \"pan\" : \"5434111122223333\",\n \"cvc\" : \"123\",\n \"startDate\"\ + \ : \"0116\",\n \"expiryDate\" : \"1219\",\n \"nameOnCard\" :\ + \ \"Mr Timmy Tester\",\n \"creationDate\" : \"2011-05-30T12:13:14+03:00\"\ + ,\n \"balance\" : {\n \"amount\" : \"1000\",\n \"currencyCode\"\ + \ : \"EUR\"\n },\n \"apr\" : 12.75\n}" + responses: + "201": + description: request to create payment card accepted + content: + application/json: + schema: + $ref: '#/components/schemas/PaymentCardsPostResponseBody' + examples: + example: + value: "{\n \"id\" : \"a5b0fe7d-c4dd-40a7-bd80-dfc7869327e1\"\n\ + }" + "400": + description: BadRequest + content: + application/json: + schema: + $ref: '#/components/schemas/BadRequestError' + examples: + example: + value: "{\n \"message\" : \"Bad Request\",\n \"errors\" : [ {\n\ + \ \"message\" : \"Value Exceeded. Must be between {min} and\ + \ {max}.\",\n \"key\" : \"common.api.shoesize\",\n \"context\"\ + \ : {\n \"max\" : \"50\",\n \"min\" : \"1\"\n }\n\ + \ } ]\n}" + "500": + description: InternalServerError + content: + application/json: + schema: + $ref: '#/components/schemas/InternalServerError' + examples: + example: + value: "{\n \"message\" : \"Description of error\"\n}" + "403": + description: Forbidden + content: + application/json: + schema: + $ref: '#/components/schemas/ForbiddenError' + examples: + example: + value: "{\n \"message\" : \"Access to requested resource denied.\"\ + ,\n \"errors\" : [ {\n \"message\" : \"Resource access denied\ + \ due to an insufficient user quota of {quota}.\",\n \"key\"\ + \ : \"common.api.quota\",\n \"context\" : {\n \"quota\"\ + \ : \"someQuota\"\n }\n } ]\n}" + "415": + description: UnsupportedMediaType + content: + application/json: + schema: + $ref: '#/components/schemas/UnsupportedMediaTypeError' + examples: + example: + value: "{\n \"message\" : \"Unsupported media type.\",\n \"errors\"\ + \ : [ {\n \"message\" : \"The request entity has a media type\ + \ {mediaType} which the resource does not support.\",\n \"\ + key\" : \"common.api.mediaType\",\n \"context\" : {\n \ + \ \"mediaType\" : \"application/javascript\"\n }\n } ]\n}" + "404": + description: NotFound + content: + application/json: + schema: + $ref: '#/components/schemas/NotFoundError' + examples: + example: + value: "{\n \"message\" : \"Resource not found.\",\n \"errors\"\ + \ : [ {\n \"message\" : \"Unable to find the resource requested\ + \ resource: {resource}.\",\n \"key\" : \"common.api.resource\"\ + ,\n \"context\" : {\n \"resource\" : \"aResource\"\n \ + \ }\n } ]\n}" + "401": + description: Unauthorized + content: + application/json: + schema: + $ref: '#/components/schemas/UnauthorizedAltError' + examples: + example: + value: "{\n \"message\" : \"Access to requested resource denied.\"\ + ,\n \"errors\" : [ {\n \"message\" : \"Resource access denied\ + \ due to invalid credentials.\",\n \"key\" : \"common.api.token\"\ + ,\n \"context\" : {\n \"accessToken\" : \"expired\"\n\ + \ }\n } ]\n}" + x-bb-access-control-resource: WALLET + x-bb-access-control-function: MANAGE_PAYMENT_CARDS + x-bb-access-control-privilege: WRITE_PAYMENT_CARD + /client-api/v1/wallet/paymentcards/{cardId}: + summary: Payment Card + description: No description available + get: + tags: + - wallet + summary: Returns details of a specific payment card. + description: Returns details of a specific payment card + operationId: getPaymentCard + responses: + "200": + description: No description available + content: + application/json: + schema: + $ref: '#/components/schemas/PaymentCard' + examples: + example: + value: "{\n \"id\" : \"a5b0fe7d-c4dd-40a7-bd80-dfc7869327e1\",\n\ + \ \"pan\" : \"5434111122223333\",\n \"cvc\" : \"123\",\n \"\ + startDate\" : \"0116\",\n \"expiryDate\" : \"1219\",\n \"nameOnCard\"\ + \ : \"Mr Timmy Tester\",\n \"creationDate\" : \"2011-05-30T12:13:14+03:00\"\ + ,\n \"balance\" : {\n \"amount\" : \"1000\",\n \"currencyCode\"\ + \ : \"EUR\"\n },\n \"apr\" : 12.75\n}" + "400": + description: BadRequest + content: + application/json: + schema: + $ref: '#/components/schemas/BadRequestError' + examples: + example: + value: "{\n \"message\" : \"Bad Request\",\n \"errors\" : [ {\n\ + \ \"message\" : \"Value Exceeded. Must be between {min} and\ + \ {max}.\",\n \"key\" : \"common.api.shoesize\",\n \"context\"\ + \ : {\n \"max\" : \"50\",\n \"min\" : \"1\"\n }\n\ + \ } ]\n}" + "500": + description: InternalServerError + content: + application/json: + schema: + $ref: '#/components/schemas/InternalServerError' + examples: + example: + value: "{\n \"message\" : \"Description of error\"\n}" + "403": + description: Forbidden + content: + application/json: + schema: + $ref: '#/components/schemas/ForbiddenError' + examples: + example: + value: "{\n \"message\" : \"Access to requested resource denied.\"\ + ,\n \"errors\" : [ {\n \"message\" : \"Resource access denied\ + \ due to an insufficient user quota of {quota}.\",\n \"key\"\ + \ : \"common.api.quota\",\n \"context\" : {\n \"quota\"\ + \ : \"someQuota\"\n }\n } ]\n}" + "415": + description: UnsupportedMediaType + content: + application/json: + schema: + $ref: '#/components/schemas/UnsupportedMediaTypeError' + examples: + example: + value: "{\n \"message\" : \"Unsupported media type.\",\n \"errors\"\ + \ : [ {\n \"message\" : \"The request entity has a media type\ + \ {mediaType} which the resource does not support.\",\n \"\ + key\" : \"common.api.mediaType\",\n \"context\" : {\n \ + \ \"mediaType\" : \"application/javascript\"\n }\n } ]\n}" + "404": + description: NotFound + content: + application/json: + schema: + $ref: '#/components/schemas/NotFoundError' + examples: + example: + value: "{\n \"message\" : \"Resource not found.\",\n \"errors\"\ + \ : [ {\n \"message\" : \"Unable to find the resource requested\ + \ resource: {resource}.\",\n \"key\" : \"common.api.resource\"\ + ,\n \"context\" : {\n \"resource\" : \"aResource\"\n \ + \ }\n } ]\n}" + "401": + description: Unauthorized + content: + application/json: + schema: + $ref: '#/components/schemas/UnauthorizedAltError' + examples: + example: + value: "{\n \"message\" : \"Access to requested resource denied.\"\ + ,\n \"errors\" : [ {\n \"message\" : \"Resource access denied\ + \ due to invalid credentials.\",\n \"key\" : \"common.api.token\"\ + ,\n \"context\" : {\n \"accessToken\" : \"expired\"\n\ + \ }\n } ]\n}" + x-bb-access-control-resource: WALLET + x-bb-access-control-function: MANAGE_PAYMENT_CARDS + x-bb-access-control-privilege: READ_PAYMENT_CARD + delete: + tags: + - wallet + summary: Deletes a payment card with a given id. + description: Deletes a payment card with a given id + operationId: deletePaymentCard + responses: + "204": + description: Payment card is succesfully deleted + "400": + description: BadRequest + content: + application/json: + schema: + $ref: '#/components/schemas/BadRequestError' + examples: + example: + value: "{\n \"message\" : \"Bad Request\",\n \"errors\" : [ {\n\ + \ \"message\" : \"Value Exceeded. Must be between {min} and\ + \ {max}.\",\n \"key\" : \"common.api.shoesize\",\n \"context\"\ + \ : {\n \"max\" : \"50\",\n \"min\" : \"1\"\n }\n\ + \ } ]\n}" + "500": + description: InternalServerError + content: + application/json: + schema: + $ref: '#/components/schemas/InternalServerError' + examples: + example: + value: "{\n \"message\" : \"Description of error\"\n}" + "403": + description: Forbidden + content: + application/json: + schema: + $ref: '#/components/schemas/ForbiddenError' + examples: + example: + value: "{\n \"message\" : \"Access to requested resource denied.\"\ + ,\n \"errors\" : [ {\n \"message\" : \"Resource access denied\ + \ due to an insufficient user quota of {quota}.\",\n \"key\"\ + \ : \"common.api.quota\",\n \"context\" : {\n \"quota\"\ + \ : \"someQuota\"\n }\n } ]\n}" + "415": + description: UnsupportedMediaType + content: + application/json: + schema: + $ref: '#/components/schemas/UnsupportedMediaTypeError' + examples: + example: + value: "{\n \"message\" : \"Unsupported media type.\",\n \"errors\"\ + \ : [ {\n \"message\" : \"The request entity has a media type\ + \ {mediaType} which the resource does not support.\",\n \"\ + key\" : \"common.api.mediaType\",\n \"context\" : {\n \ + \ \"mediaType\" : \"application/javascript\"\n }\n } ]\n}" + "404": + description: NotFound + content: + application/json: + schema: + $ref: '#/components/schemas/NotFoundError' + examples: + example: + value: "{\n \"message\" : \"Resource not found.\",\n \"errors\"\ + \ : [ {\n \"message\" : \"Unable to find the resource requested\ + \ resource: {resource}.\",\n \"key\" : \"common.api.resource\"\ + ,\n \"context\" : {\n \"resource\" : \"aResource\"\n \ + \ }\n } ]\n}" + "401": + description: Unauthorized + content: + application/json: + schema: + $ref: '#/components/schemas/UnauthorizedAltError' + examples: + example: + value: "{\n \"message\" : \"Access to requested resource denied.\"\ + ,\n \"errors\" : [ {\n \"message\" : \"Resource access denied\ + \ due to invalid credentials.\",\n \"key\" : \"common.api.token\"\ + ,\n \"context\" : {\n \"accessToken\" : \"expired\"\n\ + \ }\n } ]\n}" + x-bb-access-control-resource: WALLET + x-bb-access-control-function: MANAGE_PAYMENT_CARDS + x-bb-access-control-privilege: DELETE_PAYMENT_CARD + parameters: + - name: cardId + in: path + description: No description available + required: true + schema: + type: string + examples: + example: + summary: example + /client-api/v1/bbt/build-info: + summary: /build-info + description: No description available + get: + tags: + - bbt + summary: Build Information. + description: Build Information + operationId: getBuildinfo + responses: + "200": + description: No description available + content: + application/json: + schema: + $ref: '#/components/schemas/BbtBuild-infoGetGetResponseBody' + examples: + example: + value: "{\n \"build-info\" : {\n \"build.version\" : \"1.1.111-SNAPSHOT\"\ + \n }\n}" + /client-api/v1/patch: + summary: patch + description: PATCH endpoint for test operations + patch: + tags: + - patch + summary: patch + description: Patch Test + operationId: patchpatch + parameters: + - name: X-Request-Id + in: header + description: Correlates HTTP requests between a client and server. + required: false + schema: + type: string + examples: + example: + summary: example + value: f058ebd6-02f7-4d3f-942e-904344e8cde5 + responses: + "200": + description: No description available + content: {} + "400": + description: BadRequest + content: + application/json: + schema: + $ref: '#/components/schemas/BadRequestError' + examples: + example: + value: "{\n \"message\" : \"Bad Request\",\n \"errors\" : [ {\n\ + \ \"message\" : \"Value Exceeded. Must be between {min} and\ + \ {max}.\",\n \"key\" : \"common.api.shoesize\",\n \"context\"\ + \ : {\n \"max\" : \"50\",\n \"min\" : \"1\"\n }\n\ + \ } ]\n}" + "500": + description: InternalServerError + content: + application/json: + schema: + $ref: '#/components/schemas/InternalServerError' + examples: + example: + value: "{\n \"message\" : \"Description of error\"\n}" + "403": + description: Forbidden + content: + application/json: + schema: + $ref: '#/components/schemas/ForbiddenError' + examples: + example: + value: "{\n \"message\" : \"Access to requested resource denied.\"\ + ,\n \"errors\" : [ {\n \"message\" : \"Resource access denied\ + \ due to an insufficient user quota of {quota}.\",\n \"key\"\ + \ : \"common.api.quota\",\n \"context\" : {\n \"quota\"\ + \ : \"someQuota\"\n }\n } ]\n}" + "415": + description: UnsupportedMediaType + content: + application/json: + schema: + $ref: '#/components/schemas/UnsupportedMediaTypeError' + examples: + example: + value: "{\n \"message\" : \"Unsupported media type.\",\n \"errors\"\ + \ : [ {\n \"message\" : \"The request entity has a media type\ + \ {mediaType} which the resource does not support.\",\n \"\ + key\" : \"common.api.mediaType\",\n \"context\" : {\n \ + \ \"mediaType\" : \"application/javascript\"\n }\n } ]\n}" + "404": + description: NotFound + content: + application/json: + schema: + $ref: '#/components/schemas/NotFoundError' + examples: + example: + value: "{\n \"message\" : \"Resource not found.\",\n \"errors\"\ + \ : [ {\n \"message\" : \"Unable to find the resource requested\ + \ resource: {resource}.\",\n \"key\" : \"common.api.resource\"\ + ,\n \"context\" : {\n \"resource\" : \"aResource\"\n \ + \ }\n } ]\n}" + "401": + description: Unauthorized + content: + application/json: + schema: + $ref: '#/components/schemas/UnauthorizedAltError' + examples: + example: + value: "{\n \"message\" : \"Access to requested resource denied.\"\ + ,\n \"errors\" : [ {\n \"message\" : \"Resource access denied\ + \ due to invalid credentials.\",\n \"key\" : \"common.api.token\"\ + ,\n \"context\" : {\n \"accessToken\" : \"expired\"\n\ + \ }\n } ]\n}" + /client-api/v1/test/required-boolean-query-param: + summary: required boolean query param + description: arbitrary tests + get: + tags: + - test + description: No description available + operationId: getrequiredBooleanQueryParam + parameters: + - name: bool + in: query + description: Required boolean parameter with no default value + required: true + schema: + type: boolean + examples: + example: + summary: example + value: false + responses: + "200": + description: No description available + content: + application/json: + schema: + $ref: '#/components/schemas/RequiredbooleanqueryparamGetResponseBody' + "400": + description: BadRequest + content: + application/json: + schema: + $ref: '#/components/schemas/BadRequestError' + examples: + example: + value: "{\n \"message\" : \"Bad Request\",\n \"errors\" : [ {\n\ + \ \"message\" : \"Value Exceeded. Must be between {min} and\ + \ {max}.\",\n \"key\" : \"common.api.shoesize\",\n \"context\"\ + \ : {\n \"max\" : \"50\",\n \"min\" : \"1\"\n }\n\ + \ } ]\n}" + "500": + description: InternalServerError + content: + application/json: + schema: + $ref: '#/components/schemas/InternalServerError' + examples: + example: + value: "{\n \"message\" : \"Description of error\"\n}" + "403": + description: Forbidden + content: + application/json: + schema: + $ref: '#/components/schemas/ForbiddenError' + examples: + example: + value: "{\n \"message\" : \"Access to requested resource denied.\"\ + ,\n \"errors\" : [ {\n \"message\" : \"Resource access denied\ + \ due to an insufficient user quota of {quota}.\",\n \"key\"\ + \ : \"common.api.quota\",\n \"context\" : {\n \"quota\"\ + \ : \"someQuota\"\n }\n } ]\n}" + "415": + description: UnsupportedMediaType + content: + application/json: + schema: + $ref: '#/components/schemas/UnsupportedMediaTypeError' + examples: + example: + value: "{\n \"message\" : \"Unsupported media type.\",\n \"errors\"\ + \ : [ {\n \"message\" : \"The request entity has a media type\ + \ {mediaType} which the resource does not support.\",\n \"\ + key\" : \"common.api.mediaType\",\n \"context\" : {\n \ + \ \"mediaType\" : \"application/javascript\"\n }\n } ]\n}" + "404": + description: NotFound + content: + application/json: + schema: + $ref: '#/components/schemas/NotFoundError' + examples: + example: + value: "{\n \"message\" : \"Resource not found.\",\n \"errors\"\ + \ : [ {\n \"message\" : \"Unable to find the resource requested\ + \ resource: {resource}.\",\n \"key\" : \"common.api.resource\"\ + ,\n \"context\" : {\n \"resource\" : \"aResource\"\n \ + \ }\n } ]\n}" + "401": + description: Unauthorized + content: + application/json: + schema: + $ref: '#/components/schemas/UnauthorizedAltError' + examples: + example: + value: "{\n \"message\" : \"Access to requested resource denied.\"\ + ,\n \"errors\" : [ {\n \"message\" : \"Resource access denied\ + \ due to invalid credentials.\",\n \"key\" : \"common.api.token\"\ + ,\n \"context\" : {\n \"accessToken\" : \"expired\"\n\ + \ }\n } ]\n}" + /client-api/v1/test/values: + summary: Test Values + description: Test Values + get: + tags: + - test + description: No description available + operationId: getTestValues + responses: + "200": + description: No description available + content: + application/json: + schema: + $ref: '#/components/schemas/TestValuesGetResponseBody' + examples: + example: + value: "{\n \"message\" : \"a5b0fe7d-c4dd-40a7-bd80-dfc7869327e1\"\ + ,\n \"number\" : \"102.4\"\n}" + "500": + description: InternalServerError + content: + application/json: + schema: + $ref: '#/components/schemas/InternalServerError' + examples: + example: + value: "{\n \"message\" : \"Description of error\"\n}" + /client-api/v1/test/headers: + summary: Test header propagation + description: Test header propagation + get: + tags: + - test + description: No description available + operationId: getTestHeaderPropagation + parameters: + - name: addHops + in: query + description: number of additional hops to perform + required: false + schema: + type: integer + format: int32 + examples: + example: + summary: example + responses: + "200": + description: No description available + content: + application/json: + schema: + $ref: '#/components/schemas/TestHeadersResponseBody' + examples: + example: + value: "{\n \"requests\" : [ {\n \"name\" : \"building-blocks-test-wallet-presentation-service\"\ + ,\n \"url\" : \"/client-api/v1/test/headers\",\n \"headers\"\ + \ : {\n \"correlation-id\" : [ \"2ed475b714a3945a\" ],\n\ + \ \"accept\" : [ \"application/json\" ],\n \"x-bbt-test\"\ + \ : [ \"X-BBT-contentVal2\" ],\n \"connection\" : [ \"keep-alive\"\ + \ ]\n }\n }, {\n \"name\" : \"building-blocks-test-wallet-pandp-service\"\ + ,\n \"url\" : \"/service-api/v1/test/headers\",\n \"headers\"\ + \ : {\n \"authorization\" : [ \"Bearer eyJh\" ],\n \"\ + accept\" : [ \"application/xml, text/xml, application/json, application/*+xml,\ + \ application/*+json\" ],\n \"content-type\" : [ \"application/json\"\ + \ ],\n \"x-cxt-user-token\" : [ \"Bearer ey\" ],\n \"\ + x-cxt-remote-user\" : [ \"admin\" ],\n \"x-cxt-requestuuid\"\ + \ : [ \"72002652-131a-4f28-bd00-16b8080932f5\" ],\n \"correlation-id\"\ + \ : [ \"2ed475b714a3945a\" ],\n \"x-bbt-test\" : [ \"X-BBT-contentVal2\"\ + \ ]\n }\n }, {\n \"name\" : \"building-blocks-test-wallet-pandp-service\"\ + ,\n \"url\" : \"/service-api/v1/test/headers\",\n \"headers\"\ + \ : {\n \"authorization\" : [ \"Bearer eyJh\" ],\n \"\ + accept\" : [ \"application/xml, text/xml, application/json, application/*+xml,\ + \ application/*+json\" ],\n \"content-type\" : [ \"application/json\"\ + \ ],\n \"x-cxt-user-token\" : [ \"Bearer ey\" ],\n \"\ + x-cxt-remote-user\" : [ \"admin\" ],\n \"x-cxt-requestuuid\"\ + \ : [ \"72002652-131a-4f28-bd00-16b8080932f5\" ],\n \"correlation-id\"\ + \ : [ \"2ed475b714a3945a\" ],\n \"x-bbt-test\" : [ \"X-BBT-contentVal2\"\ + \ ]\n }\n } ]\n}" + "500": + description: InternalServerError + content: + application/json: + schema: + $ref: '#/components/schemas/InternalServerError' + examples: + example: + value: "{\n \"message\" : \"Description of error\"\n}" + /client-api/v1/test/date-query-params: + summary: dateQueryParam + description: | + Tests for date/time query parameters in service-apis. Sends the same query parameters to the equivalent endpoint + in the pandp service which echoes the given values back in the response body. Values echoed by the pandp service + are then returned in the response to this request. + get: + tags: + - test + description: No description available + operationId: getdateQueryParam + parameters: + - name: dateTimeOnly + in: query + description: Creation date in datetime-only format + required: false + schema: + type: string + format: date-time + examples: + example: + summary: example + value: 2017-10-04T14:54:36 + - name: dateTime + in: query + description: Creation date in Zoned RFC3339 Date-time format + required: false + schema: + type: string + format: date-time + examples: + example: + summary: example + value: 2017-10-04T14:54:36Z + - name: dateTime2616 + in: query + description: Zoned RFC2616 Date-time param example + required: false + schema: + type: string + format: date-time + examples: + example: + summary: example + value: "Wed, 4 Jul 2001 12:08:56 PDT" + - name: date + in: query + description: Date-only param example + required: false + schema: + type: string + format: date + examples: + example: + summary: example + value: 2017-10-04 + - name: time + in: query + description: time-only param example + required: false + schema: + type: string + format: date-time + examples: + example: + summary: example + value: 14:54:36 + responses: + "200": + description: No description available + content: + application/json: + schema: + $ref: '#/components/schemas/DateQueryParamGetResponseBody' +components: + schemas: + BadRequestError: + required: + - message + type: object + properties: + message: + type: string + description: Any further information + errors: + type: array + description: Detailed error information + items: + $ref: '#/components/schemas/ErrorItem' + BbAccessControl: + required: + - function + - privilege + - resource + type: object + properties: + resource: + type: string + description: "Resource being protected, e.g. 'User'" + function: + type: string + description: "Business function, e.g. 'Manage Users'" + privilege: + type: string + description: "The privilege required, e.g. 'view'" + BbApiDeprecation: + required: + - deprecatedFromVersion + - description + - reason + - removedFromVersion + type: object + properties: + deprecatedFromVersion: + type: string + description: Version of the product from which the endpoint has been deprecated + and should no longer be used + deprecated: true + removedFromVersion: + type: string + description: Version of the product from which the API endpoint will be + removed + reason: + type: string + description: The reason the API endpoint was deprecated + deprecated: true + description: + type: string + description: "Any further information, e.g. migration information" + BbtBuild-infoGetGetResponseBody: + type: object + properties: + build-info: + type: object + example: + build-info: + build.version: 1.1.111-SNAPSHOT + BbtbuildInfogetgetresponsebody: + type: object + properties: + build-info: + type: object + example: + build-info: + build.version: 1.1.111-SNAPSHOT + Currency: + title: Monetary Amount + required: + - amount + - currencyCode + type: object + properties: + amount: + type: string + description: The amount in the specified currency + currencyCode: + pattern: "^[A-Z]{3}$" + type: string + description: The alpha-3 code (complying with ISO 4217) of the currency + that qualifies the amount + description: Schema defining monetary amount in given currency. + DateQueryParamGetResponseBody: + type: object + properties: + dateTimeOnly: + type: string + dateTimeOnlyParsedValue: + type: string + dateTime: + type: string + dateTimeParsedValue: + type: string + dateTime2616: + type: string + dateTime2616ParsedValue: + type: string + date: + type: string + dateParsedValue: + type: string + time: + type: string + timeParsedValue: + type: string + formatDateTime: + type: string + description: "The dateTime parameter formatted as 'date-time', java.util.Date\ + \ or java.time.ZoneDateTime" + format: date-time + formatDate: + type: string + description: "The date parameter formatted as 'date', String or java.time.LocalDate" + format: date + formatTime: + type: string + description: "The time parameter formatted as 'time', String or java.time.LocalTime" + formatUtcMillisec: + type: string + description: "The dateTime parameter formatted as 'date', long" + ErrorItem: + type: object + properties: + message: + type: string + description: Default Message. Any further information. + key: + type: string + description: "{capability-name}.api.{api-key-name}. For generated validation\ + \ errors this is the path in the document the error resolves to. e.g.\ + \ object name + '.' + field" + context: + type: object + description: Context can be anything used to construct localised messages. + description: A validation error + ForbiddenError: + type: object + properties: + message: + type: string + description: Any further information + errors: + type: array + description: Detailed error information + items: + $ref: '#/components/schemas/ErrorItem' + InternalServerError: + required: + - message + type: object + properties: + message: + type: string + description: Further Information + description: Represents HTTP 500 Internal Server Error + NotAcceptableError: + type: object + properties: + message: + type: string + supportedMediaTypes: + type: array + description: List of supported media types for this endpoint + items: + type: string + NotFoundError: + type: object + properties: + message: + type: string + description: Any further information + errors: + type: array + description: Detailed error information + items: + $ref: '#/components/schemas/ErrorItem' + ObjectWrappingException: + type: object + properties: + message: + type: string + data: + type: object + PaymentCard: + required: + - cvc + - expiryDate + - id + - nameOnCard + - pan + - startDate + type: object + properties: + id: + type: string + pan: + maxLength: 19 + type: string + description: "Must be sixteen digits, optionally in blocks of 4 separated\ + \ by a dash" + cvc: + maxLength: 3 + minLength: 3 + type: string + description: Card Verification Code + startDate: + pattern: "^(0[1-9]|1[0-2])/?([0-9]{4}|[0-9]{2})$" + type: string + description: "Must be in one of these four formats: MM/YY MMYY MMYYYY MM/YYYY" + expiryDate: + pattern: "^(0[1-9]|1[0-2])/?([0-9]{4}|[0-9]{2})$" + type: string + description: "Must be in one of these four formats: MM/YY MMYY MMYYYY MM/YYYY" + nameOnCard: + type: string + creationDate: + type: string + format: date-time + balance: + $ref: '#/components/schemas/Currency' + apr: + type: number + cardtype: + type: string + enum: + - CREDIT + - DEBIT + - PREPAID + PaymentCards: + type: array + items: + $ref: '#/components/schemas/PaymentCard' + PaymentCardsPostResponseBody: + type: object + properties: + id: + type: string + example: + id: a5b0fe7d-c4dd-40a7-bd80-dfc7869327e1 + RequiredbooleanqueryparamGetResponseBody: + type: object + properties: + message: + type: string + TestHeadersResponseBody: + type: object + properties: + requests: + type: array + items: + type: object + properties: + name: + type: string + url: + type: string + headers: + type: object + TestValuesGetResponseBody: + type: object + properties: + message: + type: string + number: + type: string + example: + message: a5b0fe7d-c4dd-40a7-bd80-dfc7869327e1 + number: "102.4" + UnauthorizedAltError: + type: object + properties: + message: + type: string + description: Any further information + errors: + type: array + description: Detailed error information + items: + $ref: '#/components/schemas/ErrorItem' + UnauthorizedError: + required: + - message + type: object + properties: + message: + type: string + UnsupportedMediaTypeError: + type: object + properties: + message: + type: string + description: Any further information + errors: + type: array + description: Detailed error information + items: + $ref: '#/components/schemas/ErrorItem' diff --git a/boat-maven-plugin/src/it/example/boat-multiple-executions/src/main/resources/presentation-integration-api/index.html b/boat-maven-plugin/src/it/example/boat-multiple-executions/src/main/resources/presentation-integration-api/index.html new file mode 100644 index 000000000..ef9076b62 --- /dev/null +++ b/boat-maven-plugin/src/it/example/boat-multiple-executions/src/main/resources/presentation-integration-api/index.html @@ -0,0 +1,24 @@ + + + + Example + + + + + + + + + + + + + \ No newline at end of file diff --git a/boat-maven-plugin/src/it/example/boat-multiple-executions/src/main/resources/presentation-integration-api/openapi.yaml b/boat-maven-plugin/src/it/example/boat-multiple-executions/src/main/resources/presentation-integration-api/openapi.yaml new file mode 100644 index 000000000..bf69079bf --- /dev/null +++ b/boat-maven-plugin/src/it/example/boat-multiple-executions/src/main/resources/presentation-integration-api/openapi.yaml @@ -0,0 +1,48 @@ +openapi: 3.0.3 +info: + title: Example + description: | + # Example + Test Schema to test an integration-api + version: 2.19.0 +servers: +- url: /artifact-service/ + description: The server +tags: +- name: example +paths: + /integration-api/v1/items: + summary: items + description: Retrieve all items. + get: + tags: + - items + summary: Retrieve list of all items. + description: Retrieve list of all items. + operationId: getitems + responses: + "200": + description: Test Schema + content: + application/json: + schema: + $ref: '#/components/schemas/ItemsGetResponseBody' + examples: + example: + value: "{\n \"name\" : \"Example\",\n \"description\" : \"Example\ + \ description\"\n}" +components: + schemas: + ItemsGetResponseBody: + required: + - name + type: object + properties: + name: + type: string + description: + type: string + description: this models a simple item. + example: + name: Example + description: Example description diff --git a/boat-maven-plugin/src/it/example/boat-multiple-executions/src/main/resources/presentation-service-api/index.html b/boat-maven-plugin/src/it/example/boat-multiple-executions/src/main/resources/presentation-service-api/index.html new file mode 100644 index 000000000..c9863ec40 --- /dev/null +++ b/boat-maven-plugin/src/it/example/boat-multiple-executions/src/main/resources/presentation-service-api/index.html @@ -0,0 +1,24 @@ + + + + Wallet Test Service API + + + + + + + + + + + + + \ No newline at end of file diff --git a/boat-maven-plugin/src/it/example/boat-multiple-executions/src/main/resources/presentation-service-api/openapi.yaml b/boat-maven-plugin/src/it/example/boat-multiple-executions/src/main/resources/presentation-service-api/openapi.yaml new file mode 100644 index 000000000..5a2175c02 --- /dev/null +++ b/boat-maven-plugin/src/it/example/boat-multiple-executions/src/main/resources/presentation-service-api/openapi.yaml @@ -0,0 +1,885 @@ +openapi: 3.0.3 +info: + title: Wallet Test Service API + description: No description available + version: 2.19.0 +servers: +- url: /artifact-service/ + description: The server +tags: +- name: wallet test service api +paths: + /service-api/v1/wallet/admin/{userId}/paymentcards: + summary: Payment Cards + description: No description available + get: + tags: + - wallet + summary: "Returns available payment card details for user, optionally filtered\ + \ by nameOnCard." + description: "Returns available payment card details for user, optionally filtered\ + \ by nameOnCard" + operationId: getPaymentCards + parameters: + - name: nameOnCard + in: query + description: "Filter by the cardholder's name (case-insensitive), can be the\ + \ first one or more characters of one of the words/names" + required: false + schema: + type: string + examples: + example: + summary: example + value: Smi + - name: dateTimeOnly + in: query + description: Creation date in datetime-only format + required: false + schema: + type: string + format: date-time + examples: + example: + summary: example + value: 2017-10-04T14:54:36 + - name: dateTime + in: query + description: Creation date in Zoned RFC3339 Date-time format + required: false + schema: + type: string + format: date-time + examples: + example: + summary: example + value: 2017-10-04T14:54:36Z + - name: dateTime2616 + in: query + description: Zoned RFC2616 Date-time param example + required: false + schema: + type: string + format: date-time + examples: + example: + summary: example + value: "Wed, 4 Jul 2001 12:08:56 PDT" + - name: date + in: query + description: Date-only param example + required: false + schema: + type: string + format: date + examples: + example: + summary: example + value: 2017-10-04 + - name: time + in: query + description: time-only param example + required: false + schema: + type: string + format: date-time + examples: + example: + summary: example + value: 14:54:36 + - name: orderBy + in: query + description: "Order by field: nameOnCard\n" + required: false + schema: + type: string + examples: + example: + summary: example + - name: direction + in: query + description: Direction + required: false + schema: + type: string + default: DESC + enum: + - ASC + - DESC + examples: + example: + summary: example + responses: + "200": + description: No description available + content: + application/json: + schema: + $ref: '#/components/schemas/PaymentCards' + examples: + example: + value: "[ {\n \"id\" : \"a5b0fe7d-c4dd-40a7-bd80-dfc7869327e1\"\ + ,\n \"pan\" : \"5434111122223333\",\n \"cvc\" : \"123\",\n \ + \ \"startDate\" : \"0116\",\n \"expiryDate\" : \"1219\",\n \"\ + nameOnCard\" : \"Mr Timmy Tester\",\n \"creationDate\" : \"2011-05-30T12:13:14+03:00\"\ + ,\n \"balance\" : {\n \"amount\" : \"2001\",\n \"currencyCode\"\ + \ : \"EUR\"\n },\n \"apr\" : 12.75\n}, {\n \"id\" : \"d593c212-70ad-41a6-a547-d5d9232414cb\"\ + ,\n \"pan\" : \"5434111122224444\",\n \"cvc\" : \"101\",\n \ + \ \"startDate\" : \"0216\",\n \"expiryDate\" : \"0120\",\n \"\ + nameOnCard\" : \"Mr Timmothy Tester\",\n \"creationDate\" : \"\ + 2011-05-30T12:13:14+03:00\",\n \"balance\" : {\n \"amount\"\ + \ : \"4.4399999999999995\",\n \"currencyCode\" : \"GBP\"\n\ + \ },\n \"apr\" : 12.75\n}, {\n \"id\" : \"9635966b-28e9-4479-8121-bb7bc9beeb62\"\ + ,\n \"pan\" : \"5434121212121212\",\n \"cvc\" : \"121\",\n \ + \ \"startDate\" : \"0115\",\n \"expiryDate\" : \"1218\",\n \"\ + nameOnCard\" : \"Mr Timmy Tester\",\n \"creationDate\" : \"2011-05-30T12:13:14+03:00\"\ + ,\n \"balance\" : {\n \"amount\" : \"1981\",\n \"currencyCode\"\ + \ : \"EUR\"\n },\n \"apr\" : 12.75\n} ]" + "400": + description: BadRequest + content: + application/json: + schema: + $ref: '#/components/schemas/BadRequestError' + examples: + example: + value: "{\n \"message\" : \"Bad Request\",\n \"errors\" : [ {\n\ + \ \"message\" : \"Value Exceeded. Must be between {min} and\ + \ {max}.\",\n \"key\" : \"common.api.shoesize\",\n \"context\"\ + \ : {\n \"max\" : \"50\",\n \"min\" : \"1\"\n }\n\ + \ } ]\n}" + "406": + description: NotAcceptable + content: + application/json: + schema: + $ref: '#/components/schemas/NotAcceptableError' + examples: + example: + value: "{\n \"message\" : \"Could not find acceptable representation\"\ + ,\n \"supportedMediaTypes\" : [ \"application/json\" ]\n}" + "500": + description: InternalServerError + content: + application/json: + schema: + $ref: '#/components/schemas/InternalServerError' + examples: + example: + value: "{\n \"message\" : \"Description of error\"\n}" + "403": + description: Forbidden + content: + application/json: + schema: + $ref: '#/components/schemas/ForbiddenError' + examples: + example: + value: "{\n \"message\" : \"Access to requested resource denied.\"\ + ,\n \"errors\" : [ {\n \"message\" : \"Resource access denied\ + \ due to an insufficient user quota of {quota}.\",\n \"key\"\ + \ : \"common.api.quota\",\n \"context\" : {\n \"quota\"\ + \ : \"someQuota\"\n }\n } ]\n}" + "415": + description: UnsupportedMediaType + content: + application/json: + schema: + $ref: '#/components/schemas/UnsupportedMediaTypeError' + examples: + example: + value: "{\n \"message\" : \"Unsupported media type.\",\n \"errors\"\ + \ : [ {\n \"message\" : \"The request entity has a media type\ + \ {mediaType} which the resource does not support.\",\n \"\ + key\" : \"common.api.mediaType\",\n \"context\" : {\n \ + \ \"mediaType\" : \"application/javascript\"\n }\n } ]\n}" + "404": + description: NotFound + content: + application/json: + schema: + $ref: '#/components/schemas/NotFoundError' + examples: + example: + value: "{\n \"message\" : \"Resource not found.\",\n \"errors\"\ + \ : [ {\n \"message\" : \"Unable to find the resource requested\ + \ resource: {resource}.\",\n \"key\" : \"common.api.resource\"\ + ,\n \"context\" : {\n \"resource\" : \"aResource\"\n \ + \ }\n } ]\n}" + "401": + description: Unauthorized + content: + application/json: + schema: + $ref: '#/components/schemas/UnauthorizedAltError' + examples: + example: + value: "{\n \"message\" : \"Access to requested resource denied.\"\ + ,\n \"errors\" : [ {\n \"message\" : \"Resource access denied\ + \ due to invalid credentials.\",\n \"key\" : \"common.api.token\"\ + ,\n \"context\" : {\n \"accessToken\" : \"expired\"\n\ + \ }\n } ]\n}" + post: + tags: + - wallet + summary: Adds a payment card to the user's wallet. + description: Adds a payment card to the user's wallet + operationId: postPaymentCards + parameters: + - name: X-Request-Id + in: header + description: Correlates HTTP requests between a client and server. + required: false + schema: + type: string + examples: + example: + summary: example + value: f058ebd6-02f7-4d3f-942e-904344e8cde5 + requestBody: + description: Adds a payment card to the user's wallet + content: + application/json: + schema: + $ref: '#/components/schemas/PaymentCard' + examples: + example: + value: "{\n \"id\" : \"a5b0fe7d-c4dd-40a7-bd80-dfc7869327e1\",\n\ + \ \"pan\" : \"5434111122223333\",\n \"cvc\" : \"123\",\n \"startDate\"\ + \ : \"0116\",\n \"expiryDate\" : \"1219\",\n \"nameOnCard\" :\ + \ \"Mr Timmy Tester\",\n \"creationDate\" : \"2011-05-30T12:13:14+03:00\"\ + ,\n \"balance\" : {\n \"amount\" : \"1000\",\n \"currencyCode\"\ + \ : \"EUR\"\n },\n \"apr\" : 12.75\n}" + responses: + "201": + description: request to create payment card accepted + content: + application/json: + schema: + $ref: '#/components/schemas/PaymentCardsPostResponseBody' + examples: + example: + value: "{\n \"id\" : \"a5b0fe7d-c4dd-40a7-bd80-dfc7869327e1\"\n\ + }" + "400": + description: BadRequest + content: + application/json: + schema: + $ref: '#/components/schemas/BadRequestError' + examples: + example: + value: "{\n \"message\" : \"Bad Request\",\n \"errors\" : [ {\n\ + \ \"message\" : \"Value Exceeded. Must be between {min} and\ + \ {max}.\",\n \"key\" : \"common.api.shoesize\",\n \"context\"\ + \ : {\n \"max\" : \"50\",\n \"min\" : \"1\"\n }\n\ + \ } ]\n}" + "500": + description: InternalServerError + content: + application/json: + schema: + $ref: '#/components/schemas/InternalServerError' + examples: + example: + value: "{\n \"message\" : \"Description of error\"\n}" + "403": + description: Forbidden + content: + application/json: + schema: + $ref: '#/components/schemas/ForbiddenError' + examples: + example: + value: "{\n \"message\" : \"Access to requested resource denied.\"\ + ,\n \"errors\" : [ {\n \"message\" : \"Resource access denied\ + \ due to an insufficient user quota of {quota}.\",\n \"key\"\ + \ : \"common.api.quota\",\n \"context\" : {\n \"quota\"\ + \ : \"someQuota\"\n }\n } ]\n}" + "415": + description: UnsupportedMediaType + content: + application/json: + schema: + $ref: '#/components/schemas/UnsupportedMediaTypeError' + examples: + example: + value: "{\n \"message\" : \"Unsupported media type.\",\n \"errors\"\ + \ : [ {\n \"message\" : \"The request entity has a media type\ + \ {mediaType} which the resource does not support.\",\n \"\ + key\" : \"common.api.mediaType\",\n \"context\" : {\n \ + \ \"mediaType\" : \"application/javascript\"\n }\n } ]\n}" + "404": + description: NotFound + content: + application/json: + schema: + $ref: '#/components/schemas/NotFoundError' + examples: + example: + value: "{\n \"message\" : \"Resource not found.\",\n \"errors\"\ + \ : [ {\n \"message\" : \"Unable to find the resource requested\ + \ resource: {resource}.\",\n \"key\" : \"common.api.resource\"\ + ,\n \"context\" : {\n \"resource\" : \"aResource\"\n \ + \ }\n } ]\n}" + "401": + description: Unauthorized + content: + application/json: + schema: + $ref: '#/components/schemas/UnauthorizedAltError' + examples: + example: + value: "{\n \"message\" : \"Access to requested resource denied.\"\ + ,\n \"errors\" : [ {\n \"message\" : \"Resource access denied\ + \ due to invalid credentials.\",\n \"key\" : \"common.api.token\"\ + ,\n \"context\" : {\n \"accessToken\" : \"expired\"\n\ + \ }\n } ]\n}" + parameters: + - name: userId + in: path + description: No description available + required: true + schema: + type: string + examples: + example: + summary: example + /service-api/v1/wallet/admin/{userId}/paymentcards/{cardId}: + summary: Payment Card + description: No description available + get: + tags: + - wallet + summary: Returns details of a specific payment card. + description: Returns details of a specific payment card + operationId: getPaymentCard + responses: + "200": + description: No description available + content: + application/json: + schema: + $ref: '#/components/schemas/PaymentCard' + examples: + example: + value: "{\n \"id\" : \"a5b0fe7d-c4dd-40a7-bd80-dfc7869327e1\",\n\ + \ \"pan\" : \"5434111122223333\",\n \"cvc\" : \"123\",\n \"\ + startDate\" : \"0116\",\n \"expiryDate\" : \"1219\",\n \"nameOnCard\"\ + \ : \"Mr Timmy Tester\",\n \"creationDate\" : \"2011-05-30T12:13:14+03:00\"\ + ,\n \"balance\" : {\n \"amount\" : \"1000\",\n \"currencyCode\"\ + \ : \"EUR\"\n },\n \"apr\" : 12.75\n}" + "400": + description: BadRequest + content: + application/json: + schema: + $ref: '#/components/schemas/BadRequestError' + examples: + example: + value: "{\n \"message\" : \"Bad Request\",\n \"errors\" : [ {\n\ + \ \"message\" : \"Value Exceeded. Must be between {min} and\ + \ {max}.\",\n \"key\" : \"common.api.shoesize\",\n \"context\"\ + \ : {\n \"max\" : \"50\",\n \"min\" : \"1\"\n }\n\ + \ } ]\n}" + "500": + description: InternalServerError + content: + application/json: + schema: + $ref: '#/components/schemas/InternalServerError' + examples: + example: + value: "{\n \"message\" : \"Description of error\"\n}" + "403": + description: Forbidden + content: + application/json: + schema: + $ref: '#/components/schemas/ForbiddenError' + examples: + example: + value: "{\n \"message\" : \"Access to requested resource denied.\"\ + ,\n \"errors\" : [ {\n \"message\" : \"Resource access denied\ + \ due to an insufficient user quota of {quota}.\",\n \"key\"\ + \ : \"common.api.quota\",\n \"context\" : {\n \"quota\"\ + \ : \"someQuota\"\n }\n } ]\n}" + "415": + description: UnsupportedMediaType + content: + application/json: + schema: + $ref: '#/components/schemas/UnsupportedMediaTypeError' + examples: + example: + value: "{\n \"message\" : \"Unsupported media type.\",\n \"errors\"\ + \ : [ {\n \"message\" : \"The request entity has a media type\ + \ {mediaType} which the resource does not support.\",\n \"\ + key\" : \"common.api.mediaType\",\n \"context\" : {\n \ + \ \"mediaType\" : \"application/javascript\"\n }\n } ]\n}" + "404": + description: NotFound + content: + application/json: + schema: + $ref: '#/components/schemas/NotFoundError' + examples: + example: + value: "{\n \"message\" : \"Resource not found.\",\n \"errors\"\ + \ : [ {\n \"message\" : \"Unable to find the resource requested\ + \ resource: {resource}.\",\n \"key\" : \"common.api.resource\"\ + ,\n \"context\" : {\n \"resource\" : \"aResource\"\n \ + \ }\n } ]\n}" + "401": + description: Unauthorized + content: + application/json: + schema: + $ref: '#/components/schemas/UnauthorizedAltError' + examples: + example: + value: "{\n \"message\" : \"Access to requested resource denied.\"\ + ,\n \"errors\" : [ {\n \"message\" : \"Resource access denied\ + \ due to invalid credentials.\",\n \"key\" : \"common.api.token\"\ + ,\n \"context\" : {\n \"accessToken\" : \"expired\"\n\ + \ }\n } ]\n}" + delete: + tags: + - wallet + summary: Deletes a payment card with a given id. + description: Deletes a payment card with a given id + operationId: deletePaymentCard + responses: + "204": + description: Payment card is succesfully deleted + "400": + description: BadRequest + content: + application/json: + schema: + $ref: '#/components/schemas/BadRequestError' + examples: + example: + value: "{\n \"message\" : \"Bad Request\",\n \"errors\" : [ {\n\ + \ \"message\" : \"Value Exceeded. Must be between {min} and\ + \ {max}.\",\n \"key\" : \"common.api.shoesize\",\n \"context\"\ + \ : {\n \"max\" : \"50\",\n \"min\" : \"1\"\n }\n\ + \ } ]\n}" + "500": + description: InternalServerError + content: + application/json: + schema: + $ref: '#/components/schemas/InternalServerError' + examples: + example: + value: "{\n \"message\" : \"Description of error\"\n}" + "403": + description: Forbidden + content: + application/json: + schema: + $ref: '#/components/schemas/ForbiddenError' + examples: + example: + value: "{\n \"message\" : \"Access to requested resource denied.\"\ + ,\n \"errors\" : [ {\n \"message\" : \"Resource access denied\ + \ due to an insufficient user quota of {quota}.\",\n \"key\"\ + \ : \"common.api.quota\",\n \"context\" : {\n \"quota\"\ + \ : \"someQuota\"\n }\n } ]\n}" + "415": + description: UnsupportedMediaType + content: + application/json: + schema: + $ref: '#/components/schemas/UnsupportedMediaTypeError' + examples: + example: + value: "{\n \"message\" : \"Unsupported media type.\",\n \"errors\"\ + \ : [ {\n \"message\" : \"The request entity has a media type\ + \ {mediaType} which the resource does not support.\",\n \"\ + key\" : \"common.api.mediaType\",\n \"context\" : {\n \ + \ \"mediaType\" : \"application/javascript\"\n }\n } ]\n}" + "404": + description: NotFound + content: + application/json: + schema: + $ref: '#/components/schemas/NotFoundError' + examples: + example: + value: "{\n \"message\" : \"Resource not found.\",\n \"errors\"\ + \ : [ {\n \"message\" : \"Unable to find the resource requested\ + \ resource: {resource}.\",\n \"key\" : \"common.api.resource\"\ + ,\n \"context\" : {\n \"resource\" : \"aResource\"\n \ + \ }\n } ]\n}" + "401": + description: Unauthorized + content: + application/json: + schema: + $ref: '#/components/schemas/UnauthorizedAltError' + examples: + example: + value: "{\n \"message\" : \"Access to requested resource denied.\"\ + ,\n \"errors\" : [ {\n \"message\" : \"Resource access denied\ + \ due to invalid credentials.\",\n \"key\" : \"common.api.token\"\ + ,\n \"context\" : {\n \"accessToken\" : \"expired\"\n\ + \ }\n } ]\n}" + parameters: + - name: cardId + in: path + description: No description available + required: true + schema: + type: string + examples: + example: + summary: example + - name: userId + in: path + description: No description available + required: true + schema: + type: string + examples: + example: + summary: example + /service-api/v1/testQuery/required-boolean-query-param: + summary: required boolean query param + description: arbitrary tests + get: + tags: + - testQuery + description: No description available + operationId: getrequiredBooleanQueryParam + parameters: + - name: bool + in: query + description: Required boolean parameter with no default value + required: true + schema: + type: boolean + examples: + example: + summary: example + value: false + responses: + "200": + description: No description available + content: + application/json: + schema: + $ref: '#/components/schemas/RequiredbooleanqueryparamGetResponseBody' + "400": + description: BadRequest + content: + application/json: + schema: + $ref: '#/components/schemas/BadRequestError' + examples: + example: + value: "{\n \"message\" : \"Bad Request\",\n \"errors\" : [ {\n\ + \ \"message\" : \"Value Exceeded. Must be between {min} and\ + \ {max}.\",\n \"key\" : \"common.api.shoesize\",\n \"context\"\ + \ : {\n \"max\" : \"50\",\n \"min\" : \"1\"\n }\n\ + \ } ]\n}" + "500": + description: InternalServerError + content: + application/json: + schema: + $ref: '#/components/schemas/InternalServerError' + examples: + example: + value: "{\n \"message\" : \"Description of error\"\n}" + "403": + description: Forbidden + content: + application/json: + schema: + $ref: '#/components/schemas/ForbiddenError' + examples: + example: + value: "{\n \"message\" : \"Access to requested resource denied.\"\ + ,\n \"errors\" : [ {\n \"message\" : \"Resource access denied\ + \ due to an insufficient user quota of {quota}.\",\n \"key\"\ + \ : \"common.api.quota\",\n \"context\" : {\n \"quota\"\ + \ : \"someQuota\"\n }\n } ]\n}" + "415": + description: UnsupportedMediaType + content: + application/json: + schema: + $ref: '#/components/schemas/UnsupportedMediaTypeError' + examples: + example: + value: "{\n \"message\" : \"Unsupported media type.\",\n \"errors\"\ + \ : [ {\n \"message\" : \"The request entity has a media type\ + \ {mediaType} which the resource does not support.\",\n \"\ + key\" : \"common.api.mediaType\",\n \"context\" : {\n \ + \ \"mediaType\" : \"application/javascript\"\n }\n } ]\n}" + "404": + description: NotFound + content: + application/json: + schema: + $ref: '#/components/schemas/NotFoundError' + examples: + example: + value: "{\n \"message\" : \"Resource not found.\",\n \"errors\"\ + \ : [ {\n \"message\" : \"Unable to find the resource requested\ + \ resource: {resource}.\",\n \"key\" : \"common.api.resource\"\ + ,\n \"context\" : {\n \"resource\" : \"aResource\"\n \ + \ }\n } ]\n}" + "401": + description: Unauthorized + content: + application/json: + schema: + $ref: '#/components/schemas/UnauthorizedAltError' + examples: + example: + value: "{\n \"message\" : \"Access to requested resource denied.\"\ + ,\n \"errors\" : [ {\n \"message\" : \"Resource access denied\ + \ due to invalid credentials.\",\n \"key\" : \"common.api.token\"\ + ,\n \"context\" : {\n \"accessToken\" : \"expired\"\n\ + \ }\n } ]\n}" +components: + schemas: + BadRequestError: + required: + - message + type: object + properties: + message: + type: string + description: Any further information + errors: + type: array + description: Detailed error information + items: + $ref: '#/components/schemas/ErrorItem' + BbAccessControl: + required: + - function + - privilege + - resource + type: object + properties: + resource: + type: string + description: "Resource being protected, e.g. 'User'" + function: + type: string + description: "Business function, e.g. 'Manage Users'" + privilege: + type: string + description: "The privilege required, e.g. 'view'" + BbApiDeprecation: + required: + - deprecatedFromVersion + - description + - reason + - removedFromVersion + type: object + properties: + deprecatedFromVersion: + type: string + description: Version of the product from which the endpoint has been deprecated + and should no longer be used + deprecated: true + removedFromVersion: + type: string + description: Version of the product from which the API endpoint will be + removed + reason: + type: string + description: The reason the API endpoint was deprecated + deprecated: true + description: + type: string + description: "Any further information, e.g. migration information" + Currency: + title: Monetary Amount + required: + - amount + - currencyCode + type: object + properties: + amount: + type: string + description: The amount in the specified currency + currencyCode: + pattern: "^[A-Z]{3}$" + type: string + description: The alpha-3 code (complying with ISO 4217) of the currency + that qualifies the amount + description: Schema defining monetary amount in given currency. + ErrorItem: + type: object + properties: + message: + type: string + description: Default Message. Any further information. + key: + type: string + description: "{capability-name}.api.{api-key-name}. For generated validation\ + \ errors this is the path in the document the error resolves to. e.g.\ + \ object name + '.' + field" + context: + type: object + description: Context can be anything used to construct localised messages. + description: A validation error + ForbiddenError: + type: object + properties: + message: + type: string + description: Any further information + errors: + type: array + description: Detailed error information + items: + $ref: '#/components/schemas/ErrorItem' + InternalServerError: + required: + - message + type: object + properties: + message: + type: string + description: Further Information + description: Represents HTTP 500 Internal Server Error + NotAcceptableError: + type: object + properties: + message: + type: string + supportedMediaTypes: + type: array + description: List of supported media types for this endpoint + items: + type: string + NotFoundError: + type: object + properties: + message: + type: string + description: Any further information + errors: + type: array + description: Detailed error information + items: + $ref: '#/components/schemas/ErrorItem' + ObjectWrappingException: + type: object + properties: + message: + type: string + data: + type: object + PaymentCard: + required: + - cvc + - expiryDate + - id + - nameOnCard + - pan + - startDate + type: object + properties: + id: + type: string + pan: + maxLength: 19 + type: string + description: "Must be sixteen digits, optionally in blocks of 4 separated\ + \ by a dash" + cvc: + maxLength: 3 + minLength: 3 + type: string + description: Card Verification Code + startDate: + pattern: "^(0[1-9]|1[0-2])/?([0-9]{4}|[0-9]{2})$" + type: string + description: "Must be in one of these four formats: MM/YY MMYY MMYYYY MM/YYYY" + expiryDate: + pattern: "^(0[1-9]|1[0-2])/?([0-9]{4}|[0-9]{2})$" + type: string + description: "Must be in one of these four formats: MM/YY MMYY MMYYYY MM/YYYY" + nameOnCard: + type: string + creationDate: + type: string + format: date-time + balance: + $ref: '#/components/schemas/Currency' + apr: + type: number + cardtype: + type: string + enum: + - CREDIT + - DEBIT + - PREPAID + PaymentCards: + type: array + items: + $ref: '#/components/schemas/PaymentCard' + PaymentCardsPostResponseBody: + type: object + properties: + id: + type: string + example: + id: a5b0fe7d-c4dd-40a7-bd80-dfc7869327e1 + RequiredbooleanqueryparamGetResponseBody: + type: object + properties: + message: + type: string + TestHeadersResponseBody: + type: object + properties: + requests: + type: array + items: + type: object + properties: + name: + type: string + url: + type: string + headers: + type: object + UnauthorizedAltError: + type: object + properties: + message: + type: string + description: Any further information + errors: + type: array + description: Detailed error information + items: + $ref: '#/components/schemas/ErrorItem' + UnauthorizedError: + required: + - message + type: object + properties: + message: + type: string + UnsupportedMediaTypeError: + type: object + properties: + message: + type: string + description: Any further information + errors: + type: array + description: Detailed error information + items: + $ref: '#/components/schemas/ErrorItem' diff --git a/boat-maven-plugin/src/it/example/pom.xml b/boat-maven-plugin/src/it/example/pom.xml index 4c8001a69..58f0aa68f 100644 --- a/boat-maven-plugin/src/it/example/pom.xml +++ b/boat-maven-plugin/src/it/example/pom.xml @@ -40,6 +40,8 @@ BOAT :: Examples + boat-multiple-executions + boat-artifact-input boat-doc boat-export boat-generate diff --git a/boat-maven-plugin/src/main/java/com/backbase/oss/boat/AbstractGenerateMojo.java b/boat-maven-plugin/src/main/java/com/backbase/oss/boat/AbstractGenerateMojo.java index bab59ae21..1d7385642 100644 --- a/boat-maven-plugin/src/main/java/com/backbase/oss/boat/AbstractGenerateMojo.java +++ b/boat-maven-plugin/src/main/java/com/backbase/oss/boat/AbstractGenerateMojo.java @@ -3,11 +3,12 @@ import java.util.HashMap; import java.util.Map; import org.apache.maven.plugin.MojoExecutionException; +import org.apache.maven.plugin.MojoFailureException; public abstract class AbstractGenerateMojo extends GenerateMojo { public void execute(String generatorName, String library, boolean isEmbedded, boolean reactive, boolean generateSupportingFiles) - throws MojoExecutionException { + throws MojoExecutionException, MojoFailureException { Map options = new HashMap<>(); options.put("library", library); options.put("java8", "true"); diff --git a/boat-maven-plugin/src/main/java/com/backbase/oss/boat/AbstractLintMojo.java b/boat-maven-plugin/src/main/java/com/backbase/oss/boat/AbstractLintMojo.java index 867000785..81cb645e2 100644 --- a/boat-maven-plugin/src/main/java/com/backbase/oss/boat/AbstractLintMojo.java +++ b/boat-maven-plugin/src/main/java/com/backbase/oss/boat/AbstractLintMojo.java @@ -9,8 +9,8 @@ import java.util.Arrays; import java.util.List; import lombok.extern.slf4j.Slf4j; -import org.apache.maven.plugin.AbstractMojo; import org.apache.maven.plugin.MojoExecutionException; +import org.apache.maven.plugin.MojoFailureException; import org.apache.maven.plugins.annotations.Parameter; @SuppressWarnings("FieldMayBeFinal") @@ -18,13 +18,8 @@ /* Lint Specification */ -public abstract class AbstractLintMojo extends AbstractMojo { +public abstract class AbstractLintMojo extends InputMavenArtifactMojo { - /** - * Input spec directory or file. - */ - @Parameter(name = "inputSpec", property = "inputSpec", required = true) - protected File inputSpec; /** * Set this to true to fail in case a warning is found. @@ -47,18 +42,21 @@ public abstract class AbstractLintMojo extends AbstractMojo { "151","129","146","147","172","145","115","132","120", "134","183","154","105","104","130","118","110","153", "101","176","116","M009","H002","M010","H001","M008","S005","S006","S007","M011"}; - protected List lint() throws MojoExecutionException { + protected List lint() throws MojoExecutionException, MojoFailureException { + + super.execute(); + List boatLintReports = new ArrayList<>(); File[] inputFiles; - if (inputSpec.isDirectory()) { - inputFiles = inputSpec.listFiles(pathname -> pathname.getName().endsWith(".yaml")); + if (input.isDirectory()) { + inputFiles = input.listFiles(pathname -> pathname.getName().endsWith(".yaml")); if (inputFiles == null || inputFiles.length == 0) { throw new MojoExecutionException("No OpenAPI specs found in: " + inputSpec); } log.info("Found " + inputFiles.length + " specs to lint."); } else { - inputFiles = new File[]{inputSpec}; + inputFiles = new File[]{input}; } for (File inputFile : inputFiles) { @@ -82,8 +80,9 @@ private BoatLintReport lintOpenAPI(File inputFile) throws MojoExecutionException } } + @Override public void setInput(File input) { - this.inputSpec = input; + this.input = input; } public void setFailOnWarning(boolean failOnWarning) { diff --git a/boat-maven-plugin/src/main/java/com/backbase/oss/boat/AbstractRamlToOpenApi.java b/boat-maven-plugin/src/main/java/com/backbase/oss/boat/AbstractRamlToOpenApi.java index 522451aa9..caa0fab21 100644 --- a/boat-maven-plugin/src/main/java/com/backbase/oss/boat/AbstractRamlToOpenApi.java +++ b/boat-maven-plugin/src/main/java/com/backbase/oss/boat/AbstractRamlToOpenApi.java @@ -40,9 +40,6 @@ import org.eclipse.aether.impl.ArtifactResolver; import org.eclipse.aether.impl.MetadataResolver; import org.eclipse.aether.repository.RemoteRepository; -import org.eclipse.aether.resolution.ArtifactRequest; -import org.eclipse.aether.resolution.ArtifactResolutionException; -import org.eclipse.aether.resolution.ArtifactResult; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -467,23 +464,6 @@ public void setServers(List servers) { this.servers = servers; } - public ArtifactResult resolveArtifactFromRepositories(org.eclipse.aether.artifact.Artifact artifact) { - ArtifactRequest artifactRequest = getArtifactRequest(artifact); - - ArtifactResult artifactResult = null; - try { - artifactResult = artifactResolver.resolveArtifact(repositorySession, artifactRequest); - } catch (ArtifactResolutionException e) { - throw new IllegalArgumentException("Cannot resolve artifact: " + artifact); - } - return artifactResult; - - } - - private ArtifactRequest getArtifactRequest(org.eclipse.aether.artifact.Artifact artifact) { - return new ArtifactRequest(artifact, remoteRepositories, null); - } - protected DefaultArtifact createNewDefaultArtifact(Dependency dependency) { return new DefaultArtifact(dependency.getGroupId() , dependency.getArtifactId() diff --git a/boat-maven-plugin/src/main/java/com/backbase/oss/boat/ArtifactRepositoryResolver.java b/boat-maven-plugin/src/main/java/com/backbase/oss/boat/ArtifactRepositoryResolver.java new file mode 100644 index 000000000..090b7010d --- /dev/null +++ b/boat-maven-plugin/src/main/java/com/backbase/oss/boat/ArtifactRepositoryResolver.java @@ -0,0 +1,44 @@ +package com.backbase.oss.boat; + +import org.eclipse.aether.RepositorySystemSession; +import org.eclipse.aether.impl.ArtifactResolver; +import org.eclipse.aether.repository.RemoteRepository; +import org.eclipse.aether.resolution.ArtifactRequest; +import org.eclipse.aether.resolution.ArtifactResolutionException; +import org.eclipse.aether.resolution.ArtifactResult; + +import java.util.List; + +public class ArtifactRepositoryResolver { + + private final ArtifactResolver artifactResolver; + private final RepositorySystemSession repositorySession; + private final List remoteRepositories; + + public ArtifactRepositoryResolver(ArtifactResolver artifactResolver, RepositorySystemSession repositorySession, List remoteRepositories) { + this.artifactResolver = artifactResolver; + this.repositorySession = repositorySession; + this.remoteRepositories = remoteRepositories; + } + + + public ArtifactResult resolveArtifactFromRepositories(org.eclipse.aether.artifact.Artifact artifact) { + ArtifactRequest artifactRequest = getArtifactRequest(artifact); + + ArtifactResult artifactResult = null; + try { + artifactResult = artifactResolver.resolveArtifact(repositorySession, artifactRequest); + } catch (ArtifactResolutionException e) { + throw new IllegalArgumentException("Cannot resolve artifact: " + artifact); + } + return artifactResult; + + } + + + private ArtifactRequest getArtifactRequest(org.eclipse.aether.artifact.Artifact artifact) { + + return new ArtifactRequest(artifact, remoteRepositories, null); + } + +} diff --git a/boat-maven-plugin/src/main/java/com/backbase/oss/boat/ExportBomMojo.java b/boat-maven-plugin/src/main/java/com/backbase/oss/boat/ExportBomMojo.java index e64536660..94a6a149c 100644 --- a/boat-maven-plugin/src/main/java/com/backbase/oss/boat/ExportBomMojo.java +++ b/boat-maven-plugin/src/main/java/com/backbase/oss/boat/ExportBomMojo.java @@ -64,6 +64,8 @@ public class ExportBomMojo extends AbstractRamlToOpenApi { @Parameter(name = "addChangeLog", defaultValue = "true") private boolean addChangeLog; + public void setSpecBom(Dependency specBom){this.specBom = specBom;} + @Override public void execute() throws MojoExecutionException { @@ -113,7 +115,7 @@ public void execute() throws MojoExecutionException { .filter(versionRange::containsVersion) .distinct() .map(this::convertToArtifact) - .map(this::resolveArtifactFromRepositories) + .map(defaultArtifact -> new ArtifactRepositoryResolver(artifactResolver,repositorySession,remoteRepositories).resolveArtifactFromRepositories(defaultArtifact)) .map(this::parsePomFile) .map(this::groupArtifactsPerVersionAndCapability) .collect(Collectors.toList()); @@ -147,7 +149,7 @@ private Pair>> groupArtifactsPerVers .filter(this::isIncludedSpec) .map(this::createNewDefaultArtifact) .distinct() - .map(this::resolveArtifactFromRepositories) + .map(defaultArtifact -> new ArtifactRepositoryResolver(artifactResolver,repositorySession,remoteRepositories).resolveArtifactFromRepositories(defaultArtifact)) .collect(Collectors .groupingBy(artifactResult -> artifactResult.getArtifact().getGroupId(), TreeMap::new, Collectors.toSet())); diff --git a/boat-maven-plugin/src/main/java/com/backbase/oss/boat/GenerateDocMojo.java b/boat-maven-plugin/src/main/java/com/backbase/oss/boat/GenerateDocMojo.java index 0f26649c6..1b16ae73b 100644 --- a/boat-maven-plugin/src/main/java/com/backbase/oss/boat/GenerateDocMojo.java +++ b/boat-maven-plugin/src/main/java/com/backbase/oss/boat/GenerateDocMojo.java @@ -2,6 +2,7 @@ import lombok.extern.slf4j.Slf4j; import org.apache.maven.plugin.MojoExecutionException; +import org.apache.maven.plugin.MojoFailureException; import org.apache.maven.plugins.annotations.Mojo; @Mojo(name = "doc", threadSafe = true) @@ -9,7 +10,7 @@ public class GenerateDocMojo extends GenerateFromDirectoryDocMojo { @Override - public void execute() throws MojoExecutionException { + public void execute() throws MojoExecutionException, MojoFailureException { getLog().info("Generating Boat Docs"); generatorName = "boat-docs"; super.execute(); diff --git a/boat-maven-plugin/src/main/java/com/backbase/oss/boat/GenerateFromDirectoryDocMojo.java b/boat-maven-plugin/src/main/java/com/backbase/oss/boat/GenerateFromDirectoryDocMojo.java index e2f2aa957..dbb31e553 100644 --- a/boat-maven-plugin/src/main/java/com/backbase/oss/boat/GenerateFromDirectoryDocMojo.java +++ b/boat-maven-plugin/src/main/java/com/backbase/oss/boat/GenerateFromDirectoryDocMojo.java @@ -2,6 +2,7 @@ import lombok.extern.slf4j.Slf4j; import org.apache.maven.plugin.MojoExecutionException; +import org.apache.maven.plugin.MojoFailureException; import java.io.File; @@ -12,12 +13,21 @@ @Slf4j public class GenerateFromDirectoryDocMojo extends GenerateMojo { + @Override - public void execute() throws MojoExecutionException { + public void execute() throws MojoExecutionException, MojoFailureException { + if (inputSpec != null) { + File inputSpecFile = new File(inputSpec); + fileInputExecute(inputSpecFile); + } else { + log.info("Input read as Artifact"); + super.execute(); + } + } - File inputSpecFile = new File(inputSpec); + private void fileInputExecute(File inputSpecFile) throws MojoExecutionException, MojoFailureException { - if (inputSpecFile.isDirectory()){ + if (inputSpecFile.isDirectory()) { log.info("inputSpec is being read as a directory"); File[] inputSpecs; @@ -29,11 +39,11 @@ public void execute() throws MojoExecutionException { throw new MojoExecutionException("No OpenAPI specs found in: " + inputSpec); } - for(File f : inputSpecs){ + for (File f : inputSpecs) { inputSpec = f.getPath(); - output = new File(outPutDirectory.getPath(),f.getName().substring(0,f.getName().lastIndexOf(".")).concat("-docs")); + output = new File(outPutDirectory.getPath(), f.getName().substring(0, f.getName().lastIndexOf(".")).concat("-docs")); - if(!output.exists()){ + if (!output.exists()) { output.mkdir(); } @@ -41,7 +51,7 @@ public void execute() throws MojoExecutionException { super.execute(); } - }else { + } else { log.info("inputSpec being read as a single file"); super.execute(); diff --git a/boat-maven-plugin/src/main/java/com/backbase/oss/boat/GenerateMojo.java b/boat-maven-plugin/src/main/java/com/backbase/oss/boat/GenerateMojo.java index bb7191f1d..cecab8539 100644 --- a/boat-maven-plugin/src/main/java/com/backbase/oss/boat/GenerateMojo.java +++ b/boat-maven-plugin/src/main/java/com/backbase/oss/boat/GenerateMojo.java @@ -33,13 +33,12 @@ import java.util.Set; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; -import org.apache.maven.plugin.AbstractMojo; import org.apache.maven.plugin.MojoExecutionException; +import org.apache.maven.plugin.MojoFailureException; import org.apache.maven.plugins.annotations.Component; import org.apache.maven.plugins.annotations.LifecyclePhase; import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.plugins.annotations.Parameter; -import org.apache.maven.project.MavenProject; import org.openapitools.codegen.CliOption; import org.openapitools.codegen.ClientOptInput; import org.openapitools.codegen.CodegenConfig; @@ -77,7 +76,7 @@ @SuppressWarnings({"DefaultAnnotationParam", "java:S3776", "java:S5411"}) @Mojo(name = "generate", defaultPhase = LifecyclePhase.GENERATE_SOURCES, threadSafe = true) @Slf4j -public class GenerateMojo extends AbstractMojo { +public class GenerateMojo extends InputMavenArtifactMojo { private static String trimCSV(String text) { if (isNotEmpty(text)) { @@ -136,21 +135,6 @@ private static String trimCSV(String text) { protected File copyTo; - /** - * Location of the OpenAPI spec, as URL or local file glob pattern. - *

- * If the input is a local file, the value of this property is considered a glob pattern that must - * resolve to a unique file. - *

- *

- * The glob pattern allows to express the input specification in a version neutral way. For - * instance, if the actual file is {@code my-service-api-v3.1.4.yaml} the expression could be - * {@code my-service-api-v*.yaml}. - *

- */ - @Parameter(name = "inputSpec", property = "openapi.generator.maven.plugin.inputSpec", required = true) - protected String inputSpec; - /** * Git host, e.g. gitlab.com. */ @@ -486,11 +470,7 @@ private static String trimCSV(String text) { @Parameter(name = "writeDebugFiles") protected boolean writeDebugFiles = false; - /** - * The project being built. - */ - @Parameter(readonly = true, required = true, defaultValue = "${project}") - protected MavenProject project; + public void setBuildContext(BuildContext buildContext) { this.buildContext = buildContext; @@ -498,13 +478,15 @@ public void setBuildContext(BuildContext buildContext) { @Override @SuppressWarnings({"java:S3776", "java:S1874"}) - public void execute() throws MojoExecutionException { + public void execute() throws MojoExecutionException, MojoFailureException { + if (skip) { getLog().info("Code generation is skipped."); return; } + super.execute(); File inputSpecFile = new File(inputSpec); File inputParent = inputSpecFile.getParentFile(); diff --git a/boat-maven-plugin/src/main/java/com/backbase/oss/boat/GenerateRestTemplateEmbeddedMojo.java b/boat-maven-plugin/src/main/java/com/backbase/oss/boat/GenerateRestTemplateEmbeddedMojo.java index f21a705a4..53eb60342 100644 --- a/boat-maven-plugin/src/main/java/com/backbase/oss/boat/GenerateRestTemplateEmbeddedMojo.java +++ b/boat-maven-plugin/src/main/java/com/backbase/oss/boat/GenerateRestTemplateEmbeddedMojo.java @@ -1,6 +1,7 @@ package com.backbase.oss.boat; import org.apache.maven.plugin.MojoExecutionException; +import org.apache.maven.plugin.MojoFailureException; import org.apache.maven.plugins.annotations.Mojo; /** @@ -10,7 +11,7 @@ public class GenerateRestTemplateEmbeddedMojo extends AbstractGenerateMojo { @Override - public void execute() throws MojoExecutionException { + public void execute() throws MojoExecutionException, MojoFailureException { getLog().info("Generating Client using Spring Rest Template"); execute("java", "resttemplate", true, false, true); } diff --git a/boat-maven-plugin/src/main/java/com/backbase/oss/boat/GenerateSpringBootEmbeddedMojo.java b/boat-maven-plugin/src/main/java/com/backbase/oss/boat/GenerateSpringBootEmbeddedMojo.java index 15f17d5d2..f4bd2a569 100644 --- a/boat-maven-plugin/src/main/java/com/backbase/oss/boat/GenerateSpringBootEmbeddedMojo.java +++ b/boat-maven-plugin/src/main/java/com/backbase/oss/boat/GenerateSpringBootEmbeddedMojo.java @@ -1,6 +1,7 @@ package com.backbase.oss.boat; import org.apache.maven.plugin.MojoExecutionException; +import org.apache.maven.plugin.MojoFailureException; import org.apache.maven.plugins.annotations.Mojo; /** @@ -10,7 +11,7 @@ public class GenerateSpringBootEmbeddedMojo extends AbstractGenerateMojo { @Override - public void execute() throws MojoExecutionException { + public void execute() throws MojoExecutionException, MojoFailureException { getLog().info("Generating Server Stubs using Spring Boot"); execute("spring", "spring-boot", true, false, false); } diff --git a/boat-maven-plugin/src/main/java/com/backbase/oss/boat/GenerateWebClientEmbeddedMojo.java b/boat-maven-plugin/src/main/java/com/backbase/oss/boat/GenerateWebClientEmbeddedMojo.java index 76bdc7c50..bf8ad91fc 100644 --- a/boat-maven-plugin/src/main/java/com/backbase/oss/boat/GenerateWebClientEmbeddedMojo.java +++ b/boat-maven-plugin/src/main/java/com/backbase/oss/boat/GenerateWebClientEmbeddedMojo.java @@ -1,6 +1,7 @@ package com.backbase.oss.boat; import org.apache.maven.plugin.MojoExecutionException; +import org.apache.maven.plugin.MojoFailureException; import org.apache.maven.plugins.annotations.Mojo; /** @@ -10,7 +11,7 @@ public class GenerateWebClientEmbeddedMojo extends AbstractGenerateMojo { @Override - public void execute() throws MojoExecutionException { + public void execute() throws MojoExecutionException, MojoFailureException { getLog().info("Generating Server Stubs using Web Client Boot"); execute("java", "webclient", true, true, true); } diff --git a/boat-maven-plugin/src/main/java/com/backbase/oss/boat/InputArtifact.java b/boat-maven-plugin/src/main/java/com/backbase/oss/boat/InputArtifact.java new file mode 100644 index 000000000..da7e17a27 --- /dev/null +++ b/boat-maven-plugin/src/main/java/com/backbase/oss/boat/InputArtifact.java @@ -0,0 +1,42 @@ +package com.backbase.oss.boat; + +import lombok.Getter; +import lombok.Setter; +import lombok.extern.slf4j.Slf4j; + +import java.io.File; +import java.io.IOException; +import java.nio.file.Files; + + +@Getter +@Setter +@Slf4j +public class InputArtifact { + private String groupId; + private String artifactId; + private String version; + private String type; + private String classifier; + private String fileName; + private boolean overWrite; + private boolean overWriteIfNewer; + private boolean needsProcessing; + + public boolean isNeedsProcessing(File destFile, File originFile){ + needsProcessing = overWrite || !destFile.exists() || (overWriteIfNewer && isNewer(destFile,originFile)); + return needsProcessing; + } + + private boolean isNewer( File destFile, File originFile ) { + try { + long destMod = Files.getLastModifiedTime( destFile.toPath() ).toMillis(); + long originMod = Files.getLastModifiedTime( originFile.toPath() ).toMillis(); + return originMod > destMod; + } catch (IOException e) { + log.debug("Assuming artifact was not modified since artifact was last downloaded, cannot last read modified time"); + return false; + } + + } +} diff --git a/boat-maven-plugin/src/main/java/com/backbase/oss/boat/InputMavenArtifactMojo.java b/boat-maven-plugin/src/main/java/com/backbase/oss/boat/InputMavenArtifactMojo.java new file mode 100644 index 000000000..579c1d310 --- /dev/null +++ b/boat-maven-plugin/src/main/java/com/backbase/oss/boat/InputMavenArtifactMojo.java @@ -0,0 +1,181 @@ +package com.backbase.oss.boat; + + +import lombok.extern.slf4j.Slf4j; +import org.apache.maven.plugin.AbstractMojo; +import org.apache.maven.plugin.MojoExecutionException; +import org.apache.maven.plugin.MojoFailureException; +import org.apache.maven.plugins.annotations.Component; +import org.apache.maven.plugins.annotations.Parameter; +import org.apache.maven.project.MavenProject; +import org.codehaus.plexus.util.Expand; +import org.eclipse.aether.RepositorySystemSession; +import org.eclipse.aether.artifact.DefaultArtifact; +import org.eclipse.aether.impl.ArtifactResolver; +import org.eclipse.aether.repository.RemoteRepository; +import org.eclipse.aether.resolution.ArtifactResult; + +import java.io.File; +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Path; +import java.util.List; +import java.util.concurrent.locks.ReentrantLock; +import java.util.stream.Collectors; +import java.util.stream.Stream; + +@Slf4j +public class InputMavenArtifactMojo extends AbstractMojo { + + /** + * A maven artifact containing a spec, or multiple to be processed + */ + @Parameter(name = "inputMavenArtifact", property = "inputMavenArtifact", required = false) + protected InputArtifact inputMavenArtifact; + + /** + * File input used for Linting and Validating + * Can be directory or file + */ + @Parameter(name = "input", required = false) + protected File input; + + /** + * Location of the OpenAPI spec, as URL or local file glob pattern. + *

+ * If the input is a local file, the value of this property is considered a glob pattern that must + * resolve to a unique file. + *

+ *

+ * The glob pattern allows to express the input specification in a version neutral way. For + * instance, if the actual file is {@code my-service-api-v3.1.4.yaml} the expression could be + * {@code my-service-api-v*.yaml}. + *

+ */ + @Parameter(name = "inputSpec", property = "openapi.generator.maven.plugin.inputSpec", required = false) + protected String inputSpec; + + /** + * The project being built. + */ + @Parameter(readonly = true, required = true, defaultValue = "${project}") + protected MavenProject project; + + /** + * Used to set up artifact request + */ + @Parameter(defaultValue = "${repositorySystemSession}", readonly = true) + protected RepositorySystemSession repositorySession; + + /** + * Used to look up Artifacts in the remote repository. + */ + @Component + protected ArtifactResolver artifactResolver; + + /** + * List of Remote Repositories used by the resolver. + */ + @Parameter(defaultValue = "${project.remoteProjectRepositories}", readonly = true) + protected List remoteRepositories; + + private final ReentrantLock reLock = new ReentrantLock(true); + + @Override + public void execute() throws MojoExecutionException, MojoFailureException { + + if (inputMavenArtifact != null && inputMavenArtifact.getArtifactId() != null) { + getArtifact(); + } + + if (input == null && inputSpec == null && inputMavenArtifact == null) { + throw new MojoExecutionException("Missing input from plugin, input options are: inputMavenArtifact, input, inputSpec"); + } + + if (input == null) { + input = new File(inputSpec); + } + + } + + + private void getArtifact() throws MojoExecutionException { + ArtifactResult result; + + File specUnzipDirectory = new File(project.getBuild().getDirectory() + + File.separator + "input-artifact" + File.separator + + inputMavenArtifact.getArtifactId(), inputMavenArtifact.getVersion()); + + + + + + // The artifact will be downloaded to the local repository if necessary. An artifact that is already resolved will + // be skipped and is not re-resolved. + result = new ArtifactRepositoryResolver(artifactResolver, repositorySession, remoteRepositories).resolveArtifactFromRepositories(new DefaultArtifact(inputMavenArtifact.getGroupId() + , inputMavenArtifact.getArtifactId() + , inputMavenArtifact.getClassifier() + , inputMavenArtifact.getType() + , inputMavenArtifact.getVersion())); + + if (inputMavenArtifact.isNeedsProcessing(specUnzipDirectory,result.getArtifact().getFile())) { + + unzipSpec(result.getArtifact().getFile(), specUnzipDirectory); + + } + + try (Stream walk = Files.walk(specUnzipDirectory.toPath())) { + + List paths = walk + .filter(Files::isRegularFile) + .filter(path -> path.endsWith(inputMavenArtifact.getFileName())) + .map(Path::toString) + .collect(Collectors.toList()); + + if (paths.size() > 1) { + log.info("found multiple files of matching {} in zip, using {}", inputMavenArtifact.getFileName(), paths.get(0)); + } else if (paths.isEmpty()) { + throw new MojoExecutionException("no file matching " + inputMavenArtifact.getFileName() + " was found in artifact zip"); + } + + inputSpec = paths.get(0); + input = new File(paths.get(0)); + + } catch (IOException e) { + log.debug(e.getMessage()); + throw new MojoExecutionException("Could not search unzipped artifact directory"); + } + + } + + + private void unzipSpec(File inputFile, File specUnzipDirectory) throws MojoExecutionException { + reLock.lock(); + try { + specUnzipDirectory.mkdirs(); + unzip(inputFile, specUnzipDirectory); + } catch (Exception e) { + reLock.unlock(); + throw new MojoExecutionException("Error extracting spec: " + inputFile, e); + }finally { + reLock.unlock(); + } + } + + private void unzip(File source, File out) throws Exception { + Expand expand = new Expand(); + expand.setSrc(source); + expand.setDest(out); + expand.setOverwrite(true); + expand.execute(); + } + + public void setInput(File input) { + this.input = input; + } + +} + + + + diff --git a/boat-maven-plugin/src/test/java/com/backbase/oss/boat/ArtifactMojoTests.java b/boat-maven-plugin/src/test/java/com/backbase/oss/boat/ArtifactMojoTests.java new file mode 100644 index 000000000..f3272fbb2 --- /dev/null +++ b/boat-maven-plugin/src/test/java/com/backbase/oss/boat/ArtifactMojoTests.java @@ -0,0 +1,266 @@ +package com.backbase.oss.boat; + +import org.apache.maven.model.Build; +import org.apache.maven.plugin.MojoExecutionException; +import org.apache.maven.plugin.MojoFailureException; +import org.apache.maven.project.MavenProject; +import org.codehaus.plexus.logging.console.ConsoleLogger; +import org.eclipse.aether.RepositorySystemSession; +import org.eclipse.aether.impl.ArtifactResolver; +import org.eclipse.aether.resolution.ArtifactResolutionException; +import org.eclipse.aether.resolution.ArtifactResult; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; +import org.mockito.junit.jupiter.MockitoExtension; +import org.sonatype.plexus.build.incremental.DefaultBuildContext; + +import java.io.File; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.junit.jupiter.api.Assertions.assertThrows; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; + +@ExtendWith(MockitoExtension.class) +class ArtifactMojoTests { + + ArtifactResolver artifactResolver; + ArtifactResult artifactResult; + + @Test + void testArtifactResolver(){ + + GenerateDocMojo mojo = new GenerateDocMojo(); + File output = new File("target/boat-docs"); + if (!output.exists()) { + output.mkdirs(); + } + + DefaultBuildContext defaultBuildContext = new DefaultBuildContext(); + defaultBuildContext.enableLogging(new ConsoleLogger()); + + mojo.getLog(); + mojo.buildContext = defaultBuildContext; + mojo.project = new MavenProject(); + mojo.output = output; + mojo.skip = false; + mojo.skipIfSpecIsUnchanged = false; + mojo.bundleSpecs = true; + mojo.dereferenceComponents = true; + + assertThrows(MojoExecutionException.class, mojo::execute); + + } + + @Test + void testArtifactInputMojo() throws ArtifactResolutionException, MojoFailureException, MojoExecutionException { + File file = getFile("/oas-examples/openapi-zips-1.0.0-SNAPSHOT-api.zip"); + artifactResolver = mock(ArtifactResolver.class); + artifactResult = mock( ArtifactResult.class); + org.eclipse.aether.artifact.Artifact artifact = mock(org.eclipse.aether.artifact.Artifact.class); + + when(artifactResolver.resolveArtifact(any(),any())).thenReturn(artifactResult); + when(artifactResult.getArtifact()).thenReturn(artifact); + when(artifact.getFile()).thenReturn(file); + + GenerateDocMojo mojo = new GenerateDocMojo(); + File output = new File("target/boat-docs"); + if (!output.exists()) { + output.mkdirs(); + } + + DefaultBuildContext defaultBuildContext = new DefaultBuildContext(); + defaultBuildContext.enableLogging(new ConsoleLogger()); + InputArtifact inputArtifact = new InputArtifact(); + inputArtifact.setVersion("1.0.0-SNAPSHOT"); + inputArtifact.setGroupId("test.groupId"); + inputArtifact.setArtifactId("openapi-zips"); + inputArtifact.setClassifier("api"); + inputArtifact.setType("zip"); + inputArtifact.setFileName("presentation-integration-api/openapi.yaml"); + + mojo.inputMavenArtifact=inputArtifact; + mojo.getLog(); + mojo.buildContext = defaultBuildContext; + mojo.artifactResolver = artifactResolver; + Build build = new Build(); + build.setDirectory("target"); + + + MavenProject project = new MavenProject(); + + project.setBuild(build); + mojo.project = project; + mojo.repositorySession = mock(RepositorySystemSession.class); + mojo.output = output; + mojo.skip = false; + mojo.skipIfSpecIsUnchanged = false; + mojo.bundleSpecs = true; + mojo.dereferenceComponents = true; + mojo.execute(); + + assertThat(output.list()).containsExactlyInAnyOrder("index.html", ".openapi-generator-ignore", ".openapi-generator"); + + } + @Test + void testArtifactInputMojoOverwrite() throws ArtifactResolutionException, MojoFailureException, MojoExecutionException { + File file = getFile("/oas-examples/openapi-zips-1.0.0-SNAPSHOT-api.zip"); + artifactResolver = mock(ArtifactResolver.class); + artifactResult = mock( ArtifactResult.class); + org.eclipse.aether.artifact.Artifact artifact = mock(org.eclipse.aether.artifact.Artifact.class); + + when(artifactResolver.resolveArtifact(any(),any())).thenReturn(artifactResult); + when(artifactResult.getArtifact()).thenReturn(artifact); + when(artifact.getFile()).thenReturn(file); + + GenerateDocMojo mojo = new GenerateDocMojo(); + File output = new File("target/boat-docs"); + if (!output.exists()) { + output.mkdirs(); + } + + DefaultBuildContext defaultBuildContext = new DefaultBuildContext(); + defaultBuildContext.enableLogging(new ConsoleLogger()); + InputArtifact inputArtifact = new InputArtifact(); + inputArtifact.setVersion("1.0.0-SNAPSHOT"); + inputArtifact.setGroupId("test.groupId"); + inputArtifact.setArtifactId("openapi-zips"); + inputArtifact.setClassifier("api"); + inputArtifact.setType("zip"); + inputArtifact.setOverWriteIfNewer(true); + inputArtifact.setFileName("presentation-integration-api/openapi.yaml"); + + mojo.inputMavenArtifact=inputArtifact; + mojo.getLog(); + mojo.buildContext = defaultBuildContext; + mojo.artifactResolver = artifactResolver; + Build build = new Build(); + build.setDirectory("target"); + + + MavenProject project = new MavenProject(); + + project.setBuild(build); + mojo.project = project; + mojo.repositorySession = mock(RepositorySystemSession.class); + mojo.output = output; + mojo.skip = false; + mojo.skipIfSpecIsUnchanged = false; + mojo.bundleSpecs = true; + mojo.dereferenceComponents = true; + mojo.execute(); + + assertThat(output.list()).containsExactlyInAnyOrder("index.html", ".openapi-generator-ignore", ".openapi-generator"); + + } + @Test + void testArtifactInputMojoDuplicateFile() throws ArtifactResolutionException, MojoFailureException, MojoExecutionException { + File file = getFile("/oas-examples/openapi-zips-1.0.0-SNAPSHOT-api.zip"); + artifactResolver = mock(ArtifactResolver.class); + artifactResult = mock( ArtifactResult.class); + org.eclipse.aether.artifact.Artifact artifact = mock(org.eclipse.aether.artifact.Artifact.class); + + when(artifactResolver.resolveArtifact(any(),any())).thenReturn(artifactResult); + when(artifactResult.getArtifact()).thenReturn(artifact); + when(artifact.getFile()).thenReturn(file); + + GenerateDocMojo mojo = new GenerateDocMojo(); + File output = new File("target/boat-docs"); + if (!output.exists()) { + output.mkdirs(); + } + + DefaultBuildContext defaultBuildContext = new DefaultBuildContext(); + defaultBuildContext.enableLogging(new ConsoleLogger()); + InputArtifact inputArtifact = new InputArtifact(); + inputArtifact.setVersion("1.0.0-SNAPSHOT"); + inputArtifact.setGroupId("test.groupId"); + inputArtifact.setArtifactId("openapi-zips"); + inputArtifact.setClassifier("api"); + inputArtifact.setType("zip"); + inputArtifact.setFileName("openapi.yaml"); + + mojo.inputMavenArtifact=inputArtifact; + mojo.getLog(); + mojo.buildContext = defaultBuildContext; + mojo.artifactResolver = artifactResolver; + Build build = new Build(); + build.setDirectory("target"); + + + MavenProject project = new MavenProject(); + + project.setBuild(build); + mojo.project = project; + mojo.repositorySession = mock(RepositorySystemSession.class); + mojo.output = output; + mojo.skip = false; + mojo.skipIfSpecIsUnchanged = false; + mojo.bundleSpecs = true; + mojo.dereferenceComponents = true; + mojo.execute(); + + assertThat(output.list()).containsExactlyInAnyOrder("index.html", ".openapi-generator-ignore", ".openapi-generator"); + + } + + @Test + void testArtifactInputMojoFail() throws ArtifactResolutionException, MojoFailureException, MojoExecutionException { + File file = getFile("/oas-examples/openapi-zips-1.0.0-SNAPSHOT-api.zip"); + artifactResolver = mock(ArtifactResolver.class); + artifactResult = mock( ArtifactResult.class); + org.eclipse.aether.artifact.Artifact artifact = mock(org.eclipse.aether.artifact.Artifact.class); + + when(artifactResolver.resolveArtifact(any(),any())).thenReturn(artifactResult); + when(artifactResult.getArtifact()).thenReturn(artifact); + when(artifact.getFile()).thenReturn(file); + + GenerateDocMojo mojo = new GenerateDocMojo(); + File output = new File("target/boat-docs"); + if (!output.exists()) { + output.mkdirs(); + } + + DefaultBuildContext defaultBuildContext = new DefaultBuildContext(); + defaultBuildContext.enableLogging(new ConsoleLogger()); + InputArtifact inputArtifact = new InputArtifact(); + inputArtifact.setVersion("1.0.0-SNAPSHOT"); + inputArtifact.setGroupId("test.groupId"); + inputArtifact.setArtifactId("openapi-zips"); + inputArtifact.setClassifier("api"); + inputArtifact.setType("zip"); + inputArtifact.setFileName("file-not-present.yaml"); + + mojo.inputMavenArtifact=inputArtifact; + mojo.getLog(); + mojo.buildContext = defaultBuildContext; + mojo.artifactResolver = artifactResolver; + Build build = new Build(); + build.setDirectory("target"); + + + MavenProject project = new MavenProject(); + + project.setBuild(build); + mojo.project = project; + mojo.repositorySession = mock(RepositorySystemSession.class); + mojo.output = output; + mojo.skip = false; + mojo.skipIfSpecIsUnchanged = false; + mojo.bundleSpecs = true; + mojo.dereferenceComponents = true; + + assertThrows(MojoExecutionException.class, mojo::execute); + + } + + + + private File getFile(String fileName) { + return new File(getClass().getResource(fileName).getFile()); + } + + + +} diff --git a/boat-maven-plugin/src/test/java/com/backbase/oss/boat/ExportBomMojoTests.java b/boat-maven-plugin/src/test/java/com/backbase/oss/boat/ExportBomMojoTests.java new file mode 100644 index 000000000..9b800a078 --- /dev/null +++ b/boat-maven-plugin/src/test/java/com/backbase/oss/boat/ExportBomMojoTests.java @@ -0,0 +1,155 @@ +package com.backbase.oss.boat; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; + +import java.io.File; +import java.util.Collections; +import java.util.List; +import org.apache.maven.model.Build; +import org.apache.maven.model.Dependency; +import org.apache.maven.plugin.MojoExecutionException; +import org.apache.maven.plugin.MojoFailureException; +import org.apache.maven.project.MavenProject; +import org.codehaus.plexus.logging.console.ConsoleLogger; +import org.eclipse.aether.RepositorySystemSession; +import org.eclipse.aether.artifact.DefaultArtifact; +import org.eclipse.aether.impl.ArtifactResolver; +import org.eclipse.aether.impl.MetadataResolver; +import org.eclipse.aether.metadata.Metadata; +import org.eclipse.aether.resolution.ArtifactResolutionException; +import org.eclipse.aether.resolution.ArtifactResult; +import org.eclipse.aether.resolution.MetadataResult; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; +import org.mockito.ArgumentCaptor; +import org.mockito.Captor; +import org.mockito.Mock; +import org.mockito.junit.jupiter.MockitoExtension; +import org.sonatype.plexus.build.incremental.DefaultBuildContext; + +@ExtendWith(MockitoExtension.class) +class ExportBomMojoTests { + @Mock + ArtifactResolver artifactResolver; + @Mock + ArtifactResult artifactResult; + @Mock + MetadataResolver metadataResolver; + + @Mock + MetadataResult metadataResult; + @Mock + Metadata metadatamock; + + @Captor + ArgumentCaptor argCaptor; + + + @Test + void testExportBomEmptyMeta() throws MojoFailureException, MojoExecutionException, ArtifactResolutionException { + artifactResolver = mock(ArtifactResolver.class); + artifactResult = mock( ArtifactResult.class); + metadataResolver = mock(MetadataResolver.class); + org.eclipse.aether.artifact.Artifact artifact = mock(org.eclipse.aether.artifact.Artifact.class); + + when(metadataResolver.resolveMetadata(any(),any())).thenReturn(Collections.singletonList(metadataResult)); + + ExportBomMojo mojo = new ExportBomMojo(); + File output = new File("target/boat-bom-export"); + if (!output.exists()) { + output.mkdirs(); + } + + DefaultBuildContext defaultBuildContext = new DefaultBuildContext(); + defaultBuildContext.enableLogging(new ConsoleLogger()); + + mojo.getLog(); + mojo.artifactResolver = artifactResolver; + mojo.metadataResolver = metadataResolver; + mojo.setSpecBom(new Dependency()); + + + Build build = new Build(); + build.setDirectory("target"); + + MavenProject project = new MavenProject(); + mojo.remoteRepositories = Collections.EMPTY_LIST; + project.setBuild(build); + mojo.project = project; + mojo.repositorySession = mock(RepositorySystemSession.class); + mojo.execute(); + + assertThat(output.list()).isEmpty(); + } + + @Test + void testExportBomUseOfArtifactResolver() throws MojoFailureException, MojoExecutionException, ArtifactResolutionException { + File versionFile = getFile("/export-bom/maven-metadata-test-example.xml"); + String groupId="test.groupId"; + String artifactId = "raml-bom"; + String type = "pom"; + String version= "[1.0.0,)"; + + File pomFile = getFile("/export-bom/raml-spec-bom/pom.xml"); + artifactResolver = mock(ArtifactResolver.class); + artifactResult = mock( ArtifactResult.class); + org.eclipse.aether.artifact.Artifact artifact; //= mock(org.eclipse.aether.artifact.Artifact.class); + artifact = new DefaultArtifact(groupId, artifactId, "", type, version,Collections.EMPTY_MAP, pomFile); + + + when(artifactResolver.resolveArtifact(any(),any())).thenReturn(artifactResult); + when(artifactResult.getArtifact()).thenReturn(artifact); + //when(artifact.getFile()).thenReturn(pomFile); + + + when(metadataResolver.resolveMetadata(any(),any())).thenReturn(Collections.singletonList(metadataResult)); + + ExportBomMojo mojo = new ExportBomMojo(); + File output = new File("target/boat-bom-export"); + if (!output.exists()) { + output.mkdirs(); + } + when(metadataResult.isResolved()).thenReturn(true); + + + doReturn(metadatamock).when(metadataResult).getMetadata(); + doReturn(versionFile).when(metadatamock).getFile(); + + DefaultBuildContext defaultBuildContext = new DefaultBuildContext(); + defaultBuildContext.enableLogging(new ConsoleLogger()); + + mojo.getLog(); + mojo.artifactResolver = artifactResolver; + mojo.metadataResolver = metadataResolver; + Dependency dependency = new Dependency(); + + dependency.setType(type); + dependency.setGroupId(groupId); + dependency.setArtifactId(artifactId); + dependency.setVersion(version); + mojo.setSpecBom(dependency); + + + Build build = new Build(); + build.setDirectory("target"); + + MavenProject project = new MavenProject(); + mojo.remoteRepositories = Collections.EMPTY_LIST; + + project.setBuild(build); + mojo.project = project; + mojo.repositorySession = mock(RepositorySystemSession.class); + mojo.execute(); + + assertThat(output.list()).isEmpty(); + + } + private File getFile(String fileName) { + return new File(getClass().getResource(fileName).getFile()); + } + +} diff --git a/boat-maven-plugin/src/test/java/com/backbase/oss/boat/ExportMojoTests.java b/boat-maven-plugin/src/test/java/com/backbase/oss/boat/ExportMojoTests.java index b01164bc1..4a467063b 100644 --- a/boat-maven-plugin/src/test/java/com/backbase/oss/boat/ExportMojoTests.java +++ b/boat-maven-plugin/src/test/java/com/backbase/oss/boat/ExportMojoTests.java @@ -11,7 +11,6 @@ import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.project.MavenProject; import org.codehaus.plexus.logging.console.ConsoleLogger; -import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; import org.sonatype.plexus.build.incremental.DefaultBuildContext; diff --git a/boat-maven-plugin/src/test/java/com/backbase/oss/boat/GenerateMojoTests.java b/boat-maven-plugin/src/test/java/com/backbase/oss/boat/GenerateMojoTests.java index 955725894..31457400a 100644 --- a/boat-maven-plugin/src/test/java/com/backbase/oss/boat/GenerateMojoTests.java +++ b/boat-maven-plugin/src/test/java/com/backbase/oss/boat/GenerateMojoTests.java @@ -4,6 +4,7 @@ import com.backbase.oss.codegen.java.BoatSpringCodeGen; import java.io.File; import org.apache.maven.plugin.MojoExecutionException; +import org.apache.maven.plugin.MojoFailureException; import org.apache.maven.project.MavenProject; import org.codehaus.plexus.logging.console.ConsoleLogger; import org.junit.jupiter.api.BeforeEach; @@ -27,7 +28,7 @@ void setUp() { } @Test - void addTestCompileSourceRoot() throws MojoExecutionException { + void addTestCompileSourceRoot() throws MojoExecutionException, MojoFailureException { GenerateMojo mojo = configure(new GenerateMojo(), DefaultCodegen.class.getName()); mojo.addCompileSourceRoot = false; @@ -46,7 +47,7 @@ void addTestCompileSourceRoot() throws MojoExecutionException { } @Test - void useJavaBoat() throws MojoExecutionException { + void useJavaBoat() throws MojoExecutionException, MojoFailureException { GenerateMojo mojo = configure(new GenerateMojo(), "java"); mojo.execute(); @@ -55,7 +56,7 @@ void useJavaBoat() throws MojoExecutionException { } @Test - void useSpringBoat() throws MojoExecutionException { + void useSpringBoat() throws MojoExecutionException, MojoFailureException { GenerateMojo mojo = configure(new GenerateMojo(), "spring"); mojo.execute(); @@ -64,7 +65,7 @@ void useSpringBoat() throws MojoExecutionException { } @Test - void useJavaBoatForRestTemplateEmbedded() throws MojoExecutionException { + void useJavaBoatForRestTemplateEmbedded() throws MojoExecutionException, MojoFailureException { GenerateMojo mojo = configure(new GenerateRestTemplateEmbeddedMojo(), null); mojo.execute(); @@ -73,7 +74,7 @@ void useJavaBoatForRestTemplateEmbedded() throws MojoExecutionException { } @Test - void useSpringBoatForSpringBootEmbedded() throws MojoExecutionException { + void useSpringBoatForSpringBootEmbedded() throws MojoExecutionException, MojoFailureException { GenerateMojo mojo = configure(new GenerateSpringBootEmbeddedMojo(), null); mojo.execute(); @@ -82,7 +83,7 @@ void useSpringBoatForSpringBootEmbedded() throws MojoExecutionException { } @Test - void useJavaBoatForWebClientEmbedded() throws MojoExecutionException { + void useJavaBoatForWebClientEmbedded() throws MojoExecutionException, MojoFailureException { GenerateMojo mojo = configure(new GenerateWebClientEmbeddedMojo(), null); mojo.execute(); diff --git a/boat-maven-plugin/src/test/java/com/backbase/oss/boat/GeneratorTests.java b/boat-maven-plugin/src/test/java/com/backbase/oss/boat/GeneratorTests.java index 4aa024d51..ed8cbd38f 100644 --- a/boat-maven-plugin/src/test/java/com/backbase/oss/boat/GeneratorTests.java +++ b/boat-maven-plugin/src/test/java/com/backbase/oss/boat/GeneratorTests.java @@ -28,7 +28,7 @@ static void setupLocale() { } @Test - void testHtml2() throws MojoExecutionException { + void testHtml2() throws MojoExecutionException, MojoFailureException { String spec = System.getProperty("spec", getClass().getResource("/oas-examples/petstore.yaml").getFile()); GenerateMojo mojo = new GenerateMojo(); @@ -55,7 +55,7 @@ void testHtml2() throws MojoExecutionException { } @Test - void testBoatDocs() throws MojoExecutionException { + void testBoatDocs() throws MojoExecutionException, MojoFailureException { String spec = System.getProperty("spec", getClass().getResource("/oas-examples/petstore.yaml").getFile()); @@ -86,7 +86,7 @@ void testBoatDocs() throws MojoExecutionException { } @Test - void testBoatDocsWithDirectory() throws MojoExecutionException { + void testBoatDocsWithDirectory() throws MojoExecutionException, MojoFailureException { String spec = System.getProperty("spec", getClass().getResource("/boat-doc-oas-examples").getFile()); @@ -235,7 +235,7 @@ void testAngularExamplesInComponents() { } @Test - void testBeanValidation() throws MojoExecutionException { + void testBeanValidation() throws MojoExecutionException, MojoFailureException { GenerateMojo mojo = new GenerateMojo(); String inputFile = getClass().getResource("/oas-examples/petstore.yaml").getFile(); diff --git a/boat-maven-plugin/src/test/resources/export-bom/maven-metadata-test-example.xml b/boat-maven-plugin/src/test/resources/export-bom/maven-metadata-test-example.xml new file mode 100644 index 000000000..971aae3d4 --- /dev/null +++ b/boat-maven-plugin/src/test/resources/export-bom/maven-metadata-test-example.xml @@ -0,0 +1,15 @@ + + test.groupId + openapi-zips + [1.0.0,) + + 1.0.0 + 1.0.0 + + 1.0.0 + + 20150509185437 + + diff --git a/boat-maven-plugin/src/test/resources/export-bom/raml-spec-bom/pom.xml b/boat-maven-plugin/src/test/resources/export-bom/raml-spec-bom/pom.xml new file mode 100644 index 000000000..51b78d2fd --- /dev/null +++ b/boat-maven-plugin/src/test/resources/export-bom/raml-spec-bom/pom.xml @@ -0,0 +1,32 @@ + + + 4.0.0 + + com.backbase.oss.boat.example + raml-spec-bom + 1.0.0-SNAPSHOT + + + 1.0.0-SNAPSHOT + + + pom + + BOAT :: RAML Bill-Of-Materials + + + + + com.backbase.oss.boat.example + raml-spec + ${raml-spec.version} + + + + + + + + diff --git a/boat-maven-plugin/src/test/resources/mockito-extensions/org.mockito.plugins.MockMaker b/boat-maven-plugin/src/test/resources/mockito-extensions/org.mockito.plugins.MockMaker new file mode 100644 index 000000000..ca6ee9cea --- /dev/null +++ b/boat-maven-plugin/src/test/resources/mockito-extensions/org.mockito.plugins.MockMaker @@ -0,0 +1 @@ +mock-maker-inline \ No newline at end of file diff --git a/boat-maven-plugin/src/test/resources/oas-examples/openapi-zips-1.0.0-SNAPSHOT-api.zip b/boat-maven-plugin/src/test/resources/oas-examples/openapi-zips-1.0.0-SNAPSHOT-api.zip new file mode 100644 index 000000000..c12e5d4f7 Binary files /dev/null and b/boat-maven-plugin/src/test/resources/oas-examples/openapi-zips-1.0.0-SNAPSHOT-api.zip differ