From b941c74e74a7d51e0bd7fe4a84e1219e4c5feaea Mon Sep 17 00:00:00 2001 From: zach Date: Thu, 26 Sep 2024 10:54:13 -0700 Subject: [PATCH] chore: add Python example code (#14) --- schema.yaml | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/schema.yaml b/schema.yaml index 04ed963..1fd9f6f 100644 --- a/schema.yaml +++ b/schema.yaml @@ -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" @@ -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 @@ -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 @@ -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 @@ -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 @@ -189,6 +204,9 @@ exports: source: | pdk::noInputNoOutputHost(); return std::expected(); + - 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 @@ -253,6 +271,9 @@ exports: input.aBuffer = std::vector(pString, pString + tomodify.size()); } return std::make_unique(std::move(input)); + - lang: python + source: | + input.aBuffer = input.aBuffer.replace(b"Hello", b"Goodbye"); return input imports: reflectJsonObjectHost: