Skip to content

Commit e46a85e

Browse files
committed
Add Samples
- Added more samples - Organised samples as content Signed-off-by: Jean-Baptiste Bianchi <[email protected]>
1 parent 064fba2 commit e46a85e

File tree

19 files changed

+374
-94
lines changed

19 files changed

+374
-94
lines changed

.netlify/v1/config.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"images":{"remote_images":[]},"headers":[{"for":"/_astro/*","values":{"Cache-Control":"public, max-age=31536000, immutable"}}]}

package-lock.json

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/content.config.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,11 @@ const SpecErrorV1Schema = z.object({
2222
});
2323
export type SpecErrorV1Schema = z.infer<typeof SpecErrorV1Schema>;
2424

25+
const exampleSchema = z.object({
26+
title: z.string()
27+
});
28+
export type Example = z.infer<typeof SpecErrorV1Schema>;
29+
2530
const blog = defineCollection({
2631
loader: getGlobLoader('blog', `{${mdExtensions.join(',')}}`),
2732
schema: BlogPostSchema
@@ -30,6 +35,10 @@ const specErrorV1 = defineCollection({
3035
loader: getGlobLoader('spec/1.0.0/errors', 'json'),
3136
schema: SpecErrorV1Schema
3237
});
38+
const example = defineCollection({
39+
loader: getGlobLoader('examples', `{${mdExtensions.join(',')}}`),
40+
schema: exampleSchema
41+
});
3342
/*
3443
const docs = defineCollection({
3544
loader: getLoader('docs'),
@@ -42,6 +51,7 @@ const docs = defineCollection({
4251
export const collections = {
4352
blog,
4453
specErrorV1,
54+
example,
4555
//docs,
4656
};
4757

src/content/examples/async-api.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
---
2+
title: Async API
3+
---
4+
document:
5+
dsl: '1.0.0-alpha5'
6+
namespace: examples
7+
name: call-asyncapi
8+
version: '1.0.0'
9+
do:
10+
- findPet:
11+
call: asyncapi
12+
with:
13+
document:
14+
uri: https://fake.com/docs/asyncapi.json
15+
operationRef: findPetsByStatus
16+
server: staging
17+
message:
18+
payload:
19+
petId: ${ .pet.id }
20+
authentication:
21+
bearer:
22+
token: ${ .token }

src/content/examples/container.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
---
2+
title: Container
3+
---
4+
document:
5+
dsl: '1.0.0-alpha5'
6+
namespace: examples
7+
name: run-container
8+
version: '1.0.0'
9+
do:
10+
- runContainer:
11+
run:
12+
container:
13+
image: fake-image

src/content/examples/emit.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
---
2+
title: Emit Event
3+
---
4+
document:
5+
dsl: '1.0.0-alpha5'
6+
namespace: test
7+
name: emit
8+
version: '0.1.0'
9+
do:
10+
- emitEvent:
11+
emit:
12+
event:
13+
with:
14+
source: https://petstore.com
15+
type: com.petstore.order.placed.v1
16+
data:
17+
client:
18+
firstName: Cruella
19+
lastName: de Vil
20+
items:
21+
- breed: dalmatian
22+
quantity: 101

src/content/examples/for.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
---
2+
title: For
3+
---
4+
document:
5+
dsl: '1.0.0-alpha5'
6+
namespace: test
7+
name: for-example
8+
version: '0.1.0'
9+
do:
10+
- checkup:
11+
for:
12+
each: pet
13+
in: .pets
14+
at: index
15+
while: .vet != null
16+
do:
17+
- waitForCheckup:
18+
listen:
19+
to:
20+
one:
21+
with:
22+
type: com.fake.petclinic.pets.checkup.completed.v2
23+
output:
24+
as: '.pets + [{ "id": $pet.id }]'

src/content/examples/fork.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
---
2+
title: Fork
3+
---
4+
document:
5+
dsl: '1.0.0-alpha5'
6+
namespace: test
7+
name: fork-example
8+
version: '0.1.0'
9+
do:
10+
- raiseAlarm:
11+
fork:
12+
compete: true
13+
branches:
14+
- callNurse:
15+
call: http
16+
with:
17+
method: put
18+
endpoint: https://fake-hospital.com/api/v3/alert/nurses
19+
body:
20+
patientId: ${ .patient.fullName }
21+
room: ${ .room.number }
22+
- callDoctor:
23+
call: http
24+
with:
25+
method: put
26+
endpoint: https://fake-hospital.com/api/v3/alert/doctor
27+
body:
28+
patientId: ${ .patient.fullName }
29+
room: ${ .room.number }

src/content/examples/grpc.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
---
2+
title: gRPC
3+
---
4+
document:
5+
dsl: '1.0.0-alpha5'
6+
namespace: examples
7+
name: call-grpc
8+
version: '1.0.0'
9+
do:
10+
- greet:
11+
call: grpc
12+
with:
13+
proto:
14+
endpoint: file://app/greet.proto
15+
service:
16+
name: GreeterApi.Greeter
17+
host: localhost
18+
port: 5011
19+
method: SayHello
20+
arguments:
21+
name: '${ .user.preferredDisplayName }'

src/content/examples/http.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
---
2+
title: HTTP
3+
---
4+
document:
5+
dsl: '1.0.0-alpha5'
6+
namespace: examples
7+
name: call-http
8+
version: '1.0.0'
9+
do:
10+
- getPet:
11+
call: http
12+
with:
13+
method: get
14+
endpoint: https://petstore.swagger.io/v2/pet/{petId}

0 commit comments

Comments
 (0)