Skip to content

Commit b941c74

Browse files
authored
chore: add Python example code (#14)
1 parent 5e3013e commit b941c74

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

schema.yaml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ exports:
2929
- lang: c++
3030
source: |
3131
return pdk::reflectJsonObjectHost(std::move(input));
32+
- lang: python
33+
source: |
34+
return reflect_json_object_host(input)
3235
input:
3336
contentType: application/json
3437
$ref: "#/components/schemas/KitchenSinkObject"
@@ -63,6 +66,9 @@ exports:
6366
- lang: c++
6467
source: |
6568
return pdk::reflectUtf8StringHost(std::move(input));
69+
- lang: python
70+
source: |
71+
return reflect_utf8_string_host(input)
6672
input:
6773
type: string
6874
description: The input string
@@ -99,6 +105,9 @@ exports:
99105
- lang: c++
100106
source: |
101107
return pdk::reflectByteBufferHost(std::move(input));
108+
- lang: python
109+
source: |
110+
return reflect_byte_buffer_host(input)
102111
input:
103112
contentType: application/x-binary
104113
type: buffer
@@ -137,6 +146,9 @@ exports:
137146
- lang: c++
138147
source: |
139148
return pdk::noInputWithOutputHost();
149+
- lang: python
150+
source: |
151+
return no_input_with_output_host()
140152
141153
withInputNoOutput:
142154
description: a function that takes input, but returns no output
@@ -166,6 +178,9 @@ exports:
166178
- lang: c++
167179
source: |
168180
return pdk::withInputNoOutputHost(input);
181+
- lang: python
182+
source: |
183+
return with_input_no_output_host(input)
169184
170185
noInputNoOutput:
171186
description: a function that takes no input, and returns no output
@@ -189,6 +204,9 @@ exports:
189204
source: |
190205
pdk::noInputNoOutputHost();
191206
return std::expected<void, pdk::Error>();
207+
- lang: python
208+
source: |
209+
return no_input_no_output_host()
192210
193211
helloToGoodbyeReplacement:
194212
description: a function that should replace `Hello` with `Goodbye` within a byte buffer field on KitchenSinkObject
@@ -253,6 +271,9 @@ exports:
253271
input.aBuffer = std::vector<uint8_t>(pString, pString + tomodify.size());
254272
}
255273
return std::make_unique<pdk::KitchenSinkObject>(std::move(input));
274+
- lang: python
275+
source: |
276+
input.aBuffer = input.aBuffer.replace(b"Hello", b"Goodbye"); return input
256277
257278
imports:
258279
reflectJsonObjectHost:

0 commit comments

Comments
 (0)