Skip to content

Commit

Permalink
Merge branch 'main' into schema-extra-props
Browse files Browse the repository at this point in the history
  • Loading branch information
cdavernas authored Aug 3, 2024
2 parents 21eac79 + 333c83c commit 2ac77b4
Show file tree
Hide file tree
Showing 5 changed files with 97 additions and 33 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
- [About](#about)
- [Ecosystem](#ecosystem)
+ [DSL](dsl.md)
+ [CTK](/ctk/readme.md)
+ [CTK](/ctk/README.md)
+ [SDKs](#sdks)
+ [Runtimes](#runtimes)
+ [Tooling](#Tooling)
Expand Down Expand Up @@ -177,4 +177,4 @@ By becoming a sponsor, you'll not only demonstrate your commitment to advancing

Sponsorship opportunities range from financial contributions to in-kind support, and every sponsorship makes a meaningful impact on the project's success and sustainability.

Support our project by [becoming a Sponsor](https://crowdfunding.lfx.linuxfoundation.org/projects/serverless-workflow).
Support our project by [becoming a Sponsor](https://crowdfunding.lfx.linuxfoundation.org/projects/serverless-workflow).
4 changes: 2 additions & 2 deletions ctk/features/call.feature
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Feature: Call Task
endpoint:
uri: https://petstore.swagger.io/v2/pet/findByStatus?status={status}
output:
from: .[0]
as: .[0]
"""
And given the workflow input is:
"""yaml
Expand Down Expand Up @@ -108,7 +108,7 @@ Feature: Call Task
parameters:
status: ${ .status }
output:
from: . | length
as: . | length
"""
And given the workflow input is:
"""yaml
Expand Down
25 changes: 14 additions & 11 deletions dsl-reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -1507,17 +1507,20 @@ When set, runtimes must validate output data against the defined schema, unless
#### Examples

```yaml
schema:
format: json
document:
type: object
properties:
petId:
type: string
required: [ petId ]
from:
petId: '${ .pet.id }'
to: '.petList += [ . ]'
output:
schema:
format: json
document:
type: object
properties:
petId:
type: string
required: [ petId ]
as:
petId: '${ .pet.id }'
export:
as:
'.petList += [ . ]'
```

### Export
Expand Down
33 changes: 33 additions & 0 deletions examples/star-wars-homeworld.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# yaml-language-server: $schema=https://serverlessworkflow.io/schemas/1.0.0-alpha2/workflow.yaml
document:
dsl: 1.0.0-alpha2
namespace: examples
name: star-wars-homeplanet
version: 1.0.0-alpha2
input:
schema:
format: json
document:
type: object
required:
- id
properties:
id:
type: integer
description: The id of the star wars character to get
minimum: 1
do:
- getStarWarsCharacter:
call: http
with:
method: get
endpoint: https://swapi.dev/api/people/{id}
output: response
export:
as:
homeworld: ${ .content.homeworld }
- getStarWarsHomeworld:
call: http
with:
method: get
endpoint: ${ $context.homeworld }
64 changes: 46 additions & 18 deletions schema/workflow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ $id: https://serverlessworkflow.io/schemas/1.0.0-alpha1/workflow.yaml
$schema: https://json-schema.org/draft/2020-12/schema
description: Serverless Workflow DSL - Workflow Schema
type: object
required: [ document, do ]
properties:
document:
type: object
Expand Down Expand Up @@ -256,7 +257,9 @@ $defs:
description: The HTTP endpoint to send the request to.
oneOf:
- $ref: '#/$defs/endpoint'
- type: string
- $ref: '#/$defs/runtimeExpression'
- title: LiteralEndpoint
type: string
format: uri-template
headers:
type: object
Expand Down Expand Up @@ -366,23 +369,32 @@ $defs:
type: string
description: The event's unique identifier
source:
type: string
format: uri
description: Identifies the context in which an event happened
oneOf:
- title: LiteralSource
type: string
format: uri-template
- $ref: '#/$defs/runtimeExpression'
type:
type: string
description: This attribute contains a value describing the type of event related to the originating occurrence.
time:
type: string
format: date-time
oneOf:
- title: LiteralTime
type: string
format: date-time
- $ref: '#/$defs/runtimeExpression'
subject:
type: string
datacontenttype:
type: string
description: Content type of data value. This attribute enables data to carry any type of content, whereby format and encoding might differ from that of the chosen event format.
dataschema:
type: string
format: uri
oneOf:
- title: LiteralDataSchema
type: string
format: uri-template
- $ref: '#/$defs/runtimeExpression'
required: [ source, type ]
additionalProperties: true
required: [ event ]
Expand Down Expand Up @@ -535,7 +547,7 @@ $defs:
required: [ command ]
required: [ shell ]
description: Enables the execution of shell commands within a workflow, enabling workflows to interact with the underlying operating system and perform system-level operations, such as file manipulation, environment configuration, or system administration tasks.
- title: RunWokflow
- title: RunWorkflow
properties:
workflow:
title: RunWorkflowDescriptor
Expand Down Expand Up @@ -681,7 +693,8 @@ $defs:
type: object
unevaluatedProperties: false
oneOf:
- properties:
- title: BasicAuthenticationData
properties:
username:
type: string
description: The username to use.
Expand All @@ -698,7 +711,8 @@ $defs:
type: object
unevaluatedProperties: false
oneOf:
- properties:
- title: BearerAuthenticationData
properties:
token:
type: string
description: The bearer token to use.
Expand All @@ -712,7 +726,8 @@ $defs:
type: object
unevaluatedProperties: false
oneOf:
- properties:
- title: OAuth2AutenthicationData
properties:
authority:
type: string
format: uri
Expand Down Expand Up @@ -795,16 +810,22 @@ $defs:
unevaluatedProperties: false
properties:
type:
type: string
format: uri
description: A URI reference that identifies the error type.
oneOf:
- title: LiteralErrorType
type: string
format: uri-template
- $ref: '#/$defs/runtimeExpression'
status:
type: integer
description: The status code generated by the origin for this occurrence of the error.
instance:
type: string
format: json-pointer
description: A JSON Pointer used to reference the component the error originates from.
oneOf:
- title: LiteralErrorInstance
type: string
format: json-pointer
- $ref: '#/$defs/runtimeExpression'
title:
type: string
description: A short, human-readable summary of the error.
Expand All @@ -817,9 +838,12 @@ $defs:
unevaluatedProperties: false
properties:
uri:
type: string
format: uri-template
description: The endpoint's URI.
oneOf:
- title: LiteralEndpointURI
type: string
format: uri-template
- $ref: '#/$defs/runtimeExpression'
authentication:
$ref: '#/$defs/referenceableAuthenticationPolicy'
description: The authentication policy to use.
Expand Down Expand Up @@ -1068,4 +1092,8 @@ $defs:
description: The duration after which to timeout.
required: [ after ]
description: The definition of a timeout.
required: [ document, do ]
runtimeExpression:
title: RuntimeExpression
type: string
description: A runtime expression
pattern: "^\\s*\\$\\{.+\\}\\s*$"

0 comments on commit 2ac77b4

Please sign in to comment.