From fa125744ee92cb7e92c52604c090336e6e50abae Mon Sep 17 00:00:00 2001 From: Frank Kilcommins Date: Mon, 1 Jul 2024 17:32:44 +0100 Subject: [PATCH 1/4] chore: fix double pipe rendering for respec --- versions/1.0.0.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/1.0.0.md b/versions/1.0.0.md index 6fd9b28..df55813 100644 --- a/versions/1.0.0.md +++ b/versions/1.0.0.md @@ -645,7 +645,7 @@ Operator | Description `!=`| Not equal `!`| Not `&&`| And -`\|\|`| Or +\|\|| Or `()`| Logical Grouping `[]`| Index (0-based) `.`| Property de-reference From 2c66a73bb1d43dd65401cc6758bdd16f65df76f9 Mon Sep 17 00:00:00 2001 From: Frank Kilcommins Date: Mon, 30 Sep 2024 13:42:42 +0100 Subject: [PATCH 2/4] chore: harden examples with Spectral feedback --- .../ExtendedParametersExample.arazzo.yaml | 2 +- examples/1.0.0/FAPI-PAR.arazzo.yaml | 4 ++-- .../1.0.0/LoginAndRetrievePets.arazzo.yaml | 6 +++--- examples/1.0.0/bnpl-arazzo.yaml | 20 ++++++++++--------- examples/1.0.0/oauth.arazzo.yaml | 18 +++++++++-------- examples/1.0.0/pet-coupons.arazzo.yaml | 17 ++++++++++------ 6 files changed, 38 insertions(+), 29 deletions(-) diff --git a/examples/1.0.0/ExtendedParametersExample.arazzo.yaml b/examples/1.0.0/ExtendedParametersExample.arazzo.yaml index b4b8ee0..5b3c654 100644 --- a/examples/1.0.0/ExtendedParametersExample.arazzo.yaml +++ b/examples/1.0.0/ExtendedParametersExample.arazzo.yaml @@ -23,4 +23,4 @@ workflows: value: SUPER_SECRET operationId: animals.postAnimal - stepId: get-step - operationId: animals.getRandomAnimal \ No newline at end of file + operationId: $sourceDescriptions.animals.getRandomAnimal \ No newline at end of file diff --git a/examples/1.0.0/FAPI-PAR.arazzo.yaml b/examples/1.0.0/FAPI-PAR.arazzo.yaml index 6dc87e9..909bb90 100644 --- a/examples/1.0.0/FAPI-PAR.arazzo.yaml +++ b/examples/1.0.0/FAPI-PAR.arazzo.yaml @@ -116,7 +116,7 @@ workflows: # assertions to determine step was successful - condition: $statusCode == 200 outputs: - request_uri: $response.body.request_uri + request_uri: $response.body#/request_uri - stepId: AuthzCodeStep description: OIDC Authorization code request @@ -132,7 +132,7 @@ workflows: # assertions to determine step was successful - condition: $statusCode == 302 outputs: - code: $response.body.code # Not really, this is a query parameter (need a way to represent out-of-band props) + code: $response.body#/code # Not really, this is a query parameter (need a way to represent out-of-band props) - stepId: TokenStep description: Get token from the OIDC Token endpoint diff --git a/examples/1.0.0/LoginAndRetrievePets.arazzo.yaml b/examples/1.0.0/LoginAndRetrievePets.arazzo.yaml index 227d9bb..f745d39 100644 --- a/examples/1.0.0/LoginAndRetrievePets.arazzo.yaml +++ b/examples/1.0.0/LoginAndRetrievePets.arazzo.yaml @@ -24,7 +24,7 @@ workflows: steps: - stepId: loginStep description: This step demonstrates the user login step - operationId: petStoreDescription.loginUser + operationId: $sourceDescriptions.petStoreDescription.loginUser parameters: # parameters to inject into the loginUser operation (parameter name must be resolvable at the referenced operation and the value is determined using {expression} syntax) - name: username @@ -43,14 +43,14 @@ workflows: sessionToken: $response.body - stepId: getPetStep description: retrieve a pet by status from the GET pets endpoint - operationPath: $sourceDescriptions.petStoreDescription#/paths/~1pet~1findByStatus + operationPath: '{$sourceDescriptions.petStoreDescription.url}#/paths/~1pet~1findByStatus' parameters: - name: status in: query value: 'available' - name: Authorization in: header - value: $steps.loginUser.outputs.sessionToken + value: $steps.loginStep.outputs.sessionToken successCriteria: - condition: $statusCode == 200 outputs: diff --git a/examples/1.0.0/bnpl-arazzo.yaml b/examples/1.0.0/bnpl-arazzo.yaml index 51fd00f..b5f8099 100644 --- a/examples/1.0.0/bnpl-arazzo.yaml +++ b/examples/1.0.0/bnpl-arazzo.yaml @@ -1,6 +1,8 @@ arazzo: 1.0.0 info: title: BNPL Workflow description + description: >- + Describes the steps to secure a loan at checkout from a BNPL platform. It is a multi-step process that requires multiple API calls across several API providers to be completed successfully. version: 1.0.0 sourceDescriptions: - name: BnplApi @@ -110,7 +112,7 @@ workflows: type: end criteria: - condition: $statusCode == 200 - - condition: $response.body.existingCustomerNotEligible == false + - condition: $response.body#/existingCustomerNotEligible == false - name: qualifyingProductsFound type: goto stepId: getCustomerTermsAndConditions @@ -127,9 +129,9 @@ workflows: type: jsonpath condition: $[?count(@.products) == 0] outputs: - eligibilityCheckRequired: $response.body.eligibilityCheckRequired - eligibleProducts: $response.body.products - totalLoanAmount: $response.body.totalAmount + eligibilityCheckRequired: $response.body#/eligibilityCheckRequired + eligibleProducts: $response.body#/products + totalLoanAmount: $response.body#/totalAmount - stepId: getCustomerTermsAndConditions description: | Get the terms and conditions for the BNPL loans. This is static data and therefore has no arguments. @@ -184,7 +186,7 @@ workflows: criteria: - condition: $statusCode == 200 outputs: - customer: $response.body.links.self + customer: $response.body#/links/self - stepId: initiateBnplTransaction description: Initiate the BNPL transaction by sending the customer identifier, eligible products, and indicative loan amount to initiate the loan process operationId: createBnplTransaction @@ -203,15 +205,15 @@ workflows: type: goto stepId: authenticateCustomerAndAuthorizeLoan criteria: - - condition: $response.body.redirectAuthToken != null + - condition: $response.body#/redirectAuthToken != null - name: CustomerAuthorizationNotRequired type: goto stepId: retrieveFinalizedPaymentPlan criteria: - - condition: $response.body.redirectAuthToken == null + - condition: $response.body#/redirectAuthToken == null outputs: - redirectAuthToken: $response.body.redirectAuthToken - loanTransactionResourceUrl: $response.body.links.self + redirectAuthToken: $response.body#/redirectAuthToken + loanTransactionResourceUrl: $response.body#/links/self - stepId: authenticateCustomerAndAuthorizeLoan description: | Authenticate the customer and seek authorization for the loan. diff --git a/examples/1.0.0/oauth.arazzo.yaml b/examples/1.0.0/oauth.arazzo.yaml index 91348f0..f85e6b1 100644 --- a/examples/1.0.0/oauth.arazzo.yaml +++ b/examples/1.0.0/oauth.arazzo.yaml @@ -37,6 +37,8 @@ workflows: # # Or a previous refresh-token-flow.outputs.refresh_token steps: - stepId: do-the-auth-flow + description: >- + This is where you do the authorization code flow workflowId: authorization-code-flow parameters: - name: client_id @@ -63,9 +65,9 @@ workflows: condition: $.access_token != null type: jsonpath outputs: - access_token: $response.body.access_token - refresh_token: $response.body.refresh_token - expires_in: $response.body.expires_in + access_token: $response.body#/access_token + refresh_token: $response.body#/refresh_token + expires_in: $response.body#/expires_in outputs: access_token: $steps.do-the-refresh.outputs.access_token @@ -103,7 +105,7 @@ workflows: condition: $.access_token != null type: jsonpath outputs: - access_token: $response.body.access_token + access_token: $response.body#/access_token outputs: access_token: $steps.get-client-creds-token.outputs.access_token @@ -153,7 +155,7 @@ workflows: condition: $.access_token != null type: jsonpath outputs: - code: $response.body.code # Not really, this is a query parameter + code: $response.body#/code # Not really, this is a query parameter - stepId: get-access-token description: >- @@ -173,9 +175,9 @@ workflows: condition: $.access_token != null type: jsonpath outputs: - access_token: $response.body.access_token - refresh_token: $response.body.refresh_token - expires_in: $response.body.expires_in + access_token: $response.body#/access_token + refresh_token: $response.body#/refresh_token + expires_in: $response.body#/expires_in outputs: access_token: $steps.get-access-token.outputs.access_token refresh_token: $steps.get-access-token.outputs.refresh_token diff --git a/examples/1.0.0/pet-coupons.arazzo.yaml b/examples/1.0.0/pet-coupons.arazzo.yaml index 40ac72a..3782a77 100644 --- a/examples/1.0.0/pet-coupons.arazzo.yaml +++ b/examples/1.0.0/pet-coupons.arazzo.yaml @@ -20,6 +20,7 @@ workflows: $ref: "#/components/inputs/apply_coupon_input" steps: - stepId: find-pet + description: Find a pet based on the provided tags. operationId: findPetsByTags parameters: - name: pet_tags @@ -28,7 +29,7 @@ workflows: successCriteria: - condition: $statusCode == 200 outputs: - my_pet_id: $outputs[0].id + my_pet_id: $response.body#/0/id # there is some implied selection here - findPetsByTags responds with a list of pets, # but the client only wants to choose one, and that's what will be provided to the next step. # not totally sure how to indicate that. @@ -42,8 +43,9 @@ workflows: successCriteria: - condition: $statusCode == 200 outputs: - my_coupon_code: $response.body.couponCode + my_coupon_code: $response.body#/couponCode - stepId: place-order + description: Place an order for the pet, applying the coupon. workflowId: place-order parameters: - name: pet_id @@ -53,7 +55,7 @@ workflows: successCriteria: - condition: $statusCode == 200 outputs: - my_order_id: $workflow_order_id + my_order_id: $outputs.workflow_order_id outputs: apply_coupon_pet_order_id: $steps.place-order.outputs.my_order_id - workflowId: buy-available-pet @@ -65,6 +67,7 @@ workflows: $ref: "#/components/inputs/buy_available_pet_input" steps: - stepId: find-pet + description: Find a pet that is available for purchase. operationId: findPetsByStatus parameters: - name: status @@ -77,8 +80,9 @@ workflows: successCriteria: - condition: $statusCode == 200 outputs: - my_pet_id: $outputs[0].id + my_pet_id: $response.body#/0/id - stepId: place-order + description: Place an order for the pet. workflowId: place-order parameters: - name: pet_id @@ -86,7 +90,7 @@ workflows: successCriteria: - condition: $statusCode == 200 outputs: - my_order_id: $workflow_order_id + my_order_id: $outputs.workflow_order_id outputs: buy_pet_order_id: $steps.place-order.outputs.my_order_id - workflowId: place-order @@ -109,6 +113,7 @@ workflows: description: The coupon code to apply to the order. steps: - stepId: place-order + description: Place an order for the pet. operationId: placeOrder requestBody: contentType: application/json @@ -121,7 +126,7 @@ workflows: successCriteria: - condition: $statusCode == 200 outputs: - step_order_id: $response.body.id + step_order_id: $response.body#/id outputs: workflow_order_id: $steps.place-order.outputs.step_order_id components: From ecd2ac7caa44e0682dbab145c577b9016e70c949 Mon Sep 17 00:00:00 2001 From: Frank Kilcommins Date: Mon, 30 Sep 2024 13:44:02 +0100 Subject: [PATCH 3/4] chore: qualify expression --- examples/1.0.0/ExtendedParametersExample.arazzo.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/1.0.0/ExtendedParametersExample.arazzo.yaml b/examples/1.0.0/ExtendedParametersExample.arazzo.yaml index 5b3c654..b429335 100644 --- a/examples/1.0.0/ExtendedParametersExample.arazzo.yaml +++ b/examples/1.0.0/ExtendedParametersExample.arazzo.yaml @@ -21,6 +21,6 @@ workflows: - in: cookie name: authentication value: SUPER_SECRET - operationId: animals.postAnimal + operationId: $sourceDescriptions.animals.postAnimal - stepId: get-step operationId: $sourceDescriptions.animals.getRandomAnimal \ No newline at end of file From 52046e919892d0f5010d19825ca76bf4bbc7b8ac Mon Sep 17 00:00:00 2001 From: Frank Kilcommins Date: Thu, 21 Nov 2024 21:34:46 +0000 Subject: [PATCH 4/4] fix(examples): incorrect expression for accessing step output --- examples/1.0.0/LoginAndRetrievePets.arazzo.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/1.0.0/LoginAndRetrievePets.arazzo.yaml b/examples/1.0.0/LoginAndRetrievePets.arazzo.yaml index f745d39..4127ee3 100644 --- a/examples/1.0.0/LoginAndRetrievePets.arazzo.yaml +++ b/examples/1.0.0/LoginAndRetrievePets.arazzo.yaml @@ -57,4 +57,4 @@ workflows: # outputs from this step availablePets: $response.body outputs: - available: $steps.getPetStep.availablePets \ No newline at end of file + available: $steps.getPetStep.outputs.availablePets \ No newline at end of file