Skip to content

Commit

Permalink
Merge pull request #975 from neuroglia-io/fix-930-endpoint-factoring
Browse files Browse the repository at this point in the history
Consolidate `endpoint` and `externalResource` definitions
  • Loading branch information
cdavernas authored Aug 15, 2024
2 parents 996b0c4 + 65bf9e1 commit 16a331a
Show file tree
Hide file tree
Showing 5 changed files with 59 additions and 62 deletions.
4 changes: 2 additions & 2 deletions ctk/features/call.feature
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ Feature: Call Task
call: openapi
with:
document:
uri: "https://petstore.swagger.io/v2/swagger.json"
endpoint: "https://petstore.swagger.io/v2/swagger.json"
operation: findPetsByStatus
parameters:
status: ${ .status }
Expand Down Expand Up @@ -131,7 +131,7 @@ Feature: Call Task
call: openapi
with:
document:
uri: "https://petstore.swagger.io/v2/swagger.json"
endpoint: "https://petstore.swagger.io/v2/swagger.json"
operation: getPetById
parameters:
petId: ${ .petId }
Expand Down
28 changes: 16 additions & 12 deletions dsl-reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
+ [Export](#export)
+ [Timeout](#timeout)
+ [Duration](#duration)
+ [Endpoint](#endpoint)
+ [HTTP Response](#http-response)
+ [HTTP Request](#http-request)
+ [URI Template](#uri-template)
Expand Down Expand Up @@ -177,7 +178,7 @@ use:
call: openapi
with:
document:
uri: https://petstore.swagger.io/v2/swagger.json
endpoint: https://petstore.swagger.io/v2/swagger.json
operationId: findByStatus
parameters:
status: available
Expand Down Expand Up @@ -314,7 +315,8 @@ do:
- findPet:
call: asyncapi
with:
document: https://fake.com/docs/asyncapi.json
document:
endpoint: https://fake.com/docs/asyncapi.json
operationRef: findPetsByStatus
server: staging
message: getPetByStatusQuery
Expand Down Expand Up @@ -351,7 +353,8 @@ do:
- greet:
call: grpc
with:
proto: file://app/greet.proto
proto:
endpoint: file://app/greet.proto
service:
name: GreeterApi.Greeter
host: localhost
Expand Down Expand Up @@ -418,7 +421,8 @@ do:
- findPet:
call: openapi
with:
document: https://petstore.swagger.io/v2/swagger.json
document:
endpoint: https://petstore.swagger.io/v2/swagger.json
operationId: findPetsByStatus
parameters:
status: available
Expand Down Expand Up @@ -1079,18 +1083,18 @@ Defines an external resource.
| Property | Type | Required | Description |
|----------|:----:|:--------:|-------------|
| name | `string` | `no` | The name, if any, of the defined resource. |
| uri | [`uri-template`](#uri-template) | `yes` | The URI at which to get the defined resource. |
| authentication | [`authentication`](#authentication) | `no` | The authentication policy, or the name of the authentication policy, to use when fecthing the resource. |
| endpoint | [`endpoint`](#endpoint) | `yes` | The endpoint at which to get the defined resource. |

##### Examples

```yaml
name: sample-resource
uri: https://fake.com/resource/0123
authentication:
basic:
username: admin
password: 1234
endpoint:
uri: https://fake.com/resource/0123
authentication:
basic:
username: admin
password: 1234
```

### Authentication
Expand Down Expand Up @@ -1611,7 +1615,7 @@ document:
```yaml
format: json
resource:
uri: https://test.com/fake/schema/json/document.json
endpoint: https://test.com/fake/schema/json/document.json
```

### Timeout
Expand Down
4 changes: 2 additions & 2 deletions examples/accumulate-room-readings.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,13 @@ do:
call: openapi
with:
document:
uri: http://myorg.io/ordersservices.json
endpoint: http://myorg.io/ordersservices.json
operationId: logreading
- generateReport:
call: openapi
with:
document:
uri: http://myorg.io/ordersservices.json
endpoint: http://myorg.io/ordersservices.json
operationId: produceReport
timeout:
after:
Expand Down
2 changes: 1 addition & 1 deletion examples/asyncapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ do:
call: asyncapi
with:
document:
uri: https://fake.com/docs/asyncapi.json
endpoint: https://fake.com/docs/asyncapi.json
operationRef: findPetsByStatus
server: staging
message: getPetByStatusQuery
Expand Down
83 changes: 38 additions & 45 deletions schema/workflow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -314,12 +314,7 @@ $defs:
endpoint:
title: WithHTTPEndpoint
description: The HTTP endpoint to send the request to.
oneOf:
- $ref: '#/$defs/endpoint'
- $ref: '#/$defs/runtimeExpression'
- title: LiteralEndpoint
type: string
format: uri-template
$ref: '#/$defs/endpoint'
headers:
type: object
title: WithHTTPHeaders
Expand Down Expand Up @@ -1008,27 +1003,33 @@ $defs:
description: A human-readable explanation specific to this occurrence of the error.
required: [ type, status, instance ]
endpoint:
type: object
title: Endpoint
description: Represents an endpoint.
unevaluatedProperties: false
properties:
uri:
title: EndpointUri
description: The endpoint's URI.
oneOf:
- title: LiteralEndpointURI
description: The literal endpoint's URI.
type: string
format: uri-template
- $ref: '#/$defs/runtimeExpression'
title: ExpressionEndpointURI
description: An expression based endpoint's URI.
authentication:
$ref: '#/$defs/referenceableAuthenticationPolicy'
title: EndpointAuthentication
description: The authentication policy to use.
required: [ uri ]
oneOf:
- $ref: '#/$defs/runtimeExpression'
- title: LiteralEndpoint
type: string
format: uri-template
- title: EndpointConfiguration
type: object
unevaluatedProperties: false
properties:
uri:
title: EndpointUri
description: The endpoint's URI.
oneOf:
- title: LiteralEndpointURI
description: The literal endpoint's URI.
type: string
format: uri-template
- $ref: '#/$defs/runtimeExpression'
title: ExpressionEndpointURI
description: An expression based endpoint's URI.
authentication:
$ref: '#/$defs/referenceableAuthenticationPolicy'
title: EndpointAuthentication
description: The authentication policy to use.
required: [ uri ]
eventProperties:
type: object
title: EventProperties
Expand Down Expand Up @@ -1162,28 +1163,20 @@ $defs:
description: The task(s) to execute after the extended task, if any.
required: [ extend ]
externalResource:
type: object
title: ExternalResource
description: Represents an external resource.
oneOf:
- type: string
format: uri-template
- title: ExternalResourceURI
type: object
unevaluatedProperties: false
properties:
uri:
type: string
format: uri-template
title: ExternalResourceURIEndpoint
description: The endpoint's URI.
authentication:
$ref: '#/$defs/referenceableAuthenticationPolicy'
title: ExternalResourceURIAuthentication
description: The authentication policy to use.
name:
type: string
description: The external resource's name, if any.
required: [ uri ]
unevaluatedProperties: false
properties:
name:
type: string
title: ExternalResourceName
description: The name of the external resource, if any.
endpoint:
$ref: '#/$defs/endpoint'
title: ExternalResourceEndpoint
description: The endpoint of the external resource.
required: [ endpoint ]
input:
type: object
title: Input
Expand Down

0 comments on commit 16a331a

Please sign in to comment.