diff --git a/dsl-reference.md b/dsl-reference.md index f9647fce..fb710ff8 100644 --- a/dsl-reference.md +++ b/dsl-reference.md @@ -149,14 +149,14 @@ use: call: http with: method: post - uri: https://fake.log.collector.com + endpoint: https://fake.log.collector.com body: message: "${ \"Executing task '\($task.reference)'...\" }" after: call: http with: method: post - uri: https://fake.log.collector.com + endpoint: https://fake.log.collector.com body: message: "${ \"Executed task '\($task.reference)'...\" }" functions: @@ -259,7 +259,7 @@ do: call: http with: method: get - uri: https://petstore.swagger.io/v2/pet/{petId} + endpoint: https://petstore.swagger.io/v2/pet/{petId} ``` Serverless Workflow defines several default functions that **MUST** be supported by all implementations and runtimes: @@ -371,7 +371,7 @@ do: call: http with: method: get - uri: https://petstore.swagger.io/v2/pet/{petId} + endpoint: https://petstore.swagger.io/v2/pet/{petId} ``` ##### OpenAPI Call @@ -483,7 +483,7 @@ do: call: http with: method: put - uri: https://fake-hospital.com/api/v3/alert/nurses + endpoint: https://fake-hospital.com/api/v3/alert/nurses body: patientId: ${ .patient.fullName } room: ${ .room.number } @@ -491,7 +491,7 @@ do: call: http with: method: put - uri: https://fake-hospital.com/api/v3/alert/doctor + endpoint: https://fake-hospital.com/api/v3/alert/doctor body: patientId: ${ .patient.fullName } room: ${ .room.number } @@ -918,7 +918,7 @@ do: call: http with: method: get - uri: https:// + endpoint: https:// catch: errors: with: @@ -1203,14 +1203,14 @@ use: call: http with: method: post - uri: https://fake.log.collector.com + endpoint: https://fake.log.collector.com body: message: "${ \"Executing task '\($task.reference)'...\" }" after: call: http with: method: post - uri: https://fake.log.collector.com + endpoint: https://fake.log.collector.com body: message: "${ \"Executed task '\($task.reference)'...\" }" do: @@ -1218,7 +1218,7 @@ do: call: http with: method: get - uri: https://fake.com/sample + endpoint: https://fake.com/sample ``` _Intercept HTTP calls to 'https://mocked.service.com' and mock its response:_ @@ -1248,7 +1248,7 @@ do: call: http with: method: get - uri: https://fake.com/sample + endpoint: https://fake.com/sample ``` ### Error diff --git a/examples/asyncapi.yaml b/examples/asyncapi.yaml new file mode 100644 index 00000000..9d442d08 --- /dev/null +++ b/examples/asyncapi.yaml @@ -0,0 +1,20 @@ +document: + dsl: 1.0.0-alpha1 + namespace: examples + name: bearer-auth + version: 1.0.0-alpha1 +do: + greetUser: + call: asyncapi + with: + document: + uri: https://fake.com/docs/asyncapi.json + operationRef: findPetsByStatus + server: staging + message: getPetByStatusQuery + binding: http + payload: + petId: ${ .pet.id } + authentication: + bearer: + token: ${ .token } diff --git a/examples/call-http-shorthand-endpoint.yaml b/examples/call-http-shorthand-endpoint.yaml new file mode 100644 index 00000000..f682ed30 --- /dev/null +++ b/examples/call-http-shorthand-endpoint.yaml @@ -0,0 +1,11 @@ +document: + dsl: 1.0.0-alpha1 + namespace: examples + name: call-http-shorthand-endpoint + version: 1.0.0-alpha1 +do: + getPetById: + call: http + with: + method: get + endpoint: https://petstore.swagger.io/v2/pet/{petId} diff --git a/examples/use-authentication.yaml b/examples/use-authentication.yaml new file mode 100644 index 00000000..c8cd34fe --- /dev/null +++ b/examples/use-authentication.yaml @@ -0,0 +1,18 @@ +document: + dsl: 1.0.0-alpha1 + namespace: examples + name: bearer-auth + version: 1.0.0-alpha1 +use: + authentications: + petStoreAuth: + bearer: + token: ${ .token } +do: + getPetById: + call: http + with: + method: get + endpoint: + uri: https://petstore.swagger.io/v2/pet/{petId} + authentication: petStoreAuth diff --git a/schema/workflow.yaml b/schema/workflow.yaml index f27302fa..f7892b38 100644 --- a/schema/workflow.yaml +++ b/schema/workflow.yaml @@ -141,7 +141,7 @@ $defs: - properties: call: type: string - constant: asyncapi + const: asyncapi with: type: object properties: @@ -173,17 +173,19 @@ $defs: description: | The payload to call the AsyncAPI operation with, if any. authentication: - ref: "#/$defs/authenticationPolicy" description: | The authentication policy, if any, to use when calling the AsyncAPI operation. + oneOf: + - $ref: "#/$defs/authenticationPolicy" + - type: string required: [document, operationRef] description: Defines the AsyncAPI call to perform. required: [call, with] - properties: call: type: string - constant: grpc + const: grpc with: type: object properties: @@ -207,7 +209,9 @@ $defs: max: 65535 description: The port number of the GRPC service to call. authentication: - $ref: "#/$defs/authenticationPolicy" + oneOf: + - $ref: "#/$defs/authenticationPolicy" + - type: string description: The endpoint's authentication policy, if any. required: [name, host] method: @@ -224,7 +228,7 @@ $defs: - properties: call: type: string - constant: http + const: http with: type: object properties: @@ -232,8 +236,11 @@ $defs: type: string description: The HTTP method of the HTTP request to perform. endpoint: - $ref: "#/$defs/endpoint" description: The HTTP endpoint to send the request to. + oneOf: + - $ref: "#/$defs/endpoint" + - type: string + format: uri-template headers: type: object description: | @@ -251,7 +258,7 @@ $defs: - properties: call: type: string - constant: openapi + const: openapi with: type: object properties: @@ -269,7 +276,9 @@ $defs: A name/value mapping of the parameters of the OpenAPI operation to call. authentication: - $ref: "#/$defs/authenticationPolicy" + oneOf: + - $ref: "#/$defs/authenticationPolicy" + - type: string description: | The authentication policy, if any, to use when calling the OpenAPI operation. @@ -294,6 +303,7 @@ $defs: function with. required: [call] compositeTask: + type: object properties: execute: type: object @@ -331,6 +341,7 @@ $defs: seamless integration and execution of multiple subtasks to accomplish complex operations emitTask: + type: object properties: emit: type: object @@ -380,6 +391,7 @@ $defs: default: continue - type: string forTask: + type: object properties: for: type: object @@ -787,8 +799,10 @@ $defs: format: uri-template description: The endpoint's URI. authentication: - $ref: "#/$defs/authenticationPolicy" description: The authentication policy to use. + oneOf: + - $ref: "#/$defs/authenticationPolicy" + - type: string required: [uri] eventConsumptionStrategy: type: object @@ -916,8 +930,10 @@ $defs: format: uri description: The endpoint's URI. authentication: - $ref: "#/$defs/authenticationPolicy" description: The authentication policy to use. + oneOf: + - $ref: "#/$defs/authenticationPolicy" + - type: string name: type: string description: The external resource's name, if any.