Skip to content

Commit

Permalink
chore: add Python example code (#14)
Browse files Browse the repository at this point in the history
  • Loading branch information
zshipko authored Sep 26, 2024
1 parent 5e3013e commit b941c74
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions schema.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ exports:
- lang: c++
source: |
return pdk::reflectJsonObjectHost(std::move(input));
- lang: python
source: |
return reflect_json_object_host(input)
input:
contentType: application/json
$ref: "#/components/schemas/KitchenSinkObject"
Expand Down Expand Up @@ -63,6 +66,9 @@ exports:
- lang: c++
source: |
return pdk::reflectUtf8StringHost(std::move(input));
- lang: python
source: |
return reflect_utf8_string_host(input)
input:
type: string
description: The input string
Expand Down Expand Up @@ -99,6 +105,9 @@ exports:
- lang: c++
source: |
return pdk::reflectByteBufferHost(std::move(input));
- lang: python
source: |
return reflect_byte_buffer_host(input)
input:
contentType: application/x-binary
type: buffer
Expand Down Expand Up @@ -137,6 +146,9 @@ exports:
- lang: c++
source: |
return pdk::noInputWithOutputHost();
- lang: python
source: |
return no_input_with_output_host()
withInputNoOutput:
description: a function that takes input, but returns no output
Expand Down Expand Up @@ -166,6 +178,9 @@ exports:
- lang: c++
source: |
return pdk::withInputNoOutputHost(input);
- lang: python
source: |
return with_input_no_output_host(input)
noInputNoOutput:
description: a function that takes no input, and returns no output
Expand All @@ -189,6 +204,9 @@ exports:
source: |
pdk::noInputNoOutputHost();
return std::expected<void, pdk::Error>();
- lang: python
source: |
return no_input_no_output_host()
helloToGoodbyeReplacement:
description: a function that should replace `Hello` with `Goodbye` within a byte buffer field on KitchenSinkObject
Expand Down Expand Up @@ -253,6 +271,9 @@ exports:
input.aBuffer = std::vector<uint8_t>(pString, pString + tomodify.size());
}
return std::make_unique<pdk::KitchenSinkObject>(std::move(input));
- lang: python
source: |
input.aBuffer = input.aBuffer.replace(b"Hello", b"Goodbye"); return input
imports:
reflectJsonObjectHost:
Expand Down

0 comments on commit b941c74

Please sign in to comment.