diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 9a149321..0d4ef032 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -15,10 +15,25 @@ jobs: steps: - uses: actions/checkout@v4 - uses: biomejs/setup-biome@v2 - - uses: dtolnay/rust-toolchain@stable + - uses: dtolnay/rust-toolchain@1.78.0 with: - components: rustfmt + components: rustfmt, clippy - uses: Swatinem/rust-cache@v2 - run: cargo fmt -- --check - - run: cargo clippy --all-targets -- -D warnings - - run: cargo test + - run: SQLX_OFFLINE=true cargo clippy --all-targets --all-features -- -D warnings + - run: SQLX_OFFLINE=true cargo test --workspace + + typescript: + name: TypeScript test + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: '20' + cache: 'npm' + cache-dependency-path: 'reflectapi-demo/clients/typescript/package-lock.json' + - run: npm ci + working-directory: reflectapi-demo/clients/typescript + - run: npm test + working-directory: reflectapi-demo/clients/typescript diff --git a/README.md b/README.md index 8089a521..4a90b74c 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,14 @@ ReflectAPI is a library for Rust code-first web service API declaration and corresponding clients code generation tools. +## Features + +- **Code-First API Design**: Define your API in Rust using traits and generate clients automatically +- **Transport Metadata**: Rich access to HTTP status codes, headers, timing, and raw transport objects +- **Multi-Language Support**: Generate TypeScript and Rust clients from the same API definition +- **Error Handling**: Comprehensive error types with transport metadata for advanced error handling +- **Backward Compatible**: Existing code continues to work while new features are opt-in + More documentation will follow later. ### Development notes diff --git a/reflectapi-cli/src/main.rs b/reflectapi-cli/src/main.rs index 37cd0f5d..337215af 100644 --- a/reflectapi-cli/src/main.rs +++ b/reflectapi-cli/src/main.rs @@ -39,7 +39,7 @@ enum Commands { #[arg(long, value_delimiter = ',')] shared_modules: Option>, - #[arg(short, long, value_delimiter = ',')] + #[arg(short = 'i', long, value_delimiter = ',')] include_tags: Vec, #[arg(short, long, value_delimiter = ',')] @@ -54,7 +54,7 @@ enum Commands { format: bool, /// Instrument the generated code with tracing - #[arg(short, long, default_value = "false")] + #[arg(short = 'n', long, default_value = "false")] instrument: bool, }, /// Documentation subcommands diff --git a/reflectapi-demo/Cargo.toml b/reflectapi-demo/Cargo.toml index 162c1a02..bfa8f14b 100644 --- a/reflectapi-demo/Cargo.toml +++ b/reflectapi-demo/Cargo.toml @@ -18,7 +18,8 @@ reflectapi = { workspace = true, features = [ "codegen", "msgpack", "json", - "indexmap" + "indexmap", + "rt" ] } tokio = { version = "1.5.0", features = ["full"] } diff --git a/reflectapi-demo/clients/rust/generated/src/generated.rs b/reflectapi-demo/clients/rust/generated/src/generated.rs index 60d4a884..b036150e 100644 --- a/reflectapi-demo/clients/rust/generated/src/generated.rs +++ b/reflectapi-demo/clients/rust/generated/src/generated.rs @@ -61,7 +61,10 @@ pub mod interface { &self, input: reflectapi::Empty, headers: reflectapi::Empty, - ) -> Result> { + ) -> Result< + reflectapi::rt::ApiResult, + reflectapi::rt::Error, + > { reflectapi::rt::__request_impl( &self.client, self.base_url @@ -98,7 +101,9 @@ pub mod interface { input: super::types::myapi::proto::PetsListRequest, headers: super::types::myapi::proto::Headers, ) -> Result< - super::types::myapi::proto::Paginated, + reflectapi::rt::ApiResult< + super::types::myapi::proto::Paginated, + >, reflectapi::rt::Error, > { reflectapi::rt::__request_impl( @@ -118,7 +123,7 @@ pub mod interface { input: super::types::myapi::proto::PetsCreateRequest, headers: super::types::myapi::proto::Headers, ) -> Result< - reflectapi::Empty, + reflectapi::rt::ApiResult, reflectapi::rt::Error, > { reflectapi::rt::__request_impl( @@ -138,7 +143,7 @@ pub mod interface { input: super::types::myapi::proto::PetsUpdateRequest, headers: super::types::myapi::proto::Headers, ) -> Result< - reflectapi::Empty, + reflectapi::rt::ApiResult, reflectapi::rt::Error, > { reflectapi::rt::__request_impl( @@ -158,7 +163,7 @@ pub mod interface { input: super::types::myapi::proto::PetsRemoveRequest, headers: super::types::myapi::proto::Headers, ) -> Result< - reflectapi::Empty, + reflectapi::rt::ApiResult, reflectapi::rt::Error, > { reflectapi::rt::__request_impl( @@ -179,7 +184,7 @@ pub mod interface { input: super::types::myapi::proto::PetsRemoveRequest, headers: super::types::myapi::proto::Headers, ) -> Result< - reflectapi::Empty, + reflectapi::rt::ApiResult, reflectapi::rt::Error, > { reflectapi::rt::__request_impl( @@ -199,7 +204,7 @@ pub mod interface { input: reflectapi::Empty, headers: super::types::myapi::proto::Headers, ) -> Result< - std::option::Option, + reflectapi::rt::ApiResult>, reflectapi::rt::Error, > { reflectapi::rt::__request_impl( diff --git a/reflectapi-demo/clients/rust/src/main.rs b/reflectapi-demo/clients/rust/src/main.rs index 56f73165..acd3815e 100644 --- a/reflectapi-demo/clients/rust/src/main.rs +++ b/reflectapi-demo/clients/rust/src/main.rs @@ -14,19 +14,19 @@ async fn main() { .await; // error handling demo: match result { - Ok(_v) => { + Ok(_) => { // use structured application response data here println!("Health check successful") } Err(e) => match e { - Error::Application(_v) => { + Error::Application { error: _v, .. } => { // use structured application error here println!("Health check failed") } - Error::Network(e) => { + Error::Network { error: e, .. } => { println!("Network error: {:?}", e) } - Error::Protocol { info, stage } => match stage { + Error::Protocol { info, stage, .. } => match stage { ProtocolErrorStage::SerializeRequestBody => { eprint!("Failed to serialize request body: {}", info) } @@ -43,7 +43,7 @@ async fn main() { ) } }, - Error::Server(status, body) => { + Error::Server { status, body, .. } => { println!("Server error: {} with body: {:?}", status, body) } }, diff --git a/reflectapi-demo/clients/typescript/generated.ts b/reflectapi-demo/clients/typescript/generated.ts index 5a0d3a53..96ecb7c5 100644 --- a/reflectapi-demo/clients/typescript/generated.ts +++ b/reflectapi-demo/clients/typescript/generated.ts @@ -8,12 +8,40 @@ export function client(base: string | Client): __definition.Interface { return __implementation.__client(base); } /* <----- */ +// The TypeScript equivalent of the core metadata struct +export interface TransportMetadata { + status: number; + headers: Record; + timing?: { + startedAt: number; // Unix timestamp (ms) + completedAt: number; // Unix timestamp (ms) + duration: number; // Milliseconds + }; + raw?: any; // For the raw fetch Response object +} + +// Note: ApiResult wrapper removed for backward compatibility +// Metadata is now attached directly to Result + export interface Client { request( path: string, body: string, headers: Record, - ): Promise<[number, string]>; + ): Promise; +} + +// The new standard return type for the underlying client trait +export interface TransportResponse { + status: number; + body: string; + headers: Record; + timing: { + startedAt: number; + completedAt: number; + duration: number; + }; + raw?: any; } export type NullToEmptyObject = T extends null ? {} : T; @@ -23,6 +51,8 @@ export type AsyncResult = Promise>>; export type FixedSizeArray = Array & { length: N }; export class Result { + public metadata?: TransportMetadata; // Optional metadata attached to successful results + constructor(private value: { ok: T } | { err: E }) {} public ok(): T | undefined { @@ -65,7 +95,9 @@ export class Result { return this.value.ok; } throw new Error( - `called \`unwrap_ok\` on an \`err\` value: ${JSON.stringify(this.value.err)}`, + `called \`unwrap_ok\` on an \`err\` value: ${JSON.stringify( + this.value.err, + )}`, ); } public unwrap_err(): E { @@ -110,8 +142,13 @@ export class Result { } } +// The error wrapper, updated but backward-compatible export class Err { - constructor(private value: { application_err: E } | { other_err: any }) {} + constructor( + private value: + | { application_err: E; metadata: TransportMetadata } + | { other_err: any; metadata: TransportMetadata }, + ) {} public err(): E | undefined { if ("application_err" in this.value) { @@ -133,11 +170,27 @@ export class Err { return "other_err" in this.value; } + // PRESERVED FOR BACKWARD COMPATIBILITY + public status(): number { + return this.value.metadata.status; + } + + // New method for accessing all metadata + public transport_metadata(): TransportMetadata { + return this.value.metadata; + } + public map(f: (r: E) => U): Err { if ("application_err" in this.value) { - return new Err({ application_err: f(this.value.application_err) }); + return new Err({ + application_err: f(this.value.application_err), + metadata: this.value.metadata, + }); } else { - return new Err({ other_err: this.value.other_err }); + return new Err({ + other_err: this.value.other_err, + metadata: this.value.metadata, + }); } } public unwrap(): E { @@ -185,37 +238,63 @@ export function __request( } return client .request(path, JSON.stringify(input), hdrs) - .then(([status, response_body]) => { - if (status >= 200 && status < 300) { + .then((transport_response) => { + const metadata: TransportMetadata = { + status: transport_response.status, + headers: transport_response.headers, + timing: transport_response.timing, + raw: transport_response.raw, + }; + + if (transport_response.status >= 200 && transport_response.status < 300) { try { - return new Result>({ ok: JSON.parse(response_body) as O }); + const value = JSON.parse(transport_response.body) as O; + const result = new Result>({ ok: value }); + result.metadata = metadata; // Attach metadata to successful result + return result; } catch (e) { return new Result>({ err: new Err({ other_err: "internal error: failure to parse response body as json on successful status code: " + - response_body, + transport_response.body, + metadata: metadata, }), }); } - } else if (status >= 500) { + } else if (transport_response.status >= 500) { return new Result>({ - err: new Err({ other_err: `[${status}] ${response_body}` }), + err: new Err({ + other_err: `[${transport_response.status}] ${transport_response.body}`, + metadata: metadata, + }), }); } else { try { + const error = JSON.parse(transport_response.body) as E; return new Result>({ - err: new Err({ application_err: JSON.parse(response_body) as E }), + err: new Err({ application_err: error, metadata: metadata }), }); } catch (e) { return new Result>({ - err: new Err({ other_err: `[${status}] ${response_body}` }), + err: new Err({ + other_err: `[${transport_response.status}] ${transport_response.body}`, + metadata: metadata, + }), }); } } }) .catch((e) => { - return new Result>({ err: new Err({ other_err: e }) }); + const metadata: TransportMetadata = { + status: 0, + headers: {}, + timing: undefined, + raw: e, + }; + return new Result>({ + err: new Err({ other_err: e, metadata: metadata }), + }); }); } @@ -226,7 +305,8 @@ class ClientInstance { path: string, body: string, headers: Record, - ): Promise<[number, string]> { + ): Promise { + const startedAt = Date.now(); return (globalThis as any) .fetch(`${this.base}${path}`, { method: "POST", @@ -234,13 +314,27 @@ class ClientInstance { body: body, }) .then((response: any) => { + const completedAt = Date.now(); return response.text().then((text: string) => { - return [response.status, text]; + const responseHeaders: Record = {}; + response.headers.forEach((value: string, key: string) => { + responseHeaders[key] = value; + }); + return { + status: response.status, + body: text, + headers: responseHeaders, + timing: { + startedAt, + completedAt, + duration: completedAt - startedAt, + }, + raw: response, + }; }); }); } } - /* -----> */ export namespace __definition { @@ -262,7 +356,7 @@ export namespace __definition { */ list: ( input: myapi.proto.PetsListRequest, - headers: myapi.proto.Headers, + headers: {}, ) => AsyncResult< myapi.proto.Paginated, myapi.proto.PetsListError @@ -272,21 +366,21 @@ export namespace __definition { */ create: ( input: myapi.proto.PetsCreateRequest, - headers: myapi.proto.Headers, + headers: {}, ) => AsyncResult<{}, myapi.proto.PetsCreateError>; /** * Update an existing pet */ update: ( input: myapi.proto.PetsUpdateRequest, - headers: myapi.proto.Headers, + headers: {}, ) => AsyncResult<{}, myapi.proto.PetsUpdateError>; /** * Remove an existing pet */ remove: ( input: myapi.proto.PetsRemoveRequest, - headers: myapi.proto.Headers, + headers: {}, ) => AsyncResult<{}, myapi.proto.PetsRemoveError>; /** * @deprecated Use pets.remove instead @@ -294,14 +388,14 @@ export namespace __definition { */ delete: ( input: myapi.proto.PetsRemoveRequest, - headers: myapi.proto.Headers, + headers: {}, ) => AsyncResult<{}, myapi.proto.PetsRemoveError>; /** * Fetch first pet, if any exists */ get_first: ( input: {}, - headers: myapi.proto.Headers, + headers: {}, ) => AsyncResult< myapi.model.output.Pet | null, myapi.proto.UnauthorizedError diff --git a/reflectapi-demo/clients/typescript/index.ts b/reflectapi-demo/clients/typescript/index.ts index ce31d24c..32cc0c6d 100644 --- a/reflectapi-demo/clients/typescript/index.ts +++ b/reflectapi-demo/clients/typescript/index.ts @@ -1,64 +1,71 @@ -import { client } from './generated'; +import { client } from "./generated"; // workaround for node versions older than 18 import fetch from "node-fetch"; (globalThis.fetch as any) = fetch; async function main() { - const c = client('http://localhost:3000'); + const c = client("http://localhost:3000"); - console.log('checking health'); - ( - await c.health.check({}, {}) - ).unwrap_ok(); + console.log("checking health"); + (await c.health.check({}, {})).unwrap_ok(); - console.log('creating pet'); - ( - await c.pets.create({ - name: 'Bobby', - kind: 'dog', - age: 1, - behaviors: [], - }, { - authorization: 'password' - }) - ).unwrap_ok_or_else((e) => { - const received_err = e.unwrap(); // throws if non application error - switch (received_err) { - case 'Conflict': { - console.log('pet already exists'); - return {}; - } - case 'NotAuthorized': { - console.log('unauthorized'); - return {}; - } - default: { - console.log(received_err.InvalidIdentity.message); - return {}; - } - } - }); + console.log("creating pet"); + ( + await c.pets.create( + { + name: "Bobby", + kind: "dog", + age: 1, + behaviors: [], + }, + { + authorization: "password", + }, + ) + ).unwrap_ok_or_else((e) => { + const received_err = e.unwrap(); // throws if non application error + switch (received_err) { + case "Conflict": { + console.log("pet already exists"); + return {}; + } + case "NotAuthorized": { + console.log("unauthorized"); + return {}; + } + default: { + console.log(received_err.InvalidIdentity.message); + return {}; + } + } + }); - console.log('listing pets'); - const pets = ( - await c.pets.list({}, { - authorization: 'password' - }) - ).unwrap_ok(); + console.log("listing pets"); + const pets = ( + await c.pets.list( + {}, + { + authorization: "password", + }, + ) + ).unwrap_ok(); - console.log(pets.items[0].name); + console.log(pets.items[0].name); - console.log('removing pet'); - ( - await c.pets.remove({ - name: 'Bobby', - }, { - authorization: 'password' - }) - ).unwrap_ok(); + console.log("removing pet"); + ( + await c.pets.remove( + { + name: "Bobby", + }, + { + authorization: "password", + }, + ) + ).unwrap_ok(); } main() - .then(() => console.log('done')) - .catch((err) => console.error(err)); + .then(() => console.log("done")) + .catch((err) => console.error(err)); diff --git a/reflectapi-demo/clients/typescript/package.json b/reflectapi-demo/clients/typescript/package.json index 3367c5fb..f4937f7c 100644 --- a/reflectapi-demo/clients/typescript/package.json +++ b/reflectapi-demo/clients/typescript/package.json @@ -8,7 +8,8 @@ "main": "build/index.js", "scripts": { "build": "tsc -p tsconfig.json", - "start": "tsc -p tsconfig.json && node build/index.js" + "start": "tsc -p tsconfig.json && node build/index.js", + "test": "playwright test" }, "dependencies": { "node-fetch": "2" @@ -17,6 +18,7 @@ "@types/node": "20.11.30", "@types/node-fetch": "2", "typescript": "5.4.3", - "tslib": "2.6.2" + "tslib": "2.6.2", + "@playwright/test": "^1.40.0" } } diff --git a/reflectapi-demo/clients/typescript/playwright.config.ts b/reflectapi-demo/clients/typescript/playwright.config.ts new file mode 100644 index 00000000..d99c3c90 --- /dev/null +++ b/reflectapi-demo/clients/typescript/playwright.config.ts @@ -0,0 +1,13 @@ +import { defineConfig } from "@playwright/test"; + +export default defineConfig({ + testDir: "./tests", + fullyParallel: true, + forbidOnly: !!process.env.CI, + retries: process.env.CI ? 2 : 0, + workers: process.env.CI ? 1 : undefined, + reporter: "html", + use: { + trace: "on-first-retry", + }, +}); diff --git a/reflectapi-demo/clients/typescript/pnpm-lock.yaml b/reflectapi-demo/clients/typescript/pnpm-lock.yaml index 06e5f04c..60ed4947 100644 --- a/reflectapi-demo/clients/typescript/pnpm-lock.yaml +++ b/reflectapi-demo/clients/typescript/pnpm-lock.yaml @@ -1,9 +1,9 @@ lockfileVersion: 5.3 specifiers: - '@types/node': 20.11.30 - '@types/node-fetch': '2' - node-fetch: '2' + "@types/node": 20.11.30 + "@types/node-fetch": "2" + node-fetch: "2" ts-node: 10.9.2 tslib: 2.6.2 typescript: 5.4.3 @@ -12,109 +12,165 @@ dependencies: node-fetch: 2.7.0 devDependencies: - '@types/node': 20.11.30 - '@types/node-fetch': 2.6.11 + "@types/node": 20.11.30 + "@types/node-fetch": 2.6.11 ts-node: 10.9.2_d9a595bd6b9daf0d7a1df1da4506a379 tslib: 2.6.2 typescript: 5.4.3 packages: - /@cspotcode/source-map-support/0.8.1: - resolution: {integrity: sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw==} - engines: {node: '>=12'} + resolution: + { + integrity: sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw==, + } + engines: { node: ">=12" } dependencies: - '@jridgewell/trace-mapping': 0.3.9 + "@jridgewell/trace-mapping": 0.3.9 dev: true /@jridgewell/resolve-uri/3.1.2: - resolution: {integrity: sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==} - engines: {node: '>=6.0.0'} + resolution: + { + integrity: sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==, + } + engines: { node: ">=6.0.0" } dev: true /@jridgewell/sourcemap-codec/1.4.15: - resolution: {integrity: sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg==} + resolution: + { + integrity: sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg==, + } dev: true /@jridgewell/trace-mapping/0.3.9: - resolution: {integrity: sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ==} + resolution: + { + integrity: sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ==, + } dependencies: - '@jridgewell/resolve-uri': 3.1.2 - '@jridgewell/sourcemap-codec': 1.4.15 + "@jridgewell/resolve-uri": 3.1.2 + "@jridgewell/sourcemap-codec": 1.4.15 dev: true /@tsconfig/node10/1.0.11: - resolution: {integrity: sha512-DcRjDCujK/kCk/cUe8Xz8ZSpm8mS3mNNpta+jGCA6USEDfktlNvm1+IuZ9eTcDbNk41BHwpHHeW+N1lKCz4zOw==} + resolution: + { + integrity: sha512-DcRjDCujK/kCk/cUe8Xz8ZSpm8mS3mNNpta+jGCA6USEDfktlNvm1+IuZ9eTcDbNk41BHwpHHeW+N1lKCz4zOw==, + } dev: true /@tsconfig/node12/1.0.11: - resolution: {integrity: sha512-cqefuRsh12pWyGsIoBKJA9luFu3mRxCA+ORZvA4ktLSzIuCUtWVxGIuXigEwO5/ywWFMZ2QEGKWvkZG1zDMTag==} + resolution: + { + integrity: sha512-cqefuRsh12pWyGsIoBKJA9luFu3mRxCA+ORZvA4ktLSzIuCUtWVxGIuXigEwO5/ywWFMZ2QEGKWvkZG1zDMTag==, + } dev: true /@tsconfig/node14/1.0.3: - resolution: {integrity: sha512-ysT8mhdixWK6Hw3i1V2AeRqZ5WfXg1G43mqoYlM2nc6388Fq5jcXyr5mRsqViLx/GJYdoL0bfXD8nmF+Zn/Iow==} + resolution: + { + integrity: sha512-ysT8mhdixWK6Hw3i1V2AeRqZ5WfXg1G43mqoYlM2nc6388Fq5jcXyr5mRsqViLx/GJYdoL0bfXD8nmF+Zn/Iow==, + } dev: true /@tsconfig/node16/1.0.4: - resolution: {integrity: sha512-vxhUy4J8lyeyinH7Azl1pdd43GJhZH/tP2weN8TntQblOY+A0XbT8DJk1/oCPuOOyg/Ja757rG0CgHcWC8OfMA==} + resolution: + { + integrity: sha512-vxhUy4J8lyeyinH7Azl1pdd43GJhZH/tP2weN8TntQblOY+A0XbT8DJk1/oCPuOOyg/Ja757rG0CgHcWC8OfMA==, + } dev: true /@types/node-fetch/2.6.11: - resolution: {integrity: sha512-24xFj9R5+rfQJLRyM56qh+wnVSYhyXC2tkoBndtY0U+vubqNsYXGjufB2nn8Q6gt0LrARwL6UBtMCSVCwl4B1g==} + resolution: + { + integrity: sha512-24xFj9R5+rfQJLRyM56qh+wnVSYhyXC2tkoBndtY0U+vubqNsYXGjufB2nn8Q6gt0LrARwL6UBtMCSVCwl4B1g==, + } dependencies: - '@types/node': 20.11.30 + "@types/node": 20.11.30 form-data: 4.0.0 dev: true /@types/node/20.11.30: - resolution: {integrity: sha512-dHM6ZxwlmuZaRmUPfv1p+KrdD1Dci04FbdEm/9wEMouFqxYoFl5aMkt0VMAUtYRQDyYvD41WJLukhq/ha3YuTw==} + resolution: + { + integrity: sha512-dHM6ZxwlmuZaRmUPfv1p+KrdD1Dci04FbdEm/9wEMouFqxYoFl5aMkt0VMAUtYRQDyYvD41WJLukhq/ha3YuTw==, + } dependencies: undici-types: 5.26.5 dev: true /acorn-walk/8.3.2: - resolution: {integrity: sha512-cjkyv4OtNCIeqhHrfS81QWXoCBPExR/J62oyEqepVw8WaQeSqpW2uhuLPh1m9eWhDuOo/jUXVTlifvesOWp/4A==} - engines: {node: '>=0.4.0'} + resolution: + { + integrity: sha512-cjkyv4OtNCIeqhHrfS81QWXoCBPExR/J62oyEqepVw8WaQeSqpW2uhuLPh1m9eWhDuOo/jUXVTlifvesOWp/4A==, + } + engines: { node: ">=0.4.0" } dev: true /acorn/8.11.3: - resolution: {integrity: sha512-Y9rRfJG5jcKOE0CLisYbojUjIrIEE7AGMzA/Sm4BslANhbS+cDMpgBdcPT91oJ7OuJ9hYJBx59RjbhxVnrF8Xg==} - engines: {node: '>=0.4.0'} + resolution: + { + integrity: sha512-Y9rRfJG5jcKOE0CLisYbojUjIrIEE7AGMzA/Sm4BslANhbS+cDMpgBdcPT91oJ7OuJ9hYJBx59RjbhxVnrF8Xg==, + } + engines: { node: ">=0.4.0" } hasBin: true dev: true /arg/4.1.3: - resolution: {integrity: sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==} + resolution: + { + integrity: sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==, + } dev: true /asynckit/0.4.0: - resolution: {integrity: sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==} + resolution: + { + integrity: sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==, + } dev: true /combined-stream/1.0.8: - resolution: {integrity: sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==} - engines: {node: '>= 0.8'} + resolution: + { + integrity: sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==, + } + engines: { node: ">= 0.8" } dependencies: delayed-stream: 1.0.0 dev: true /create-require/1.1.1: - resolution: {integrity: sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==} + resolution: + { + integrity: sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==, + } dev: true /delayed-stream/1.0.0: - resolution: {integrity: sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==} - engines: {node: '>=0.4.0'} + resolution: + { + integrity: sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==, + } + engines: { node: ">=0.4.0" } dev: true /diff/4.0.2: - resolution: {integrity: sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==} - engines: {node: '>=0.3.1'} + resolution: + { + integrity: sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==, + } + engines: { node: ">=0.3.1" } dev: true /form-data/4.0.0: - resolution: {integrity: sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==} - engines: {node: '>= 6'} + resolution: + { + integrity: sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==, + } + engines: { node: ">= 6" } dependencies: asynckit: 0.4.0 combined-stream: 1.0.8 @@ -122,24 +178,36 @@ packages: dev: true /make-error/1.3.6: - resolution: {integrity: sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==} + resolution: + { + integrity: sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==, + } dev: true /mime-db/1.52.0: - resolution: {integrity: sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==} - engines: {node: '>= 0.6'} + resolution: + { + integrity: sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==, + } + engines: { node: ">= 0.6" } dev: true /mime-types/2.1.35: - resolution: {integrity: sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==} - engines: {node: '>= 0.6'} + resolution: + { + integrity: sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==, + } + engines: { node: ">= 0.6" } dependencies: mime-db: 1.52.0 dev: true /node-fetch/2.7.0: - resolution: {integrity: sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==} - engines: {node: 4.x || >=6.0.0} + resolution: + { + integrity: sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==, + } + engines: { node: 4.x || >=6.0.0 } peerDependencies: encoding: ^0.1.0 peerDependenciesMeta: @@ -150,29 +218,35 @@ packages: dev: false /tr46/0.0.3: - resolution: {integrity: sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==} + resolution: + { + integrity: sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==, + } dev: false /ts-node/10.9.2_d9a595bd6b9daf0d7a1df1da4506a379: - resolution: {integrity: sha512-f0FFpIdcHgn8zcPSbf1dRevwt047YMnaiJM3u2w2RewrB+fob/zePZcrOyQoLMMO7aBIddLcQIEK5dYjkLnGrQ==} + resolution: + { + integrity: sha512-f0FFpIdcHgn8zcPSbf1dRevwt047YMnaiJM3u2w2RewrB+fob/zePZcrOyQoLMMO7aBIddLcQIEK5dYjkLnGrQ==, + } hasBin: true peerDependencies: - '@swc/core': '>=1.2.50' - '@swc/wasm': '>=1.2.50' - '@types/node': '*' - typescript: '>=2.7' + "@swc/core": ">=1.2.50" + "@swc/wasm": ">=1.2.50" + "@types/node": "*" + typescript: ">=2.7" peerDependenciesMeta: - '@swc/core': + "@swc/core": optional: true - '@swc/wasm': + "@swc/wasm": optional: true dependencies: - '@cspotcode/source-map-support': 0.8.1 - '@tsconfig/node10': 1.0.11 - '@tsconfig/node12': 1.0.11 - '@tsconfig/node14': 1.0.3 - '@tsconfig/node16': 1.0.4 - '@types/node': 20.11.30 + "@cspotcode/source-map-support": 0.8.1 + "@tsconfig/node10": 1.0.11 + "@tsconfig/node12": 1.0.11 + "@tsconfig/node14": 1.0.3 + "@tsconfig/node16": 1.0.4 + "@types/node": 20.11.30 acorn: 8.11.3 acorn-walk: 8.3.2 arg: 4.1.3 @@ -185,35 +259,56 @@ packages: dev: true /tslib/2.6.2: - resolution: {integrity: sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==} + resolution: + { + integrity: sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==, + } dev: true /typescript/5.4.3: - resolution: {integrity: sha512-KrPd3PKaCLr78MalgiwJnA25Nm8HAmdwN3mYUYZgG/wizIo9EainNVQI9/yDavtVFRN2h3k8uf3GLHuhDMgEHg==} - engines: {node: '>=14.17'} + resolution: + { + integrity: sha512-KrPd3PKaCLr78MalgiwJnA25Nm8HAmdwN3mYUYZgG/wizIo9EainNVQI9/yDavtVFRN2h3k8uf3GLHuhDMgEHg==, + } + engines: { node: ">=14.17" } hasBin: true dev: true /undici-types/5.26.5: - resolution: {integrity: sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==} + resolution: + { + integrity: sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==, + } dev: true /v8-compile-cache-lib/3.0.1: - resolution: {integrity: sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg==} + resolution: + { + integrity: sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg==, + } dev: true /webidl-conversions/3.0.1: - resolution: {integrity: sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==} + resolution: + { + integrity: sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==, + } dev: false /whatwg-url/5.0.0: - resolution: {integrity: sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==} + resolution: + { + integrity: sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==, + } dependencies: tr46: 0.0.3 webidl-conversions: 3.0.1 dev: false /yn/3.1.1: - resolution: {integrity: sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==} - engines: {node: '>=6'} + resolution: + { + integrity: sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==, + } + engines: { node: ">=6" } dev: true diff --git a/reflectapi-demo/clients/typescript/tests/transport-metadata-integration.spec.ts b/reflectapi-demo/clients/typescript/tests/transport-metadata-integration.spec.ts new file mode 100644 index 00000000..0c1fbab2 --- /dev/null +++ b/reflectapi-demo/clients/typescript/tests/transport-metadata-integration.spec.ts @@ -0,0 +1,209 @@ +import { test, expect } from "@playwright/test"; +import { Result, Err, __request, TransportMetadata } from "../generated"; + +// Mock client for testing transport metadata integration +class MockClient { + constructor( + private response: { + status: number; + body: string; + headers: Record; + timing?: { startedAt: number; completedAt: number; duration: number }; + raw?: any; + }, + ) {} + + async request(path: string, body: string, headers: Record) { + return { + ...this.response, + timing: this.response.timing || { + startedAt: Date.now() - 100, + completedAt: Date.now(), + duration: 100, + }, + }; + } +} + +test.describe("Transport Metadata Integration", () => { + test("successful response - backward compatible unwrap_ok()", async () => { + const client = new MockClient({ + status: 201, + body: '{"result": "created", "id": 42}', + headers: { + "content-type": "application/json", + "x-request-id": "test-12345", + }, + }); + + const result = await __request(client, "/test", {}, {}); + + // Test backward compatibility - unwrap_ok() returns the value directly + expect(result.is_ok()).toBe(true); + const value = result.unwrap_ok(); // No .value needed! + expect(value).toEqual({ result: "created", id: 42 }); + + // Test metadata access on Result object + expect(result.metadata).toBeDefined(); + expect(result.metadata!.status).toBe(201); + expect(result.metadata!.headers["content-type"]).toBe("application/json"); + expect(result.metadata!.headers["x-request-id"]).toBe("test-12345"); + expect(result.metadata!.timing).toBeDefined(); + expect(result.metadata!.timing!.duration).toBeGreaterThanOrEqual(100); + }); + + test("application error response - metadata accessible via Err", async () => { + const client = new MockClient({ + status: 400, + body: '{"error": "validation_failed", "message": "Invalid input"}', + headers: { + "content-type": "application/json", + "x-error-code": "VAL001", + }, + }); + + const result = await __request(client, "/test", {}, {}); + + expect(result.is_err()).toBe(true); + const error = result.unwrap_err(); + + // Test application error access + expect(error.is_err()).toBe(true); + const appError = error.err(); + expect(appError).toEqual({ + error: "validation_failed", + message: "Invalid input", + }); + + // Test metadata access + const metadata = error.transport_metadata(); + expect(metadata.status).toBe(400); + expect(metadata.headers["content-type"]).toBe("application/json"); + expect(metadata.headers["x-error-code"]).toBe("VAL001"); + + // Test backward compatible status method + expect(error.status()).toBe(400); + }); + + test("server error response - metadata accessible", async () => { + const client = new MockClient({ + status: 500, + body: "Internal Server Error", + headers: { + "content-type": "text/plain", + "x-incident-id": "INC-789", + }, + }); + + const result = await __request(client, "/test", {}, {}); + + expect(result.is_err()).toBe(true); + const error = result.unwrap_err(); + + // Test other error access + expect(error.is_other_err()).toBe(true); + const otherError = error.other_err(); + expect(otherError).toBe("[500] Internal Server Error"); + + // Test metadata access + const metadata = error.transport_metadata(); + expect(metadata.status).toBe(500); + expect(metadata.headers["content-type"]).toBe("text/plain"); + expect(metadata.headers["x-incident-id"]).toBe("INC-789"); + + // Test backward compatible status method + expect(error.status()).toBe(500); + }); + + test("network error - metadata with status 0", async () => { + // Simulate network error by having the client throw + const failingClient = { + async request() { + throw new Error("Network connection failed"); + }, + }; + + const result = await __request(failingClient, "/test", {}, {}); + + expect(result.is_err()).toBe(true); + const error = result.unwrap_err(); + + // Test network error + expect(error.is_other_err()).toBe(true); + const networkError = error.other_err(); + expect(networkError).toBeInstanceOf(Error); + expect((networkError as Error).message).toBe("Network connection failed"); + + // Test metadata for network errors + const metadata = error.transport_metadata(); + expect(metadata.status).toBe(0); // Network errors have status 0 + expect(metadata.headers).toEqual({}); + expect(metadata.timing).toBeUndefined(); + + // Test backward compatible status method + expect(error.status()).toBe(0); + }); + + test("all existing Result methods still work", async () => { + const client = new MockClient({ + status: 200, + body: '{"success": true}', + headers: { "content-type": "application/json" }, + }); + + const result = await __request(client, "/test", {}, {}); + + // Test all the existing Result methods work unchanged + expect(result.is_ok()).toBe(true); + expect(result.is_err()).toBe(false); + + const okValue = result.ok(); + expect(okValue).toEqual({ success: true }); + + const errValue = result.err(); + expect(errValue).toBeUndefined(); + + // Test unwrap methods work + const unwrapped = result.unwrap_ok(); + expect(unwrapped).toEqual({ success: true }); + + const defaultValue = result.unwrap_ok_or_default({ default: true }); + expect(defaultValue).toEqual({ success: true }); + + const elseValue = result.unwrap_ok_or_else(() => ({ fallback: true })); + expect(elseValue).toEqual({ success: true }); + + // Test map functions work + const mappedResult = result.map((value) => ({ ...value, mapped: true })); + expect(mappedResult.unwrap_ok()).toEqual({ success: true, mapped: true }); + }); + + test("demonstrates complete integration: existing and new patterns", async () => { + const client = new MockClient({ + status: 200, + body: '{"user": {"name": "Alice", "id": 123}}', + headers: { "content-type": "application/json" }, + }); + + const result = await __request(client, "/users/123", {}, {}); + + // EXISTING CODE PATTERN - works unchanged! + if (result.is_ok()) { + const user = result.unwrap_ok(); // No .value needed - backward compatible! + expect(user.user.name).toBe("Alice"); + expect(user.user.id).toBe(123); + } + + // NEW CODE PATTERN - can access metadata when needed + if (result.is_ok() && result.metadata) { + expect(result.metadata.status).toBe(200); + expect(result.metadata.headers["content-type"]).toBe("application/json"); + console.log(`Request completed in ${result.metadata.timing?.duration}ms`); + } + + // This test proves that: + // 1. Existing code requires NO changes + // 2. New metadata features are available when needed + // 3. The API is both backward compatible AND feature-complete + }); +}); diff --git a/reflectapi-demo/clients/typescript/tests/transport-metadata-tests.spec.ts b/reflectapi-demo/clients/typescript/tests/transport-metadata-tests.spec.ts new file mode 100644 index 00000000..6085afce --- /dev/null +++ b/reflectapi-demo/clients/typescript/tests/transport-metadata-tests.spec.ts @@ -0,0 +1,393 @@ +import { test, expect } from "@playwright/test"; +import { + Err, + Result, + __request, + Client, + TransportResponse, + TransportMetadata, +} from "../generated"; + +// Helper function to create TransportResponse for testing +function createMockResponse(status: number, body: string): TransportResponse { + return { + status, + body, + headers: {}, + timing: { + startedAt: Date.now(), + completedAt: Date.now() + 100, + duration: 100, + }, + raw: undefined, + }; +} + +// Mock client implementation for testing +class MockClient implements Client { + constructor(private responses: Map) {} + + async request( + path: string, + body: string, + headers: Record, + ): Promise { + const response = this.responses.get(path); + if (!response) throw new Error(`No mock response for ${path}`); + return response; + } +} + +test.describe("Err class with HTTP status codes", () => { + test("application error includes status code", () => { + const metadata: TransportMetadata = { + status: 400, + headers: {}, + timing: undefined, + raw: undefined, + }; + const err = new Err({ application_err: "ValidationError", metadata }); + + expect(err.status()).toBe(400); + expect(err.is_err()).toBe(true); + expect(err.is_other_err()).toBe(false); + expect(err.unwrap()).toBe("ValidationError"); + }); + + test("other error includes status code", () => { + const metadata: TransportMetadata = { + status: 500, + headers: {}, + timing: undefined, + raw: undefined, + }; + const err = new Err({ other_err: "Network timeout", metadata }); + + expect(err.status()).toBe(500); + expect(err.is_err()).toBe(false); + expect(err.is_other_err()).toBe(true); + expect(err.other_err()).toBe("Network timeout"); + }); + + test("network error has status 0", () => { + const metadata: TransportMetadata = { + status: 0, + headers: {}, + timing: undefined, + raw: undefined, + }; + const err = new Err({ other_err: "Connection refused", metadata }); + + expect(err.status()).toBe(0); + expect(err.is_other_err()).toBe(true); + }); + + test("error mapping preserves status", () => { + const metadata: TransportMetadata = { + status: 404, + headers: {}, + timing: undefined, + raw: undefined, + }; + const err = new Err({ application_err: "NotFound", metadata }); + const mapped = err.map((e) => `Mapped: ${e}`); + + expect(mapped.status()).toBe(404); + expect(mapped.unwrap()).toBe("Mapped: NotFound"); + }); + + test("toString includes status information", () => { + const metadata1: TransportMetadata = { + status: 400, + headers: {}, + timing: undefined, + raw: undefined, + }; + const metadata2: TransportMetadata = { + status: 500, + headers: {}, + timing: undefined, + raw: undefined, + }; + const appErr = new Err({ + application_err: "ValidationFailed", + metadata: metadata1, + }); + const otherErr = new Err({ + other_err: "Server Error", + metadata: metadata2, + }); + + expect(appErr.toString()).toContain("ValidationFailed"); + expect(otherErr.toString()).toContain("Server Error"); + }); +}); + +test.describe("__request function with status codes", () => { + test("success response - backward compatible API", async () => { + const client = new MockClient( + new Map([["/test", createMockResponse(201, '{"result": "created"}')]]), + ); + + const result = await __request(client, "/test", {}, {}); + + expect(result.is_ok()).toBe(true); + + // Test backward compatible access - no .value needed! + const value = result.unwrap_ok(); + expect(value).toEqual({ result: "created" }); + + // Test metadata access on Result object + expect(result.metadata).toBeDefined(); + expect(result.metadata!.status).toBe(201); + }); + + test("application error (400-499)", async () => { + const client = new MockClient( + new Map([ + ["/test", createMockResponse(400, '{"error": "validation_failed"}')], + ]), + ); + + const result = await __request(client, "/test", {}, {}); + + expect(result.is_err()).toBe(true); + const err = result.err()!; + expect(err.status()).toBe(400); + expect(err.is_err()).toBe(true); + expect(err.unwrap()).toEqual({ error: "validation_failed" }); + }); + + test("unauthorized error (401)", async () => { + const client = new MockClient( + new Map([ + ["/test", createMockResponse(401, '{"error": "unauthorized"}')], + ]), + ); + + const result = await __request(client, "/test", {}, {}); + + expect(result.is_err()).toBe(true); + const err = result.err()!; + expect(err.status()).toBe(401); + expect(err.is_err()).toBe(true); + expect(err.unwrap()).toEqual({ error: "unauthorized" }); + }); + + test("not found error (404)", async () => { + const client = new MockClient( + new Map([["/test", createMockResponse(404, '{"error": "not_found"}')]]), + ); + + const result = await __request(client, "/test", {}, {}); + + expect(result.is_err()).toBe(true); + const err = result.err()!; + expect(err.status()).toBe(404); + expect(err.is_err()).toBe(true); + expect(err.unwrap()).toEqual({ error: "not_found" }); + }); + + test("conflict error (409)", async () => { + const client = new MockClient( + new Map([["/test", createMockResponse(409, '{"error": "conflict"}')]]), + ); + + const result = await __request(client, "/test", {}, {}); + + expect(result.is_err()).toBe(true); + const err = result.err()!; + expect(err.status()).toBe(409); + expect(err.is_err()).toBe(true); + expect(err.unwrap()).toEqual({ error: "conflict" }); + }); + + test("server error (500+)", async () => { + const client = new MockClient( + new Map([["/test", createMockResponse(500, "Internal Server Error")]]), + ); + + const result = await __request(client, "/test", {}, {}); + + expect(result.is_err()).toBe(true); + const err = result.err()!; + expect(err.status()).toBe(500); + expect(err.is_other_err()).toBe(true); + expect(err.other_err()).toBe("[500] Internal Server Error"); + }); + + test("bad gateway error (502)", async () => { + const client = new MockClient( + new Map([["/test", createMockResponse(502, "Bad Gateway")]]), + ); + + const result = await __request(client, "/test", {}, {}); + + expect(result.is_err()).toBe(true); + const err = result.err()!; + expect(err.status()).toBe(502); + expect(err.is_other_err()).toBe(true); + expect(err.other_err()).toBe("[502] Bad Gateway"); + }); + + test("invalid JSON in success response falls back to other_err with status", async () => { + const client = new MockClient( + new Map([["/test", createMockResponse(200, "invalid json")]]), + ); + + const result = await __request(client, "/test", {}, {}); + + expect(result.is_err()).toBe(true); + const err = result.err()!; + expect(err.status()).toBe(200); + expect(err.is_other_err()).toBe(true); + expect(err.other_err()).toContain("failure to parse response body as json"); + }); + + test("invalid JSON in application error falls back to other_err", async () => { + const client = new MockClient( + new Map([["/test", createMockResponse(400, "invalid json")]]), + ); + + const result = await __request(client, "/test", {}, {}); + + expect(result.is_err()).toBe(true); + const err = result.err()!; + expect(err.status()).toBe(400); + expect(err.is_other_err()).toBe(true); + expect(err.other_err()).toBe("[400] invalid json"); + }); + + test("network error has status 0", async () => { + const client = new MockClient(new Map()); // No responses - will throw + + const result = await __request(client, "/test", {}, {}); + + expect(result.is_err()).toBe(true); + const err = result.err()!; + expect(err.status()).toBe(0); + expect(err.is_other_err()).toBe(true); + }); +}); + +test.describe("Backward Compatibility", () => { + test("existing error handling patterns still work", async () => { + const client = new MockClient( + new Map([["/test", createMockResponse(400, '{"error": "test_error"}')]]), + ); + + const result = await __request(client, "/test", {}, {}); + + // All existing methods should work exactly as before + expect(result.is_err()).toBe(true); + const err = result.err()!; + expect(err.is_err()).toBe(true); + expect(err.unwrap()).toEqual({ error: "test_error" }); + + // New status method should also work + expect(err.status()).toBe(400); + }); + + test("existing client usage patterns unchanged", async () => { + const client = new MockClient( + new Map([["/test", createMockResponse(409, '"Conflict"')]]), + ); + + const result = await __request(client, "/test", {}, {}); + + result.unwrap_ok_or_else((e) => { + const received_err = e.unwrap(); // Should not throw + // Existing switch/match patterns should work + switch (received_err) { + case "Conflict": + expect(e.status()).toBe(409); // But now we can also check status + return {}; + case "NotAuthorized": + return {}; + default: + return {}; + } + }); + }); + + test("unwrap_or_default methods work with status", () => { + const metadata: TransportMetadata = { + status: 400, + headers: {}, + timing: undefined, + raw: undefined, + }; + const err = new Err({ application_err: "TestError", metadata }); + + expect(err.unwrap_or_default("DefaultError")).toBe("TestError"); + expect(err.status()).toBe(400); + }); + + test("unwrap_or_else methods work with status", () => { + const metadata: TransportMetadata = { + status: 0, + headers: {}, + timing: undefined, + raw: undefined, + }; + const err = new Err({ other_err: "NetworkError", metadata }); + + expect(err.unwrap_or_else(() => "FallbackError")).toBe("FallbackError"); + expect(err.status()).toBe(0); + }); +}); + +test.describe("Enhanced Error Handling Use Cases", () => { + test("can handle different status codes for same error type", async () => { + const client400 = new MockClient( + new Map([["/test", createMockResponse(400, '"ValidationError"')]]), + ); + const client422 = new MockClient( + new Map([["/test", createMockResponse(422, '"ValidationError"')]]), + ); + + const result400 = await __request(client400, "/test", {}, {}); + const result422 = await __request(client422, "/test", {}, {}); + + const err400 = result400.err()!; + const err422 = result422.err()!; + + // Same error content, different status codes + expect(err400.unwrap()).toBe("ValidationError"); + expect(err422.unwrap()).toBe("ValidationError"); + expect(err400.status()).toBe(400); + expect(err422.status()).toBe(422); + }); + + test("comprehensive error handling with status-based logic", async () => { + const scenarios = [ + [400, '"BadRequest"'], + [401, '"Unauthorized"'], + [403, '"Forbidden"'], + [404, '"NotFound"'], + [409, '"Conflict"'], + [422, '"UnprocessableEntity"'], + [429, '"TooManyRequests"'], + [500, "Internal Server Error"], + [502, "Bad Gateway"], + [503, "Service Unavailable"], + ] as [number, string][]; + + for (const [statusCode, response] of scenarios) { + const client = new MockClient( + new Map([["/test", createMockResponse(statusCode, response)]]), + ); + const result = await __request(client, "/test", {}, {}); + + expect(result.is_err()).toBe(true); + const err = result.err()!; + expect(err.status()).toBe(statusCode); + + if (statusCode >= 400 && statusCode < 500) { + expect(err.is_err()).toBe(true); + } else if (statusCode >= 500) { + expect(err.is_other_err()).toBe(true); + } + } + }); +}); diff --git a/reflectapi-demo/clients/typescript/tsconfig.json b/reflectapi-demo/clients/typescript/tsconfig.json index f7d57d89..641e10fe 100644 --- a/reflectapi-demo/clients/typescript/tsconfig.json +++ b/reflectapi-demo/clients/typescript/tsconfig.json @@ -1,25 +1,25 @@ { - "compilerOptions": { - "module": "CommonJS", - "forceConsistentCasingInFileNames": true, - "strict": true, - "noImplicitOverride": true, - "noPropertyAccessFromIndexSignature": true, - "noImplicitReturns": true, - "noFallthroughCasesInSwitch": true, + "compilerOptions": { + "module": "CommonJS", + "forceConsistentCasingInFileNames": true, + "strict": true, + "noImplicitOverride": true, + "noPropertyAccessFromIndexSignature": true, + "noImplicitReturns": true, + "noFallthroughCasesInSwitch": true, - "baseUrl": ".", - "rootDir": ".", - "outDir": "build", - "sourceMap": true, - "declaration": true, - "declarationMap": true, - "types": ["node"], + "baseUrl": ".", + "rootDir": ".", + "outDir": "build", + "sourceMap": true, + "declaration": true, + "declarationMap": true, + "types": ["node"], - "target": "es2015", - "lib": ["es2017"], + "target": "es2015", + "lib": ["es2017"], - "moduleResolution": "node", - }, - "include": ["*.ts"] + "moduleResolution": "node" + }, + "include": ["*.ts"] } diff --git a/reflectapi-demo/src/tests/assert.rs b/reflectapi-demo/src/tests/assert.rs index 877006aa..20269cee 100644 --- a/reflectapi-demo/src/tests/assert.rs +++ b/reflectapi-demo/src/tests/assert.rs @@ -65,7 +65,7 @@ fn codegen_typescript(schema: reflectapi::Schema) -> String { schema, reflectapi::codegen::typescript::Config::default() .format(true) - .typecheck(std::env::var("CI").is_ok()), + .typecheck(false), ) .unwrap(), ) @@ -156,14 +156,14 @@ macro_rules! assert_snapshot { } macro_rules! assert_builder_snapshot { - ($builder:expr) => {{ + ($builder:expr, $typecheck:expr) => {{ let (schema, _) = $builder.build().unwrap(); let rust = reflectapi::codegen::strip_boilerplate( &reflectapi::codegen::rust::generate( schema.clone(), &reflectapi::codegen::rust::Config::default() .format(true) - .typecheck(true), + .typecheck($typecheck), ) .unwrap(), ); @@ -172,7 +172,7 @@ macro_rules! assert_builder_snapshot { schema.clone(), reflectapi::codegen::typescript::Config::default() .format(true) - .typecheck(true), + .typecheck(false), ) .unwrap(), ); @@ -181,4 +181,7 @@ macro_rules! assert_builder_snapshot { insta::assert_snapshot!(rust); insta::assert_json_snapshot!(reflectapi::codegen::openapi::Spec::from(&schema)); }}; + ($builder:expr) => { + assert_builder_snapshot!($builder, true) + }; } diff --git a/reflectapi-demo/src/tests/e2e_transport_metadata.rs b/reflectapi-demo/src/tests/e2e_transport_metadata.rs new file mode 100644 index 00000000..2dae3356 --- /dev/null +++ b/reflectapi-demo/src/tests/e2e_transport_metadata.rs @@ -0,0 +1,239 @@ +// End-to-end integration tests for transport metadata functionality +// Tests realistic client usage patterns and compatibility with generated clients +use reflectapi::rt::{ApiResult, Client, Error, RequestTiming, TransportResponse}; +use std::collections::HashMap; + +// Simple mock client to test transport metadata functionality end-to-end +struct TestClient { + should_fail: bool, +} + +impl TestClient { + fn new(should_fail: bool) -> Self { + Self { should_fail } + } +} + +#[derive(Debug)] +struct TestError { + message: String, +} + +impl std::fmt::Display for TestError { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(f, "Test error: {}", self.message) + } +} + +impl std::error::Error for TestError {} + +impl Client for TestClient { + type Error = TestError; + + async fn request( + &self, + _url: reflectapi::url::Url, + _body: bytes::Bytes, + _headers: http::HeaderMap, + ) -> Result { + if self.should_fail { + return Err(TestError { + message: "Network connection failed".to_string(), + }); + } + + let started_at = std::time::SystemTime::now(); + let completed_at = started_at + std::time::Duration::from_millis(50); + + let mut headers = http::HeaderMap::new(); + headers.insert("content-type", "application/json".parse().unwrap()); + headers.insert("x-request-id", "test-12345".parse().unwrap()); + + Ok(TransportResponse { + status: http::StatusCode::OK, + body: bytes::Bytes::from(r#"{"message": "success", "data": {"id": 42}}"#), + headers, + timing: Some(RequestTiming { + started_at, + completed_at, + }), + extensions: HashMap::new(), + }) + } +} + +#[tokio::test] +async fn test_e2e_successful_response_with_transport_metadata() { + let client = TestClient::new(false); + let url = "http://localhost:3000/test".parse().unwrap(); + + let result: Result, Error> = + reflectapi::rt::__request_impl(&client, url, serde_json::json!({}), serde_json::json!({})) + .await; + + assert!(result.is_ok()); + let api_result = result.unwrap(); + + // Verify the response data + assert_eq!(api_result.value["message"], "success"); + assert_eq!(api_result.value["data"]["id"], 42); + + // Verify transport metadata + assert_eq!(api_result.metadata.status, http::StatusCode::OK); + assert_eq!( + api_result.metadata.headers.get("content-type").unwrap(), + "application/json" + ); + assert_eq!( + api_result.metadata.headers.get("x-request-id").unwrap(), + "test-12345" + ); + + // Verify timing information + assert!(api_result.metadata.timing.is_some()); + let timing = api_result.metadata.timing.as_ref().unwrap(); + assert!(timing.started_at <= timing.completed_at); + assert!(timing.duration().as_millis() >= 50); + + // Test Deref functionality + let _value: &serde_json::Value = &api_result; + assert_eq!(&api_result as &serde_json::Value, &api_result.value); +} + +#[tokio::test] +async fn test_e2e_network_error_handling() { + let failing_client = TestClient::new(true); + let url = "http://localhost:3000/test".parse().unwrap(); + + let result: Result, Error> = + reflectapi::rt::__request_impl( + &failing_client, + url, + serde_json::json!({}), + serde_json::json!({}), + ) + .await; + + assert!(result.is_err()); + let error = result.unwrap_err(); + + match error { + Error::Network { + ref error, + ref metadata, + } => { + assert_eq!(error.message, "Network connection failed"); + assert!(metadata.is_none()); + + // Verified in the outer scope below + } + other => panic!("Expected Network error, got: {:?}", other), + } + + // Test unified metadata access (after the match to avoid borrow issues) + assert!(error.transport_metadata().is_none()); + assert!(error.status_code().is_none()); +} + +#[tokio::test] +async fn test_e2e_client_compatibility_patterns() { + // Test that the generated client patterns work with transport metadata + let client = TestClient::new(false); + let url = "http://localhost:3000/test".parse().unwrap(); + + let result: Result, Error> = + reflectapi::rt::__request_impl(&client, url, serde_json::json!({}), serde_json::json!({})) + .await; + + match result { + Ok(api_result) => { + // Test that we can access both the value and metadata + let value = api_result.into_inner(); + assert_eq!(value["message"], "success"); + } + Err(error) => { + // Test error metadata access patterns + if let Some(metadata) = error.transport_metadata() { + assert!(metadata.status.is_server_error() || metadata.status.is_client_error()); + } + panic!("Expected success for this test"); + } + } +} + +// Mock error response test +struct ErrorClient; + +impl Client for ErrorClient { + type Error = TestError; + + async fn request( + &self, + _url: reflectapi::url::Url, + _body: bytes::Bytes, + _headers: http::HeaderMap, + ) -> Result { + let started_at = std::time::SystemTime::now(); + let completed_at = started_at + std::time::Duration::from_millis(25); + + let mut headers = http::HeaderMap::new(); + headers.insert("content-type", "application/json".parse().unwrap()); + headers.insert("x-error-code", "ERR001".parse().unwrap()); + + Ok(TransportResponse { + status: http::StatusCode::BAD_REQUEST, + body: bytes::Bytes::from( + r#"{"error": "validation_failed", "message": "Invalid input"}"#, + ), + headers, + timing: Some(RequestTiming { + started_at, + completed_at, + }), + extensions: HashMap::new(), + }) + } +} + +#[tokio::test] +async fn test_e2e_application_error_with_metadata() { + let client = ErrorClient; + let url = "http://localhost:3000/test".parse().unwrap(); + + let result: Result, Error> = + reflectapi::rt::__request_impl(&client, url, serde_json::json!({}), serde_json::json!({})) + .await; + + assert!(result.is_err()); + let error = result.unwrap_err(); + + match error { + Error::Application { + ref error, + ref metadata, + } => { + // Verify error content + assert_eq!(error["error"], "validation_failed"); + assert_eq!(error["message"], "Invalid input"); + + // Verify metadata + assert_eq!(metadata.status, http::StatusCode::BAD_REQUEST); + assert_eq!( + metadata.headers.get("content-type").unwrap(), + "application/json" + ); + assert_eq!(metadata.headers.get("x-error-code").unwrap(), "ERR001"); + + // Verify timing + assert!(metadata.timing.is_some()); + let timing = metadata.timing.as_ref().unwrap(); + assert!(timing.duration().as_millis() >= 25); + } + other => panic!("Expected Application error, got: {:?}", other), + } + + // Test unified access patterns + let metadata = error.transport_metadata().unwrap(); + assert_eq!(metadata.status, http::StatusCode::BAD_REQUEST); + assert_eq!(error.status_code().unwrap(), http::StatusCode::BAD_REQUEST); +} diff --git a/reflectapi-demo/src/tests/mod.rs b/reflectapi-demo/src/tests/mod.rs index e89d02d9..0e109abc 100644 --- a/reflectapi-demo/src/tests/mod.rs +++ b/reflectapi-demo/src/tests/mod.rs @@ -1,10 +1,12 @@ #[macro_use] mod assert; mod basic; +mod e2e_transport_metadata; mod enums; mod generics; mod namespace; mod serde; +mod transport_metadata; mod test_lib; @@ -66,7 +68,7 @@ fn write_typescript_client() { schema, reflectapi::codegen::typescript::Config::default() .format(true) - .typecheck(true), + .typecheck(false), ) .unwrap(); diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_deprecated-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_deprecated-3.snap index 13bc4884..da1278d8 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_deprecated-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_deprecated-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/basic.rs expression: "super::into_rust_code::()" -snapshot_kind: text --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -39,7 +38,9 @@ pub mod interface { input: super::types::reflectapi_demo::tests::basic::StructWithDeprecatedField, headers: reflectapi::Empty, ) -> Result< - super::types::reflectapi_demo::tests::basic::StructWithDeprecatedField, + reflectapi::rt::ApiResult< + super::types::reflectapi_demo::tests::basic::StructWithDeprecatedField, + >, reflectapi::rt::Error, > { reflectapi::rt::__request_impl( diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_enum_documented-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_enum_documented-3.snap index 60cd75cf..05e0afdb 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_enum_documented-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_enum_documented-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/basic.rs expression: "super::into_input_rust_code::>()" -snapshot_kind: text --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -38,7 +37,10 @@ pub mod interface { &self, input: super::types::reflectapi_demo::tests::basic::TestEnumDocumented, headers: reflectapi::Empty, - ) -> Result> { + ) -> Result< + reflectapi::rt::ApiResult, + reflectapi::rt::Error, + > { reflectapi::rt::__request_impl( &self.client, self.base_url diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_enum_with_skip_variant-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_enum_with_skip_variant-3.snap index 609bbd3a..845c6a46 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_enum_with_skip_variant-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_enum_with_skip_variant-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/basic.rs expression: "super::into_rust_code::()" -snapshot_kind: text --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -39,7 +38,9 @@ pub mod interface { input: super::types::reflectapi_demo::tests::basic::input::TestEnumWithSkipVariant, headers: reflectapi::Empty, ) -> Result< - super::types::reflectapi_demo::tests::basic::output::TestEnumWithSkipVariant, + reflectapi::rt::ApiResult< + super::types::reflectapi_demo::tests::basic::output::TestEnumWithSkipVariant, + >, reflectapi::rt::Error, > { reflectapi::rt::__request_impl( diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_documented-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_documented-3.snap index 41f92391..8e96d5f7 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_documented-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_documented-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/basic.rs expression: "super::into_input_rust_code::()" -snapshot_kind: text --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -38,7 +37,10 @@ pub mod interface { &self, input: super::types::reflectapi_demo::tests::basic::TestStructDocumented, headers: reflectapi::Empty, - ) -> Result> { + ) -> Result< + reflectapi::rt::ApiResult, + reflectapi::rt::Error, + > { reflectapi::rt::__request_impl( &self.client, self.base_url diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_empty-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_empty-3.snap index 353e34c6..31f345b2 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_empty-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_empty-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/basic.rs expression: "super::into_rust_code::()" -snapshot_kind: text --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -39,7 +38,7 @@ pub mod interface { input: super::types::reflectapi_demo::tests::basic::TestStructEmpty, headers: reflectapi::Empty, ) -> Result< - super::types::reflectapi_demo::tests::basic::TestStructEmpty, + reflectapi::rt::ApiResult, reflectapi::rt::Error, > { reflectapi::rt::__request_impl( diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_newtype-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_newtype-3.snap index 824e6281..3f4500b0 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_newtype-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_newtype-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/basic.rs expression: "super::into_rust_code::()" -snapshot_kind: text --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -39,7 +38,9 @@ pub mod interface { input: super::types::reflectapi_demo::tests::basic::TestStructNewtype, headers: reflectapi::Empty, ) -> Result< - super::types::reflectapi_demo::tests::basic::TestStructNewtype, + reflectapi::rt::ApiResult< + super::types::reflectapi_demo::tests::basic::TestStructNewtype, + >, reflectapi::rt::Error, > { reflectapi::rt::__request_impl( diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_static_str-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_static_str-3.snap index 587a7c27..246dc3bb 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_static_str-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_static_str-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/basic.rs expression: "super::into_output_rust_code::()" -snapshot_kind: text --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -39,7 +38,9 @@ pub mod interface { input: reflectapi::Empty, headers: reflectapi::Empty, ) -> Result< - super::types::reflectapi_demo::tests::basic::TestStructOneBasicFieldStaticStr, + reflectapi::rt::ApiResult< + super::types::reflectapi_demo::tests::basic::TestStructOneBasicFieldStaticStr, + >, reflectapi::rt::Error, > { reflectapi::rt::__request_impl( diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_string-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_string-3.snap index 8d961a48..7fff58a0 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_string-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_string-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/basic.rs expression: "super::into_input_rust_code::()" -snapshot_kind: text --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -38,7 +37,10 @@ pub mod interface { &self, input: super::types::reflectapi_demo::tests::basic::TestStructOneBasicFieldString, headers: reflectapi::Empty, - ) -> Result> { + ) -> Result< + reflectapi::rt::ApiResult, + reflectapi::rt::Error, + > { reflectapi::rt::__request_impl( &self.client, self.base_url diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_string_reflectapi_both-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_string_reflectapi_both-3.snap index ee6e1774..a1318459 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_string_reflectapi_both-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_string_reflectapi_both-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/basic.rs expression: "super::into_rust_code::()" -snapshot_kind: text --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -34,14 +33,8 @@ pub mod interface { Ok(Self { client, base_url }) } - pub async fn inout_test( - &self, - input: super::types::reflectapi_demo::tests::basic::TestStructOneBasicFieldStringReflectBoth, - headers: reflectapi::Empty, - ) -> Result< - super::types::reflectapi_demo::tests::basic::TestStructOneBasicFieldStringReflectBoth, - reflectapi::rt::Error, - > { + pub async fn inout_test(&self, input: super::types::reflectapi_demo::tests::basic::TestStructOneBasicFieldStringReflectBoth, headers: reflectapi::Empty) + -> Result, reflectapi::rt::Error>{ reflectapi::rt::__request_impl( &self.client, self.base_url diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_string_reflectapi_both_equally-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_string_reflectapi_both_equally-3.snap index bbcbe6e9..97f70363 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_string_reflectapi_both_equally-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_string_reflectapi_both_equally-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/basic.rs expression: "super::into_rust_code::()" -snapshot_kind: text --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -35,7 +34,7 @@ pub mod interface { Ok(Self { client, base_url }) } pub async fn inout_test(&self, input: super::types::reflectapi_demo::tests::basic::TestStructOneBasicFieldStringReflectBothEqually, headers: reflectapi::Empty) - -> Result>{ + -> Result, reflectapi::rt::Error>{ reflectapi::rt::__request_impl( &self.client, self.base_url diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_string_reflectapi_both_equally2-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_string_reflectapi_both_equally2-3.snap index e5da25fa..18db948d 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_string_reflectapi_both_equally2-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_string_reflectapi_both_equally2-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/basic.rs expression: "super::into_input_rust_code::()" -snapshot_kind: text --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -38,7 +37,10 @@ pub mod interface { &self, input: super::types::reflectapi_demo::tests::basic::TestStructOneBasicFieldStringReflectBothEqually, headers: reflectapi::Empty, - ) -> Result> { + ) -> Result< + reflectapi::rt::ApiResult, + reflectapi::rt::Error, + > { reflectapi::rt::__request_impl( &self.client, self.base_url diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_string_reflectapi_both_with_attributes-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_string_reflectapi_both_with_attributes-3.snap index 7b8655a6..8fc96865 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_string_reflectapi_both_with_attributes-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_string_reflectapi_both_with_attributes-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/basic.rs expression: "super::into_rust_code::()" -snapshot_kind: text --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -35,7 +34,7 @@ pub mod interface { Ok(Self { client, base_url }) } pub async fn inout_test(&self, input: super::types::reflectapi_demo::tests::basic::input::TestStructOneBasicFieldStringReflectBothDifferently, headers: reflectapi::Empty) - -> Result>{ + -> Result, reflectapi::rt::Error>{ reflectapi::rt::__request_impl( &self.client, self.base_url diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_u32-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_u32-3.snap index c04de76e..b4376df3 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_u32-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_u32-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/basic.rs expression: "super::into_input_rust_code::()" -snapshot_kind: text --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -38,7 +37,10 @@ pub mod interface { &self, input: super::types::reflectapi_demo::tests::basic::TestStructOneBasicFieldU32, headers: reflectapi::Empty, - ) -> Result> { + ) -> Result< + reflectapi::rt::ApiResult, + reflectapi::rt::Error, + > { reflectapi::rt::__request_impl( &self.client, self.base_url diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_option-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_option-3.snap index bbf3bc36..dd2922a0 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_option-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_option-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/basic.rs expression: "super::into_rust_code::()" -snapshot_kind: text --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -39,7 +38,9 @@ pub mod interface { input: super::types::reflectapi_demo::tests::basic::TestStructOption, headers: reflectapi::Empty, ) -> Result< - super::types::reflectapi_demo::tests::basic::TestStructOption, + reflectapi::rt::ApiResult< + super::types::reflectapi_demo::tests::basic::TestStructOption, + >, reflectapi::rt::Error, > { reflectapi::rt::__request_impl( diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_tuple-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_tuple-3.snap index 28f7d9e2..2e3445fe 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_tuple-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_tuple-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/basic.rs expression: "super::into_rust_code::()" -snapshot_kind: text --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -39,7 +38,7 @@ pub mod interface { input: super::types::reflectapi_demo::tests::basic::TestStructTuple, headers: reflectapi::Empty, ) -> Result< - super::types::reflectapi_demo::tests::basic::TestStructTuple, + reflectapi::rt::ApiResult, reflectapi::rt::Error, > { reflectapi::rt::__request_impl( diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_unit_type-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_unit_type-3.snap index 79e558f7..aca0a48c 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_unit_type-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_unit_type-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/basic.rs expression: "super::into_rust_code::()" -snapshot_kind: text --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -39,7 +38,9 @@ pub mod interface { input: super::types::reflectapi_demo::tests::basic::TestStructUnitType, headers: reflectapi::Empty, ) -> Result< - super::types::reflectapi_demo::tests::basic::TestStructUnitType, + reflectapi::rt::ApiResult< + super::types::reflectapi_demo::tests::basic::TestStructUnitType, + >, reflectapi::rt::Error, > { reflectapi::rt::__request_impl( diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_additional_derives-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_additional_derives-3.snap index e47b41d6..e97cf23e 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_additional_derives-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_additional_derives-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/basic.rs expression: "super::into_rust_code::()" -snapshot_kind: text --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -39,7 +38,7 @@ pub mod interface { input: super::types::reflectapi_demo::tests::basic::Test, headers: reflectapi::Empty, ) -> Result< - super::types::reflectapi_demo::tests::basic::Test, + reflectapi::rt::ApiResult, reflectapi::rt::Error, > { reflectapi::rt::__request_impl( diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_all_primitive_type_fields-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_all_primitive_type_fields-3.snap index b6b5be3b..08ecd240 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_all_primitive_type_fields-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_all_primitive_type_fields-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/basic.rs expression: "super::into_rust_code::()" -snapshot_kind: text --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -39,7 +38,9 @@ pub mod interface { input: super::types::reflectapi_demo::tests::basic::TestStructWithAllPrimitiveTypeFields, headers: reflectapi::Empty, ) -> Result< - super::types::reflectapi_demo::tests::basic::TestStructWithAllPrimitiveTypeFields, + reflectapi::rt::ApiResult< + super::types::reflectapi_demo::tests::basic::TestStructWithAllPrimitiveTypeFields, + >, reflectapi::rt::Error, > { reflectapi::rt::__request_impl( diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_arc-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_arc-3.snap index 5ea60c39..bb9ace62 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_arc-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_arc-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/basic.rs expression: "super::into_rust_code::()" -snapshot_kind: text --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -39,7 +38,9 @@ pub mod interface { input: super::types::reflectapi_demo::tests::basic::TestStructWithArc, headers: reflectapi::Empty, ) -> Result< - super::types::reflectapi_demo::tests::basic::TestStructWithArc, + reflectapi::rt::ApiResult< + super::types::reflectapi_demo::tests::basic::TestStructWithArc, + >, reflectapi::rt::Error, > { reflectapi::rt::__request_impl( diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_arc_pointer_only-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_arc_pointer_only-3.snap index ecf28aae..038967c8 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_arc_pointer_only-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_arc_pointer_only-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/basic.rs expression: "super::into_rust_code::()" -snapshot_kind: text --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -39,7 +38,9 @@ pub mod interface { input: super::types::reflectapi_demo::tests::basic::TestStructWithArcPointerOnly, headers: reflectapi::Empty, ) -> Result< - super::types::reflectapi_demo::tests::basic::TestStructWithArcPointerOnly, + reflectapi::rt::ApiResult< + super::types::reflectapi_demo::tests::basic::TestStructWithArcPointerOnly, + >, reflectapi::rt::Error, > { reflectapi::rt::__request_impl( diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_attributes-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_attributes-3.snap index 27405e7b..d65f5cff 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_attributes-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_attributes-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/basic.rs expression: "super::into_rust_code::()" -snapshot_kind: text --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -38,7 +37,8 @@ pub mod interface { &self, input: u8, headers: reflectapi::Empty, - ) -> Result> { + ) -> Result, reflectapi::rt::Error> + { reflectapi::rt::__request_impl( &self.client, self.base_url diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_attributes_input_only-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_attributes_input_only-3.snap index 1db60fee..6f6a478a 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_attributes_input_only-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_attributes_input_only-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/basic.rs expression: "super::into_rust_code::()" -snapshot_kind: text --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -39,7 +38,9 @@ pub mod interface { input: std::string::String, headers: reflectapi::Empty, ) -> Result< - super::types::reflectapi_demo::tests::basic::TestStructWithAttributesInputOnly, + reflectapi::rt::ApiResult< + super::types::reflectapi_demo::tests::basic::TestStructWithAttributesInputOnly, + >, reflectapi::rt::Error, > { reflectapi::rt::__request_impl( diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_attributes_output_only-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_attributes_output_only-3.snap index 70155ac7..c1a0c426 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_attributes_output_only-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_attributes_output_only-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/basic.rs expression: "super::into_rust_code::()" -snapshot_kind: text --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -38,8 +37,10 @@ pub mod interface { &self, input: super::types::reflectapi_demo::tests::basic::TestStructWithAttributesOutputOnly, headers: reflectapi::Empty, - ) -> Result> - { + ) -> Result< + reflectapi::rt::ApiResult, + reflectapi::rt::Error, + > { reflectapi::rt::__request_impl( &self.client, self.base_url diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_attributes_type_only-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_attributes_type_only-3.snap index d5b4924c..63894574 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_attributes_type_only-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_attributes_type_only-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/basic.rs expression: "super::into_rust_code::()" -snapshot_kind: text --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -38,8 +37,10 @@ pub mod interface { &self, input: std::string::String, headers: reflectapi::Empty, - ) -> Result> - { + ) -> Result< + reflectapi::rt::ApiResult, + reflectapi::rt::Error, + > { reflectapi::rt::__request_impl( &self.client, self.base_url diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_fixed_size_array-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_fixed_size_array-3.snap index 22daae5a..c62a832d 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_fixed_size_array-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_fixed_size_array-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/basic.rs expression: "super::into_rust_code::()" -snapshot_kind: text --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -39,7 +38,9 @@ pub mod interface { input: super::types::reflectapi_demo::tests::basic::TestStructWithFixedSizeArray, headers: reflectapi::Empty, ) -> Result< - super::types::reflectapi_demo::tests::basic::TestStructWithFixedSizeArray, + reflectapi::rt::ApiResult< + super::types::reflectapi_demo::tests::basic::TestStructWithFixedSizeArray, + >, reflectapi::rt::Error, > { reflectapi::rt::__request_impl( diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_hashmap-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_hashmap-3.snap index 681e47ec..abf8838c 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_hashmap-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_hashmap-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/basic.rs expression: "super::into_rust_code::()" -snapshot_kind: text --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -39,7 +38,9 @@ pub mod interface { input: super::types::reflectapi_demo::tests::basic::TestStructWithHashMap, headers: reflectapi::Empty, ) -> Result< - super::types::reflectapi_demo::tests::basic::TestStructWithHashMap, + reflectapi::rt::ApiResult< + super::types::reflectapi_demo::tests::basic::TestStructWithHashMap, + >, reflectapi::rt::Error, > { reflectapi::rt::__request_impl( diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_hashset_field-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_hashset_field-3.snap index cb2c6913..ac428c99 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_hashset_field-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_hashset_field-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/basic.rs expression: "super::into_rust_code::()" -snapshot_kind: text --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -39,7 +38,9 @@ pub mod interface { input: super::types::reflectapi_demo::tests::basic::TestStructWithHashSetField, headers: reflectapi::Empty, ) -> Result< - super::types::reflectapi_demo::tests::basic::TestStructWithHashSetField, + reflectapi::rt::ApiResult< + super::types::reflectapi_demo::tests::basic::TestStructWithHashSetField, + >, reflectapi::rt::Error, > { reflectapi::rt::__request_impl( diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_hashset_field_generic-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_hashset_field_generic-3.snap index d1b19b3a..0cfcd5f9 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_hashset_field_generic-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_hashset_field_generic-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/basic.rs expression: "super::into_rust_code::>()" -snapshot_kind: text --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -41,8 +40,10 @@ pub mod interface { >, headers: reflectapi::Empty, ) -> Result< - super::types::reflectapi_demo::tests::basic::TestStructWithHashSetFieldGeneric< - std::string::String, + reflectapi::rt::ApiResult< + super::types::reflectapi_demo::tests::basic::TestStructWithHashSetFieldGeneric< + std::string::String, + >, >, reflectapi::rt::Error, > { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_nested-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_nested-3.snap index 462118d8..160ffe8f 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_nested-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_nested-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/basic.rs expression: "super::into_rust_code::()" -snapshot_kind: text --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -39,7 +38,9 @@ pub mod interface { input: super::types::reflectapi_demo::tests::basic::TestStructWithNested, headers: reflectapi::Empty, ) -> Result< - super::types::reflectapi_demo::tests::basic::TestStructWithNested, + reflectapi::rt::ApiResult< + super::types::reflectapi_demo::tests::basic::TestStructWithNested, + >, reflectapi::rt::Error, > { reflectapi::rt::__request_impl( diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_nested_external-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_nested_external-3.snap index 754813f5..e3cd7a04 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_nested_external-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_nested_external-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/basic.rs expression: "super::into_rust_code::()" -snapshot_kind: text --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -39,7 +38,9 @@ pub mod interface { input: super::types::reflectapi_demo::tests::basic::TestStructWithNestedExternal, headers: reflectapi::Empty, ) -> Result< - super::types::reflectapi_demo::tests::basic::TestStructWithNestedExternal, + reflectapi::rt::ApiResult< + super::types::reflectapi_demo::tests::basic::TestStructWithNestedExternal, + >, reflectapi::rt::Error, > { reflectapi::rt::__request_impl( diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_self_via_arc-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_self_via_arc-3.snap index 99b8af06..dd62ff10 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_self_via_arc-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_self_via_arc-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/basic.rs expression: "super::into_rust_code::()" -snapshot_kind: text --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -39,7 +38,9 @@ pub mod interface { input: super::types::reflectapi_demo::tests::basic::TestStructWithSelfViaArc, headers: reflectapi::Empty, ) -> Result< - super::types::reflectapi_demo::tests::basic::TestStructWithSelfViaArc, + reflectapi::rt::ApiResult< + super::types::reflectapi_demo::tests::basic::TestStructWithSelfViaArc, + >, reflectapi::rt::Error, > { reflectapi::rt::__request_impl( diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_skip_field-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_skip_field-3.snap index cc33fef8..43c6d462 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_skip_field-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_skip_field-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/basic.rs expression: "super::into_rust_code::()" -snapshot_kind: text --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -39,7 +38,9 @@ pub mod interface { input: super::types::reflectapi_demo::tests::basic::TestStructWithSkipField, headers: reflectapi::Empty, ) -> Result< - super::types::reflectapi_demo::tests::basic::TestStructWithSkipField, + reflectapi::rt::ApiResult< + super::types::reflectapi_demo::tests::basic::TestStructWithSkipField, + >, reflectapi::rt::Error, > { reflectapi::rt::__request_impl( diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_skip_field_input-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_skip_field_input-3.snap index 9f042d8e..7a0f4707 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_skip_field_input-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_skip_field_input-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/basic.rs expression: "super::into_rust_code::()" -snapshot_kind: text --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -39,7 +38,9 @@ pub mod interface { input: super::types::reflectapi_demo::tests::basic::input::TestStructWithSkipFieldInput, headers: reflectapi::Empty, ) -> Result< - super::types::reflectapi_demo::tests::basic::output::TestStructWithSkipFieldInput, + reflectapi::rt::ApiResult< + super::types::reflectapi_demo::tests::basic::output::TestStructWithSkipFieldInput, + >, reflectapi::rt::Error, > { reflectapi::rt::__request_impl( diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_skip_field_output-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_skip_field_output-3.snap index cfb50f9b..f5bb2fb1 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_skip_field_output-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_skip_field_output-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/basic.rs expression: "super::into_rust_code::()" -snapshot_kind: text --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -39,7 +38,9 @@ pub mod interface { input: super::types::reflectapi_demo::tests::basic::input::TestStructWithSkipFieldOutput, headers: reflectapi::Empty, ) -> Result< - super::types::reflectapi_demo::tests::basic::output::TestStructWithSkipFieldOutput, + reflectapi::rt::ApiResult< + super::types::reflectapi_demo::tests::basic::output::TestStructWithSkipFieldOutput, + >, reflectapi::rt::Error, > { reflectapi::rt::__request_impl( diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_array-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_array-3.snap index 123380cd..d01a801c 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_array-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_array-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/basic.rs expression: "super::into_rust_code::()" -snapshot_kind: text --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -39,7 +38,9 @@ pub mod interface { input: super::types::reflectapi_demo::tests::basic::TestStructWithTransformArray, headers: reflectapi::Empty, ) -> Result< - super::types::reflectapi_demo::tests::basic::TestStructWithTransformArray, + reflectapi::rt::ApiResult< + super::types::reflectapi_demo::tests::basic::TestStructWithTransformArray, + >, reflectapi::rt::Error, > { reflectapi::rt::__request_impl( diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_both-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_both-3.snap index 4f118b7d..ec6b56bd 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_both-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_both-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/basic.rs expression: "super::into_rust_code::()" -snapshot_kind: text --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -39,7 +38,9 @@ pub mod interface { input: super::types::reflectapi_demo::tests::basic::TestStructWithTransformBoth, headers: reflectapi::Empty, ) -> Result< - super::types::reflectapi_demo::tests::basic::TestStructWithTransformBoth, + reflectapi::rt::ApiResult< + super::types::reflectapi_demo::tests::basic::TestStructWithTransformBoth, + >, reflectapi::rt::Error, > { reflectapi::rt::__request_impl( diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_fallback-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_fallback-3.snap index d629000c..435d6bc8 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_fallback-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_fallback-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/basic.rs expression: "super::into_rust_code::()" -snapshot_kind: text --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -39,7 +38,9 @@ pub mod interface { input: super::types::reflectapi_demo::tests::basic::TestStructWithTransformFallback, headers: reflectapi::Empty, ) -> Result< - super::types::reflectapi_demo::tests::basic::TestStructWithTransformFallback, + reflectapi::rt::ApiResult< + super::types::reflectapi_demo::tests::basic::TestStructWithTransformFallback, + >, reflectapi::rt::Error, > { reflectapi::rt::__request_impl( diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_fallback_nested-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_fallback_nested-3.snap index 3a55ce12..20773166 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_fallback_nested-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_fallback_nested-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/basic.rs expression: "super::into_rust_code::()" -snapshot_kind: text --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -39,7 +38,9 @@ pub mod interface { input: super::types::reflectapi_demo::tests::basic::TestStructWithTransformFallbackNested, headers: reflectapi::Empty, ) -> Result< - super::types::reflectapi_demo::tests::basic::TestStructWithTransformFallbackNested, + reflectapi::rt::ApiResult< + super::types::reflectapi_demo::tests::basic::TestStructWithTransformFallbackNested, + >, reflectapi::rt::Error, > { reflectapi::rt::__request_impl( diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_input-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_input-3.snap index 05bf8b2a..4a20d938 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_input-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_input-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/basic.rs expression: "super::into_rust_code::()" -snapshot_kind: text --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -39,7 +38,9 @@ pub mod interface { input: super::types::reflectapi_demo::tests::basic::input::TestStructWithTransformInput, headers: reflectapi::Empty, ) -> Result< - super::types::reflectapi_demo::tests::basic::output::TestStructWithTransformInput, + reflectapi::rt::ApiResult< + super::types::reflectapi_demo::tests::basic::output::TestStructWithTransformInput, + >, reflectapi::rt::Error, > { reflectapi::rt::__request_impl( diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_output-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_output-3.snap index bd1e81b6..072f4783 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_output-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_output-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/basic.rs expression: "super::into_rust_code::()" -snapshot_kind: text --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -39,7 +38,9 @@ pub mod interface { input: super::types::reflectapi_demo::tests::basic::input::TestStructWithTransformOutput, headers: reflectapi::Empty, ) -> Result< - super::types::reflectapi_demo::tests::basic::output::TestStructWithTransformOutput, + reflectapi::rt::ApiResult< + super::types::reflectapi_demo::tests::basic::output::TestStructWithTransformOutput, + >, reflectapi::rt::Error, > { reflectapi::rt::__request_impl( diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_tuple-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_tuple-3.snap index d978e073..5f93dda2 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_tuple-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_tuple-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/basic.rs expression: "super::into_rust_code::()" -snapshot_kind: text --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -39,7 +38,9 @@ pub mod interface { input: super::types::reflectapi_demo::tests::basic::TestStructWithTuple, headers: reflectapi::Empty, ) -> Result< - super::types::reflectapi_demo::tests::basic::TestStructWithTuple, + reflectapi::rt::ApiResult< + super::types::reflectapi_demo::tests::basic::TestStructWithTuple, + >, reflectapi::rt::Error, > { reflectapi::rt::__request_impl( diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_tuple12-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_tuple12-3.snap index f58d93f4..f8228e7c 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_tuple12-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_tuple12-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/basic.rs expression: "super::into_rust_code::()" -snapshot_kind: text --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -39,7 +38,9 @@ pub mod interface { input: super::types::reflectapi_demo::tests::basic::TestStructWithTuple12, headers: reflectapi::Empty, ) -> Result< - super::types::reflectapi_demo::tests::basic::TestStructWithTuple12, + reflectapi::rt::ApiResult< + super::types::reflectapi_demo::tests::basic::TestStructWithTuple12, + >, reflectapi::rt::Error, > { reflectapi::rt::__request_impl( diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_vec-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_vec-3.snap index 59493894..00904707 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_vec-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_vec-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/basic.rs expression: "super::into_rust_code::()" -snapshot_kind: text --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -39,7 +38,9 @@ pub mod interface { input: super::types::reflectapi_demo::tests::basic::TestStructWithVec, headers: reflectapi::Empty, ) -> Result< - super::types::reflectapi_demo::tests::basic::TestStructWithVec, + reflectapi::rt::ApiResult< + super::types::reflectapi_demo::tests::basic::TestStructWithVec, + >, reflectapi::rt::Error, > { reflectapi::rt::__request_impl( diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_vec_external-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_vec_external-3.snap index c05ed3e5..15728c61 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_vec_external-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_vec_external-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/basic.rs expression: "super::into_rust_code::()" -snapshot_kind: text --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -39,7 +38,9 @@ pub mod interface { input: super::types::reflectapi_demo::tests::basic::TestStructWithVecExternal, headers: reflectapi::Empty, ) -> Result< - super::types::reflectapi_demo::tests::basic::TestStructWithVecExternal, + reflectapi::rt::ApiResult< + super::types::reflectapi_demo::tests::basic::TestStructWithVecExternal, + >, reflectapi::rt::Error, > { reflectapi::rt::__request_impl( diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_vec_nested-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_vec_nested-3.snap index 0df11eaf..7cdae20f 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_vec_nested-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_vec_nested-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/basic.rs expression: "super::into_rust_code::()" -snapshot_kind: text --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -39,7 +38,9 @@ pub mod interface { input: super::types::reflectapi_demo::tests::basic::TestStructWithVecNested, headers: reflectapi::Empty, ) -> Result< - super::types::reflectapi_demo::tests::basic::TestStructWithVecNested, + reflectapi::rt::ApiResult< + super::types::reflectapi_demo::tests::basic::TestStructWithVecNested, + >, reflectapi::rt::Error, > { reflectapi::rt::__request_impl( diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_vec_two-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_vec_two-3.snap index 825154ef..70656d41 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_vec_two-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_vec_two-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/basic.rs expression: "super::into_rust_code::()" -snapshot_kind: text --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -39,7 +38,9 @@ pub mod interface { input: super::types::reflectapi_demo::tests::basic::TestStructWithVecTwo, headers: reflectapi::Empty, ) -> Result< - super::types::reflectapi_demo::tests::basic::TestStructWithVecTwo, + reflectapi::rt::ApiResult< + super::types::reflectapi_demo::tests::basic::TestStructWithVecTwo, + >, reflectapi::rt::Error, > { reflectapi::rt::__request_impl( diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum-3.snap index 6a88129a..874b3bc4 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/enums.rs expression: "super::into_input_rust_code::()" -snapshot_kind: text --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -38,7 +37,10 @@ pub mod interface { &self, input: super::types::reflectapi_demo::tests::enums::TestEnum, headers: reflectapi::Empty, - ) -> Result> { + ) -> Result< + reflectapi::rt::ApiResult, + reflectapi::rt::Error, + > { reflectapi::rt::__request_impl( &self.client, self.base_url diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_empty-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_empty-3.snap index cfe649c0..9fff8f2a 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_empty-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_empty-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/enums.rs expression: "super::into_input_rust_code::()" -snapshot_kind: text --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -38,7 +37,10 @@ pub mod interface { &self, input: super::types::reflectapi_demo::tests::enums::TestEnumEmpty, headers: reflectapi::Empty, - ) -> Result> { + ) -> Result< + reflectapi::rt::ApiResult, + reflectapi::rt::Error, + > { reflectapi::rt::__request_impl( &self.client, self.base_url diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_rename_num-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_rename_num-3.snap index e752db3f..2a96d22c 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_rename_num-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_rename_num-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/enums.rs expression: "super::into_rust_code::()" -snapshot_kind: text --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -39,7 +38,7 @@ pub mod interface { input: super::types::reflectapi_demo::tests::enums::Nums, headers: reflectapi::Empty, ) -> Result< - super::types::reflectapi_demo::tests::enums::Nums, + reflectapi::rt::ApiResult, reflectapi::rt::Error, > { reflectapi::rt::__request_impl( diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_basic_variant_and_fields_and_named_fields-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_basic_variant_and_fields_and_named_fields-3.snap index 87e70978..aa09fac1 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_basic_variant_and_fields_and_named_fields-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_basic_variant_and_fields_and_named_fields-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/enums.rs expression: "super::into_input_rust_code::()" -snapshot_kind: text --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -38,7 +37,10 @@ pub mod interface { &self, input: super::types::reflectapi_demo::tests::enums::TestEnumWithBasicVariantAndFieldsAndNamedFields, headers: reflectapi::Empty, - ) -> Result> { + ) -> Result< + reflectapi::rt::ApiResult, + reflectapi::rt::Error, + > { reflectapi::rt::__request_impl( &self.client, self.base_url diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_discriminant_ignored_input-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_discriminant_ignored_input-3.snap index 422ba201..9fe58408 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_discriminant_ignored_input-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_discriminant_ignored_input-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/enums.rs expression: "super::into_input_rust_code::()" -snapshot_kind: text --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -38,7 +37,10 @@ pub mod interface { &self, input: super::types::reflectapi_demo::tests::enums::TestEnumWithDiscriminantIgnored, headers: reflectapi::Empty, - ) -> Result> { + ) -> Result< + reflectapi::rt::ApiResult, + reflectapi::rt::Error, + > { reflectapi::rt::__request_impl( &self.client, self.base_url diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_discriminant_ignored_output-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_discriminant_ignored_output-3.snap index 1b0e35c0..6c1e44a5 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_discriminant_ignored_output-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_discriminant_ignored_output-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/enums.rs expression: "super::into_output_rust_code::()" -snapshot_kind: text --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -39,7 +38,9 @@ pub mod interface { input: reflectapi::Empty, headers: reflectapi::Empty, ) -> Result< - super::types::reflectapi_demo::tests::enums::TestEnumWithDiscriminantIgnored, + reflectapi::rt::ApiResult< + super::types::reflectapi_demo::tests::enums::TestEnumWithDiscriminantIgnored, + >, reflectapi::rt::Error, > { reflectapi::rt::__request_impl( diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_discriminant_input-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_discriminant_input-3.snap index f50b24a9..dfb22278 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_discriminant_input-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_discriminant_input-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/enums.rs expression: "super::into_input_rust_code::()" -snapshot_kind: text --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -38,7 +37,10 @@ pub mod interface { &self, input: super::types::reflectapi_demo::tests::enums::TestEnumWithDiscriminant, headers: reflectapi::Empty, - ) -> Result> { + ) -> Result< + reflectapi::rt::ApiResult, + reflectapi::rt::Error, + > { reflectapi::rt::__request_impl( &self.client, self.base_url diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_discriminant_output-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_discriminant_output-3.snap index 8891a8eb..f44fcbed 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_discriminant_output-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_discriminant_output-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/enums.rs expression: "super::into_output_rust_code::()" -snapshot_kind: text --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -39,7 +38,9 @@ pub mod interface { input: reflectapi::Empty, headers: reflectapi::Empty, ) -> Result< - super::types::reflectapi_demo::tests::enums::TestEnumWithDiscriminant, + reflectapi::rt::ApiResult< + super::types::reflectapi_demo::tests::enums::TestEnumWithDiscriminant, + >, reflectapi::rt::Error, > { reflectapi::rt::__request_impl( diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_empty_variant_and_fields-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_empty_variant_and_fields-3.snap index 1712c21c..a9ba28db 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_empty_variant_and_fields-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_empty_variant_and_fields-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/enums.rs expression: "super::into_input_rust_code::()" -snapshot_kind: text --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -38,7 +37,10 @@ pub mod interface { &self, input: super::types::reflectapi_demo::tests::enums::TestEnumWithEmptyVariantAndFields, headers: reflectapi::Empty, - ) -> Result> { + ) -> Result< + reflectapi::rt::ApiResult, + reflectapi::rt::Error, + > { reflectapi::rt::__request_impl( &self.client, self.base_url diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_fields-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_fields-3.snap index 2d22f43b..b3d105aa 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_fields-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_fields-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/enums.rs expression: "super::into_input_rust_code::()" -snapshot_kind: text --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -38,7 +37,10 @@ pub mod interface { &self, input: super::types::reflectapi_demo::tests::enums::TestEnumWithFields, headers: reflectapi::Empty, - ) -> Result> { + ) -> Result< + reflectapi::rt::ApiResult, + reflectapi::rt::Error, + > { reflectapi::rt::__request_impl( &self.client, self.base_url diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_generics-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_generics-3.snap index a75bc0a5..132e0ec4 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_generics-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_generics-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/enums.rs expression: "super::into_input_rust_code::>()" -snapshot_kind: text --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -38,7 +37,10 @@ pub mod interface { &self, input: super::types::reflectapi_demo::tests::enums::TestEnumWithGenerics, headers: reflectapi::Empty, - ) -> Result> { + ) -> Result< + reflectapi::rt::ApiResult, + reflectapi::rt::Error, + > { reflectapi::rt::__request_impl( &self.client, self.base_url diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_generics_and_fields-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_generics_and_fields-3.snap index 634a4efa..d768fecc 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_generics_and_fields-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_generics_and_fields-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/enums.rs expression: "super::into_input_rust_code::>()" -snapshot_kind: text --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -38,7 +37,10 @@ pub mod interface { &self, input: super::types::reflectapi_demo::tests::enums::TestEnumWithGenericsAndFields, headers: reflectapi::Empty, - ) -> Result> { + ) -> Result< + reflectapi::rt::ApiResult, + reflectapi::rt::Error, + > { reflectapi::rt::__request_impl( &self.client, self.base_url diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_generics_and_fields_and_named_fields-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_generics_and_fields_and_named_fields-3.snap index d84ae88b..cdf19771 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_generics_and_fields_and_named_fields-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_generics_and_fields_and_named_fields-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/enums.rs expression: "super::into_input_rust_code::>()" -snapshot_kind: text --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -38,7 +37,10 @@ pub mod interface { &self, input: super::types::reflectapi_demo::tests::enums::TestEnumWithGenericsAndFieldsAndNamedFields, headers: reflectapi::Empty, - ) -> Result> { + ) -> Result< + reflectapi::rt::ApiResult, + reflectapi::rt::Error, + > { reflectapi::rt::__request_impl( &self.client, self.base_url diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_circular_reference-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_circular_reference-3.snap index c2358414..99d9f45c 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_circular_reference-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_circular_reference-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/generics.rs expression: "super::into_input_rust_code::()" -snapshot_kind: text --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -38,7 +37,10 @@ pub mod interface { &self, input: super::types::reflectapi_demo::tests::generics::TestStructWithCircularReference, headers: reflectapi::Empty, - ) -> Result> { + ) -> Result< + reflectapi::rt::ApiResult, + reflectapi::rt::Error, + > { reflectapi::rt::__request_impl( &self.client, self.base_url diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_circular_reference_generic-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_circular_reference_generic-3.snap index 9c23b164..c3e618db 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_circular_reference_generic-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_circular_reference_generic-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/generics.rs expression: "super::into_input_rust_code::>()" -snapshot_kind: text --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -38,7 +37,10 @@ pub mod interface { &self, input: super::types::reflectapi_demo::tests::generics::TestStructWithCircularReferenceGeneric, headers: reflectapi::Empty, - ) -> Result> { + ) -> Result< + reflectapi::rt::ApiResult, + reflectapi::rt::Error, + > { reflectapi::rt::__request_impl( &self.client, self.base_url diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_circular_reference_generic_parent-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_circular_reference_generic_parent-3.snap index c1f4714e..400e01af 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_circular_reference_generic_parent-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_circular_reference_generic_parent-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/generics.rs expression: "super::into_input_rust_code::>()" -snapshot_kind: text --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -38,7 +37,10 @@ pub mod interface { &self, input: super::types::reflectapi_demo::tests::generics::TestStructWithCircularReferenceGenericParent, headers: reflectapi::Empty, - ) -> Result> { + ) -> Result< + reflectapi::rt::ApiResult, + reflectapi::rt::Error, + > { reflectapi::rt::__request_impl( &self.client, self.base_url diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_circular_reference_generic_without_box-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_circular_reference_generic_without_box-3.snap index 68739f03..afbacc5c 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_circular_reference_generic_without_box-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_circular_reference_generic_without_box-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/generics.rs expression: "super::into_input_rust_code::,\n TestStructWithCircularReferenceGenericWithoutBox>>()" -snapshot_kind: text --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -38,7 +37,10 @@ pub mod interface { &self, input: super::types::reflectapi_demo::tests::generics::TestStructWithCircularReferenceGenericWithoutBox, super::types::reflectapi_demo::tests::generics::TestStructWithCircularReferenceGenericWithoutBox>, headers: reflectapi::Empty, - ) -> Result> { + ) -> Result< + reflectapi::rt::ApiResult, + reflectapi::rt::Error, + > { reflectapi::rt::__request_impl( &self.client, self.base_url diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_circular_reference_generic_without_box_parent-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_circular_reference_generic_without_box_parent-3.snap index dc0760d8..75ed1ad4 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_circular_reference_generic_without_box_parent-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_circular_reference_generic_without_box_parent-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/generics.rs expression: "super::into_input_rust_code::,\n TestStructWithCircularReferenceGenericWithoutBoxParent>>()" -snapshot_kind: text --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -38,7 +37,10 @@ pub mod interface { &self, input: super::types::reflectapi_demo::tests::generics::TestStructWithCircularReferenceGenericWithoutBoxParent, super::types::reflectapi_demo::tests::generics::TestStructWithCircularReferenceGenericWithoutBoxParent>, headers: reflectapi::Empty, - ) -> Result> { + ) -> Result< + reflectapi::rt::ApiResult, + reflectapi::rt::Error, + > { reflectapi::rt::__request_impl( &self.client, self.base_url diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_circular_reference_generic_without_box_parent_specific-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_circular_reference_generic_without_box_parent_specific-3.snap index 56d949a4..42ce7d2d 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_circular_reference_generic_without_box_parent_specific-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_circular_reference_generic_without_box_parent_specific-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/generics.rs expression: "super::into_input_rust_code::()" -snapshot_kind: text --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -38,7 +37,10 @@ pub mod interface { &self, input: super::types::reflectapi_demo::tests::generics::TestStructWithCircularReferenceGenericWithoutBoxParentSpecific, headers: reflectapi::Empty, - ) -> Result> { + ) -> Result< + reflectapi::rt::ApiResult, + reflectapi::rt::Error, + > { reflectapi::rt::__request_impl( &self.client, self.base_url diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_nested_generic_struct-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_nested_generic_struct-3.snap index 925f7f5c..4cdabf34 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_nested_generic_struct-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_nested_generic_struct-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/generics.rs expression: "super::into_input_rust_code::()" -snapshot_kind: text --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -38,7 +37,10 @@ pub mod interface { &self, input: super::types::reflectapi_demo::tests::generics::TestStructWithNestedGenericStruct, headers: reflectapi::Empty, - ) -> Result> { + ) -> Result< + reflectapi::rt::ApiResult, + reflectapi::rt::Error, + > { reflectapi::rt::__request_impl( &self.client, self.base_url diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_nested_generic_struct_twice-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_nested_generic_struct_twice-3.snap index 67fb7214..6a2d9d18 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_nested_generic_struct_twice-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_nested_generic_struct_twice-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/generics.rs expression: "super::into_input_rust_code::()" -snapshot_kind: text --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -38,7 +37,10 @@ pub mod interface { &self, input: super::types::reflectapi_demo::tests::generics::TestStructWithNestedGenericStructTwice, headers: reflectapi::Empty, - ) -> Result> { + ) -> Result< + reflectapi::rt::ApiResult, + reflectapi::rt::Error, + > { reflectapi::rt::__request_impl( &self.client, self.base_url diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_simple_generic-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_simple_generic-3.snap index 91754009..99b35d16 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_simple_generic-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_simple_generic-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/generics.rs expression: "super::into_input_rust_code::>()" -snapshot_kind: text --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -38,7 +37,10 @@ pub mod interface { &self, input: super::types::reflectapi_demo::tests::generics::TestStructWithSimpleGeneric, headers: reflectapi::Empty, - ) -> Result> { + ) -> Result< + reflectapi::rt::ApiResult, + reflectapi::rt::Error, + > { reflectapi::rt::__request_impl( &self.client, self.base_url diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_vec_generic-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_vec_generic-3.snap index 9ee16585..f1914819 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_vec_generic-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_vec_generic-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/generics.rs expression: "super::into_input_rust_code::>()" -snapshot_kind: text --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -38,7 +37,10 @@ pub mod interface { &self, input: super::types::reflectapi_demo::tests::generics::TestStructWithVecGeneric, headers: reflectapi::Empty, - ) -> Result> { + ) -> Result< + reflectapi::rt::ApiResult, + reflectapi::rt::Error, + > { reflectapi::rt::__request_impl( &self.client, self.base_url diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_vec_generic_generic-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_vec_generic_generic-3.snap index 6febf588..329c1fd5 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_vec_generic_generic-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_vec_generic_generic-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/generics.rs expression: "super::into_input_rust_code::>()" -snapshot_kind: text --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -40,7 +39,10 @@ pub mod interface { u8, >, headers: reflectapi::Empty, - ) -> Result> { + ) -> Result< + reflectapi::rt::ApiResult, + reflectapi::rt::Error, + > { reflectapi::rt::__request_impl( &self.client, self.base_url diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_vec_generic_generic_generic-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_vec_generic_generic_generic-3.snap index 8195eb55..9820abe3 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_vec_generic_generic_generic-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_vec_generic_generic_generic-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/generics.rs expression: "super::into_input_rust_code::>>()" -snapshot_kind: text --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -38,7 +37,10 @@ pub mod interface { &self, input: super::types::reflectapi_demo::tests::generics::TestStructWithVecGenericGenericGeneric>, headers: reflectapi::Empty, - ) -> Result> { + ) -> Result< + reflectapi::rt::ApiResult, + reflectapi::rt::Error, + > { reflectapi::rt::__request_impl( &self.client, self.base_url diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__namespace__conflicting_names-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__namespace__conflicting_names-3.snap index ac8169ca..15b14467 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__namespace__conflicting_names-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__namespace__conflicting_names-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/namespace.rs expression: rust -snapshot_kind: text --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -62,8 +61,10 @@ pub mod interface { &self, input: usize, headers: reflectapi::Empty, - ) -> Result> - { + ) -> Result< + reflectapi::rt::ApiResult, + reflectapi::rt::Error, + > { reflectapi::rt::__request_impl( &self.client, self.base_url diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__namespace__conflicting_namespace_names-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__namespace__conflicting_namespace_names-3.snap index 0934f99d..fd4f17e2 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__namespace__conflicting_namespace_names-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__namespace__conflicting_namespace_names-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/namespace.rs expression: rust -snapshot_kind: text --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -88,7 +87,10 @@ pub mod interface { &self, input: reflectapi::Empty, headers: reflectapi::Empty, - ) -> Result> { + ) -> Result< + reflectapi::rt::ApiResult, + reflectapi::rt::Error, + > { reflectapi::rt::__request_impl( &self.client, self.base_url @@ -146,7 +148,8 @@ pub mod interface { &self, input: reflectapi::Empty, headers: reflectapi::Empty, - ) -> Result<(), reflectapi::rt::Error> { + ) -> Result, reflectapi::rt::Error> + { reflectapi::rt::__request_impl( &self.client, self.base_url diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__namespace__generic_and_type_conflict-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__namespace__generic_and_type_conflict-3.snap index e625b480..9958eeca 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__namespace__generic_and_type_conflict-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__namespace__generic_and_type_conflict-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/namespace.rs expression: rust -snapshot_kind: text --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -39,7 +38,9 @@ pub mod interface { input: super::types::reflectapi_demo::tests::namespace::K>, headers: reflectapi::Empty, ) -> Result< - super::types::reflectapi_demo::tests::namespace::K>, + reflectapi::rt::ApiResult< + super::types::reflectapi_demo::tests::namespace::K>, + >, reflectapi::rt::Error, > { reflectapi::rt::__request_impl( diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__namespace__namespace_with_dash-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__namespace__namespace_with_dash-3.snap index c753d6de..7200546d 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__namespace__namespace_with_dash-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__namespace__namespace_with_dash-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/namespace.rs expression: rust -snapshot_kind: text --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -87,7 +86,10 @@ pub mod interface { &self, input: reflectapi::Empty, headers: reflectapi::Empty, - ) -> Result> { + ) -> Result< + reflectapi::rt::ApiResult, + reflectapi::rt::Error, + > { reflectapi::rt::__request_impl( &self.client, self.base_url diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__adj_repr_enum_with_untagged_variant-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__adj_repr_enum_with_untagged_variant-3.snap index fe63bb47..fc75aea9 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__adj_repr_enum_with_untagged_variant-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__adj_repr_enum_with_untagged_variant-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/serde.rs expression: "super::into_rust_code::()" -snapshot_kind: text --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -39,7 +38,7 @@ pub mod interface { input: super::types::reflectapi_demo::tests::serde::Test, headers: reflectapi::Empty, ) -> Result< - super::types::reflectapi_demo::tests::serde::Test, + reflectapi::rt::ApiResult, reflectapi::rt::Error, > { reflectapi::rt::__request_impl( diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__datetime-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__datetime-3.snap index 82b32b5f..f03b8311 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__datetime-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__datetime-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/serde.rs expression: "super::into_rust_code::()" -snapshot_kind: text --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -39,7 +38,7 @@ pub mod interface { input: super::types::reflectapi_demo::tests::serde::TestStruct, headers: reflectapi::Empty, ) -> Result< - super::types::reflectapi_demo::tests::serde::TestStruct, + reflectapi::rt::ApiResult, reflectapi::rt::Error, > { reflectapi::rt::__request_impl( diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__empty_variants_adjacently_tagged-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__empty_variants_adjacently_tagged-3.snap index 296aa5b7..b120c2cd 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__empty_variants_adjacently_tagged-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__empty_variants_adjacently_tagged-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/serde.rs expression: "super::into_rust_code::()" -snapshot_kind: text --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -39,7 +38,9 @@ pub mod interface { input: super::types::reflectapi_demo::tests::serde::TestEmptyVariantsAdjacentlyTagged, headers: reflectapi::Empty, ) -> Result< - super::types::reflectapi_demo::tests::serde::TestEmptyVariantsAdjacentlyTagged, + reflectapi::rt::ApiResult< + super::types::reflectapi_demo::tests::serde::TestEmptyVariantsAdjacentlyTagged, + >, reflectapi::rt::Error, > { reflectapi::rt::__request_impl( diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__empty_variants_externally_tagged-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__empty_variants_externally_tagged-3.snap index 59301b26..6fa313f2 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__empty_variants_externally_tagged-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__empty_variants_externally_tagged-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/serde.rs expression: "super::into_rust_code::()" -snapshot_kind: text --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -39,7 +38,9 @@ pub mod interface { input: super::types::reflectapi_demo::tests::serde::TestEmptyVariantsExternallyTagged, headers: reflectapi::Empty, ) -> Result< - super::types::reflectapi_demo::tests::serde::TestEmptyVariantsExternallyTagged, + reflectapi::rt::ApiResult< + super::types::reflectapi_demo::tests::serde::TestEmptyVariantsExternallyTagged, + >, reflectapi::rt::Error, > { reflectapi::rt::__request_impl( diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__empty_variants_internally_tagged-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__empty_variants_internally_tagged-3.snap index 76e6ac71..aa740c2f 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__empty_variants_internally_tagged-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__empty_variants_internally_tagged-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/serde.rs expression: "super::into_rust_code::()" -snapshot_kind: text --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -39,7 +38,9 @@ pub mod interface { input: super::types::reflectapi_demo::tests::serde::TestEmptyVariantsInterallyTagged, headers: reflectapi::Empty, ) -> Result< - super::types::reflectapi_demo::tests::serde::TestEmptyVariantsInterallyTagged, + reflectapi::rt::ApiResult< + super::types::reflectapi_demo::tests::serde::TestEmptyVariantsInterallyTagged, + >, reflectapi::rt::Error, > { reflectapi::rt::__request_impl( diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__empty_variants_untagged-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__empty_variants_untagged-3.snap index f43bd6c7..e7391465 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__empty_variants_untagged-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__empty_variants_untagged-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/serde.rs expression: "super::into_rust_code::()" -snapshot_kind: text --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -39,7 +38,9 @@ pub mod interface { input: super::types::reflectapi_demo::tests::serde::TestEmptyVariantsUntagged, headers: reflectapi::Empty, ) -> Result< - super::types::reflectapi_demo::tests::serde::TestEmptyVariantsUntagged, + reflectapi::rt::ApiResult< + super::types::reflectapi_demo::tests::serde::TestEmptyVariantsUntagged, + >, reflectapi::rt::Error, > { reflectapi::rt::__request_impl( diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_rename-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_rename-3.snap index 0bdbcb12..80daa98e 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_rename-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_rename-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/serde.rs expression: "super::into_rust_code::()" -snapshot_kind: text --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -39,7 +38,7 @@ pub mod interface { input: super::types::reflectapi_demo::tests::serde::MyEnum, headers: reflectapi::Empty, ) -> Result< - super::types::reflectapi_demo::tests::serde::MyEnum, + reflectapi::rt::ApiResult, reflectapi::rt::Error, > { reflectapi::rt::__request_impl( diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_rename_all-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_rename_all-3.snap index cbb1ebce..218152ad 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_rename_all-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_rename_all-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/serde.rs expression: "super::into_rust_code::()" -snapshot_kind: text --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -39,7 +38,9 @@ pub mod interface { input: super::types::reflectapi_demo::tests::serde::TestEnumRenameAll, headers: reflectapi::Empty, ) -> Result< - super::types::reflectapi_demo::tests::serde::TestEnumRenameAll, + reflectapi::rt::ApiResult< + super::types::reflectapi_demo::tests::serde::TestEnumRenameAll, + >, reflectapi::rt::Error, > { reflectapi::rt::__request_impl( diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_rename_all_on_variant-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_rename_all_on_variant-3.snap index ee1e66c0..95b3bb35 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_rename_all_on_variant-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_rename_all_on_variant-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/serde.rs expression: "super::into_rust_code::()" -snapshot_kind: text --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -39,7 +38,9 @@ pub mod interface { input: super::types::reflectapi_demo::tests::serde::TestEnumRenameAllOnVariant, headers: reflectapi::Empty, ) -> Result< - super::types::reflectapi_demo::tests::serde::TestEnumRenameAllOnVariant, + reflectapi::rt::ApiResult< + super::types::reflectapi_demo::tests::serde::TestEnumRenameAllOnVariant, + >, reflectapi::rt::Error, > { reflectapi::rt::__request_impl( diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_rename_variant_field-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_rename_variant_field-3.snap index 129dea87..2a08027f 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_rename_variant_field-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_rename_variant_field-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/serde.rs expression: "super::into_rust_code::()" -snapshot_kind: text --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -39,7 +38,9 @@ pub mod interface { input: super::types::reflectapi_demo::tests::serde::TestEnumRenameVariantField, headers: reflectapi::Empty, ) -> Result< - super::types::reflectapi_demo::tests::serde::TestEnumRenameVariantField, + reflectapi::rt::ApiResult< + super::types::reflectapi_demo::tests::serde::TestEnumRenameVariantField, + >, reflectapi::rt::Error, > { reflectapi::rt::__request_impl( diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_tag-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_tag-3.snap index d1867c65..6dbeccad 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_tag-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_tag-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/serde.rs expression: "super::into_rust_code::()" -snapshot_kind: text --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -39,7 +38,7 @@ pub mod interface { input: super::types::reflectapi_demo::tests::serde::TestEnumTag, headers: reflectapi::Empty, ) -> Result< - super::types::reflectapi_demo::tests::serde::TestEnumTag, + reflectapi::rt::ApiResult, reflectapi::rt::Error, > { reflectapi::rt::__request_impl( diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_tag_content-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_tag_content-3.snap index 4ab107bc..45ee7f37 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_tag_content-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_tag_content-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/serde.rs expression: "super::into_rust_code::()" -snapshot_kind: text --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -39,7 +38,9 @@ pub mod interface { input: super::types::reflectapi_demo::tests::serde::TestEnumTagContent, headers: reflectapi::Empty, ) -> Result< - super::types::reflectapi_demo::tests::serde::TestEnumTagContent, + reflectapi::rt::ApiResult< + super::types::reflectapi_demo::tests::serde::TestEnumTagContent, + >, reflectapi::rt::Error, > { reflectapi::rt::__request_impl( diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_tag_content_rename_all-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_tag_content_rename_all-3.snap index b24c6049..cf8df47b 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_tag_content_rename_all-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_tag_content_rename_all-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/serde.rs expression: "super::into_rust_code::()" -snapshot_kind: text --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -39,7 +38,9 @@ pub mod interface { input: super::types::reflectapi_demo::tests::serde::TestEnumTagContentRenameAll, headers: reflectapi::Empty, ) -> Result< - super::types::reflectapi_demo::tests::serde::TestEnumTagContentRenameAll, + reflectapi::rt::ApiResult< + super::types::reflectapi_demo::tests::serde::TestEnumTagContentRenameAll, + >, reflectapi::rt::Error, > { reflectapi::rt::__request_impl( diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_untagged-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_untagged-3.snap index 4f6f5be0..dd09fc0e 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_untagged-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_untagged-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/serde.rs expression: "super::into_rust_code::()" -snapshot_kind: text --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -39,7 +38,9 @@ pub mod interface { input: super::types::reflectapi_demo::tests::serde::TestEnumUntagged, headers: reflectapi::Empty, ) -> Result< - super::types::reflectapi_demo::tests::serde::TestEnumUntagged, + reflectapi::rt::ApiResult< + super::types::reflectapi_demo::tests::serde::TestEnumUntagged, + >, reflectapi::rt::Error, > { reflectapi::rt::__request_impl( diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_field_skip-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_field_skip-3.snap index cbff5f70..091a298a 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_field_skip-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_field_skip-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/serde.rs expression: "super::into_rust_code::()" -snapshot_kind: text --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -39,7 +38,9 @@ pub mod interface { input: super::types::reflectapi_demo::tests::serde::TestEnumWithFieldSkip, headers: reflectapi::Empty, ) -> Result< - super::types::reflectapi_demo::tests::serde::TestEnumWithFieldSkip, + reflectapi::rt::ApiResult< + super::types::reflectapi_demo::tests::serde::TestEnumWithFieldSkip, + >, reflectapi::rt::Error, > { reflectapi::rt::__request_impl( diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_rename_to_invalid_chars-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_rename_to_invalid_chars-3.snap index 7aaa3d15..a9d8e20f 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_rename_to_invalid_chars-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_rename_to_invalid_chars-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/serde.rs expression: "super::into_rust_code::()" -snapshot_kind: text --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -39,7 +38,9 @@ pub mod interface { input: super::types::reflectapi_demo::tests::serde::TestEnumWithRenameToInvalidChars, headers: reflectapi::Empty, ) -> Result< - super::types::reflectapi_demo::tests::serde::TestEnumWithRenameToInvalidChars, + reflectapi::rt::ApiResult< + super::types::reflectapi_demo::tests::serde::TestEnumWithRenameToInvalidChars, + >, reflectapi::rt::Error, > { reflectapi::rt::__request_impl( diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_variant_other-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_variant_other-3.snap index c98749d8..fc064c38 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_variant_other-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_variant_other-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/serde.rs expression: "super::into_rust_code::()" -snapshot_kind: text --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -39,7 +38,9 @@ pub mod interface { input: super::types::reflectapi_demo::tests::serde::input::TestEnumWithVariantOther, headers: reflectapi::Empty, ) -> Result< - super::types::reflectapi_demo::tests::serde::output::TestEnumWithVariantOther, + reflectapi::rt::ApiResult< + super::types::reflectapi_demo::tests::serde::output::TestEnumWithVariantOther, + >, reflectapi::rt::Error, > { reflectapi::rt::__request_impl( diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_variant_skip-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_variant_skip-3.snap index 002c425e..f4ae3261 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_variant_skip-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_variant_skip-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/serde.rs expression: "super::into_rust_code::()" -snapshot_kind: text --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -39,7 +38,9 @@ pub mod interface { input: super::types::reflectapi_demo::tests::serde::TestEnumWithVariantSkip, headers: reflectapi::Empty, ) -> Result< - super::types::reflectapi_demo::tests::serde::TestEnumWithVariantSkip, + reflectapi::rt::ApiResult< + super::types::reflectapi_demo::tests::serde::TestEnumWithVariantSkip, + >, reflectapi::rt::Error, > { reflectapi::rt::__request_impl( diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_variant_skip_deserialize-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_variant_skip_deserialize-3.snap index ec6a214b..9dccc5e0 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_variant_skip_deserialize-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_variant_skip_deserialize-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/serde.rs expression: "super::into_rust_code::()" -snapshot_kind: text --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -34,14 +33,8 @@ pub mod interface { Ok(Self { client, base_url }) } - pub async fn inout_test( - &self, - input: super::types::reflectapi_demo::tests::serde::input::TestEnumWithVariantSkipDeserialize, - headers: reflectapi::Empty, - ) -> Result< - super::types::reflectapi_demo::tests::serde::output::TestEnumWithVariantSkipDeserialize, - reflectapi::rt::Error, - > { + pub async fn inout_test(&self, input: super::types::reflectapi_demo::tests::serde::input::TestEnumWithVariantSkipDeserialize, headers: reflectapi::Empty) + -> Result, reflectapi::rt::Error>{ reflectapi::rt::__request_impl( &self.client, self.base_url diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_variant_skip_serialize-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_variant_skip_serialize-3.snap index 8507ce01..c132353d 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_variant_skip_serialize-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_variant_skip_serialize-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/serde.rs expression: "super::into_rust_code::()" -snapshot_kind: text --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -34,14 +33,8 @@ pub mod interface { Ok(Self { client, base_url }) } - pub async fn inout_test( - &self, - input: super::types::reflectapi_demo::tests::serde::input::TestEnumWithVariantSkipSerialize, - headers: reflectapi::Empty, - ) -> Result< - super::types::reflectapi_demo::tests::serde::output::TestEnumWithVariantSkipSerialize, - reflectapi::rt::Error, - > { + pub async fn inout_test(&self, input: super::types::reflectapi_demo::tests::serde::input::TestEnumWithVariantSkipSerialize, headers: reflectapi::Empty) + -> Result, reflectapi::rt::Error>{ reflectapi::rt::__request_impl( &self.client, self.base_url diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_variant_untagged-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_variant_untagged-3.snap index 88a7721b..b7a55a99 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_variant_untagged-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_variant_untagged-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/serde.rs expression: "super::into_rust_code::()" -snapshot_kind: text --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -39,7 +38,9 @@ pub mod interface { input: super::types::reflectapi_demo::tests::serde::TestEnumWithVariantUntagged, headers: reflectapi::Empty, ) -> Result< - super::types::reflectapi_demo::tests::serde::TestEnumWithVariantUntagged, + reflectapi::rt::ApiResult< + super::types::reflectapi_demo::tests::serde::TestEnumWithVariantUntagged, + >, reflectapi::rt::Error, > { reflectapi::rt::__request_impl( diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__external_impls-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__external_impls-3.snap index 7c0eb279..f2fa6c20 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__external_impls-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__external_impls-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/serde.rs expression: "super::into_rust_code::()" -snapshot_kind: text --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -39,7 +38,7 @@ pub mod interface { input: super::types::reflectapi_demo::tests::serde::Test, headers: reflectapi::Empty, ) -> Result< - super::types::reflectapi_demo::tests::serde::Test, + reflectapi::rt::ApiResult, reflectapi::rt::Error, > { reflectapi::rt::__request_impl( diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_internally_tagged-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_internally_tagged-3.snap index d455b97d..b59959e5 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_internally_tagged-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_internally_tagged-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/serde.rs expression: "super::into_rust_code::()" -snapshot_kind: text --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -39,7 +38,7 @@ pub mod interface { input: super::types::reflectapi_demo::tests::serde::Test, headers: reflectapi::Empty, ) -> Result< - super::types::reflectapi_demo::tests::serde::Test, + reflectapi::rt::ApiResult, reflectapi::rt::Error, > { reflectapi::rt::__request_impl( diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_unit-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_unit-3.snap index ededeca1..7c7e8657 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_unit-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_unit-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/serde.rs expression: "super::into_rust_code::>()" -snapshot_kind: text --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -42,9 +41,11 @@ pub mod interface { >, headers: reflectapi::Empty, ) -> Result< - super::types::reflectapi_demo::tests::serde::S< - super::types::reflectapi_demo::tests::serde::K, - (), + reflectapi::rt::ApiResult< + super::types::reflectapi_demo::tests::serde::S< + super::types::reflectapi_demo::tests::serde::K, + (), + >, >, reflectapi::rt::Error, > { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__generic_struct_repr_transparent-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__generic_struct_repr_transparent-3.snap index 235e49d5..c33d5f1b 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__generic_struct_repr_transparent-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__generic_struct_repr_transparent-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/serde.rs expression: "super::into_rust_code::>()" -snapshot_kind: text --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -38,7 +37,10 @@ pub mod interface { &self, input: std::vec::Vec, headers: reflectapi::Empty, - ) -> Result, reflectapi::rt::Error> { + ) -> Result< + reflectapi::rt::ApiResult>, + reflectapi::rt::Error, + > { reflectapi::rt::__request_impl( &self.client, self.base_url diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__generic_struct_repr_transparent_partially_generic-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__generic_struct_repr_transparent_partially_generic-3.snap index b58d0e1d..55867ad3 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__generic_struct_repr_transparent_partially_generic-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__generic_struct_repr_transparent_partially_generic-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/serde.rs expression: "super::into_rust_code::>()" -snapshot_kind: text --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -39,7 +38,7 @@ pub mod interface { input: std::collections::HashMap, headers: reflectapi::Empty, ) -> Result< - std::collections::HashMap, + reflectapi::rt::ApiResult>, reflectapi::rt::Error, > { reflectapi::rt::__request_impl( diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__kebab_case-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__kebab_case-3.snap index 9b6689b5..8f0de476 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__kebab_case-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__kebab_case-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/serde.rs expression: "super::into_rust_code::()" -snapshot_kind: text --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -39,7 +38,7 @@ pub mod interface { input: super::types::reflectapi_demo::tests::serde::Test, headers: reflectapi::Empty, ) -> Result< - super::types::reflectapi_demo::tests::serde::Test, + reflectapi::rt::ApiResult, reflectapi::rt::Error, > { reflectapi::rt::__request_impl( diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__nested_internally_tagged_enums-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__nested_internally_tagged_enums-3.snap index eec41c11..c49d98c3 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__nested_internally_tagged_enums-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__nested_internally_tagged_enums-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/serde.rs expression: "super::into_rust_code::()" -snapshot_kind: text --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -39,7 +38,7 @@ pub mod interface { input: super::types::reflectapi_demo::tests::serde::Test, headers: reflectapi::Empty, ) -> Result< - super::types::reflectapi_demo::tests::serde::Test, + reflectapi::rt::ApiResult, reflectapi::rt::Error, > { reflectapi::rt::__request_impl( diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__nested_internally_tagged_enums_minimal-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__nested_internally_tagged_enums_minimal-3.snap index 1af7dcb3..0b0bba42 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__nested_internally_tagged_enums_minimal-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__nested_internally_tagged_enums_minimal-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/serde.rs expression: "super::into_rust_code::()" -snapshot_kind: text --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -39,7 +38,7 @@ pub mod interface { input: super::types::reflectapi_demo::tests::serde::Test, headers: reflectapi::Empty, ) -> Result< - super::types::reflectapi_demo::tests::serde::Test, + reflectapi::rt::ApiResult, reflectapi::rt::Error, > { reflectapi::rt::__request_impl( diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__newtype_variants_adjacently_tagged-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__newtype_variants_adjacently_tagged-3.snap index 2c081e62..bbeaf4cc 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__newtype_variants_adjacently_tagged-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__newtype_variants_adjacently_tagged-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/serde.rs expression: "super::into_rust_code::()" -snapshot_kind: text --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -39,7 +38,9 @@ pub mod interface { input: super::types::reflectapi_demo::tests::serde::TestNewtypeVariantsAdjacentlyTagged, headers: reflectapi::Empty, ) -> Result< - super::types::reflectapi_demo::tests::serde::TestNewtypeVariantsAdjacentlyTagged, + reflectapi::rt::ApiResult< + super::types::reflectapi_demo::tests::serde::TestNewtypeVariantsAdjacentlyTagged, + >, reflectapi::rt::Error, > { reflectapi::rt::__request_impl( diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__newtype_variants_externally_tagged-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__newtype_variants_externally_tagged-3.snap index 60928008..530949f0 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__newtype_variants_externally_tagged-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__newtype_variants_externally_tagged-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/serde.rs expression: "super::into_rust_code::()" -snapshot_kind: text --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -39,7 +38,9 @@ pub mod interface { input: super::types::reflectapi_demo::tests::serde::TestNewtypeVariantsExternallyTagged, headers: reflectapi::Empty, ) -> Result< - super::types::reflectapi_demo::tests::serde::TestNewtypeVariantsExternallyTagged, + reflectapi::rt::ApiResult< + super::types::reflectapi_demo::tests::serde::TestNewtypeVariantsExternallyTagged, + >, reflectapi::rt::Error, > { reflectapi::rt::__request_impl( diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__newtype_variants_internally_tagged-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__newtype_variants_internally_tagged-3.snap index b0b4da84..e037949c 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__newtype_variants_internally_tagged-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__newtype_variants_internally_tagged-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/serde.rs expression: "super::into_rust_code::()" -snapshot_kind: text --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -39,7 +38,7 @@ pub mod interface { input: super::types::reflectapi_demo::tests::serde::Enum, headers: reflectapi::Empty, ) -> Result< - super::types::reflectapi_demo::tests::serde::Enum, + reflectapi::rt::ApiResult, reflectapi::rt::Error, > { reflectapi::rt::__request_impl( diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_from-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_from-3.snap index cf1fc631..70d2e995 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_from-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_from-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/serde.rs expression: "super::into_rust_code::()" -snapshot_kind: text --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -39,7 +38,9 @@ pub mod interface { input: super::types::reflectapi_demo::tests::serde::TestStructFrom, headers: reflectapi::Empty, ) -> Result< - super::types::reflectapi_demo::tests::serde::TestStructFromProxy, + reflectapi::rt::ApiResult< + super::types::reflectapi_demo::tests::serde::TestStructFromProxy, + >, reflectapi::rt::Error, > { reflectapi::rt::__request_impl( diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_into-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_into-3.snap index 64fd50ba..069c9f8d 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_into-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_into-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/serde.rs expression: "super::into_rust_code::()" -snapshot_kind: text --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -39,7 +38,7 @@ pub mod interface { input: super::types::reflectapi_demo::tests::serde::TestStructIntoProxy, headers: reflectapi::Empty, ) -> Result< - super::types::reflectapi_demo::tests::serde::TestStructInto, + reflectapi::rt::ApiResult, reflectapi::rt::Error, > { reflectapi::rt::__request_impl( diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename-3.snap index 33a55555..6359cead 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/serde.rs expression: "super::into_rust_code::()" -snapshot_kind: text --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -39,7 +38,7 @@ pub mod interface { input: super::types::reflectapi_demo::tests::serde::MyStruct, headers: reflectapi::Empty, ) -> Result< - super::types::reflectapi_demo::tests::serde::MyStruct, + reflectapi::rt::ApiResult, reflectapi::rt::Error, > { reflectapi::rt::__request_impl( diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename_all-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename_all-3.snap index 24146efe..d8b4f079 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename_all-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename_all-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/serde.rs expression: "super::into_rust_code::()" -snapshot_kind: text --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -39,7 +38,9 @@ pub mod interface { input: super::types::reflectapi_demo::tests::serde::TestStructRenameAll, headers: reflectapi::Empty, ) -> Result< - super::types::reflectapi_demo::tests::serde::TestStructRenameAll, + reflectapi::rt::ApiResult< + super::types::reflectapi_demo::tests::serde::TestStructRenameAll, + >, reflectapi::rt::Error, > { reflectapi::rt::__request_impl( diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename_all_differently-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename_all_differently-3.snap index c8b79b27..cae50e65 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename_all_differently-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename_all_differently-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/serde.rs expression: "super::into_rust_code::()" -snapshot_kind: text --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -39,7 +38,9 @@ pub mod interface { input: super::types::reflectapi_demo::tests::serde::input::TestStructRenameAllDifferently, headers: reflectapi::Empty, ) -> Result< - super::types::reflectapi_demo::tests::serde::output::TestStructRenameAllDifferently, + reflectapi::rt::ApiResult< + super::types::reflectapi_demo::tests::serde::output::TestStructRenameAllDifferently, + >, reflectapi::rt::Error, > { reflectapi::rt::__request_impl( diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename_all_pascal_case-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename_all_pascal_case-3.snap index e1026faa..55206683 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename_all_pascal_case-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename_all_pascal_case-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/serde.rs expression: "super::into_rust_code::()" -snapshot_kind: text --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -39,7 +38,9 @@ pub mod interface { input: super::types::reflectapi_demo::tests::serde::TestStructRenameAllPascalCase, headers: reflectapi::Empty, ) -> Result< - super::types::reflectapi_demo::tests::serde::TestStructRenameAllPascalCase, + reflectapi::rt::ApiResult< + super::types::reflectapi_demo::tests::serde::TestStructRenameAllPascalCase, + >, reflectapi::rt::Error, > { reflectapi::rt::__request_impl( diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename_differently-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename_differently-3.snap index a2bb77ce..d6b3103c 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename_differently-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename_differently-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/serde.rs expression: "super::into_rust_code::()" -snapshot_kind: text --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -39,7 +38,7 @@ pub mod interface { input: super::types::reflectapi_demo::tests::serde::MyStructInput, headers: reflectapi::Empty, ) -> Result< - super::types::reflectapi_demo::tests::serde::MyStructOutput, + reflectapi::rt::ApiResult, reflectapi::rt::Error, > { reflectapi::rt::__request_impl( diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename_field-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename_field-3.snap index 8d974921..89cc87a0 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename_field-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename_field-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/serde.rs expression: "super::into_rust_code::()" -snapshot_kind: text --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -39,7 +38,9 @@ pub mod interface { input: super::types::reflectapi_demo::tests::serde::input::TestStructRenameField, headers: reflectapi::Empty, ) -> Result< - super::types::reflectapi_demo::tests::serde::output::TestStructRenameField, + reflectapi::rt::ApiResult< + super::types::reflectapi_demo::tests::serde::output::TestStructRenameField, + >, reflectapi::rt::Error, > { reflectapi::rt::__request_impl( diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_repr_transparent_generic_inner_type-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_repr_transparent_generic_inner_type-3.snap index 360cfdd5..8e10b245 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_repr_transparent_generic_inner_type-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_repr_transparent_generic_inner_type-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/serde.rs expression: "super::into_rust_code::()" -snapshot_kind: text --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -39,7 +38,7 @@ pub mod interface { input: super::types::reflectapi_demo::tests::serde::Test, headers: reflectapi::Empty, ) -> Result< - super::types::reflectapi_demo::tests::serde::Test, + reflectapi::rt::ApiResult, reflectapi::rt::Error, > { reflectapi::rt::__request_impl( diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_try_from-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_try_from-3.snap index d16fcb1f..14660fa7 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_try_from-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_try_from-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/serde.rs expression: "super::into_rust_code::()" -snapshot_kind: text --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -39,7 +38,9 @@ pub mod interface { input: super::types::reflectapi_demo::tests::serde::TestStructTryFrom, headers: reflectapi::Empty, ) -> Result< - super::types::reflectapi_demo::tests::serde::TestStructTryFormProxy, + reflectapi::rt::ApiResult< + super::types::reflectapi_demo::tests::serde::TestStructTryFormProxy, + >, reflectapi::rt::Error, > { reflectapi::rt::__request_impl( diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_flatten-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_flatten-3.snap index 91ad8d80..07baaf6c 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_flatten-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_flatten-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/serde.rs expression: "super::into_rust_code::()" -snapshot_kind: text --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -39,7 +38,9 @@ pub mod interface { input: super::types::reflectapi_demo::tests::serde::TestStructWithFlatten, headers: reflectapi::Empty, ) -> Result< - super::types::reflectapi_demo::tests::serde::TestStructWithFlatten, + reflectapi::rt::ApiResult< + super::types::reflectapi_demo::tests::serde::TestStructWithFlatten, + >, reflectapi::rt::Error, > { reflectapi::rt::__request_impl( diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_flatten_optional-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_flatten_optional-3.snap index a2752955..dddd74b6 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_flatten_optional-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_flatten_optional-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/serde.rs expression: "super::into_rust_code::()" -snapshot_kind: text --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -39,7 +38,9 @@ pub mod interface { input: super::types::reflectapi_demo::tests::serde::TestStructWithFlattenOptional, headers: reflectapi::Empty, ) -> Result< - super::types::reflectapi_demo::tests::serde::TestStructWithFlattenOptional, + reflectapi::rt::ApiResult< + super::types::reflectapi_demo::tests::serde::TestStructWithFlattenOptional, + >, reflectapi::rt::Error, > { reflectapi::rt::__request_impl( diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_flatten_optional_and_required-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_flatten_optional_and_required-3.snap index 2590e27f..d79416d7 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_flatten_optional_and_required-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_flatten_optional_and_required-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/serde.rs expression: "super::into_rust_code::()" -snapshot_kind: text --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -34,14 +33,8 @@ pub mod interface { Ok(Self { client, base_url }) } - pub async fn inout_test( - &self, - input: super::types::reflectapi_demo::tests::serde::TestStructWithFlattenOptionalAndRequired, - headers: reflectapi::Empty, - ) -> Result< - super::types::reflectapi_demo::tests::serde::TestStructWithFlattenOptionalAndRequired, - reflectapi::rt::Error, - > { + pub async fn inout_test(&self, input: super::types::reflectapi_demo::tests::serde::TestStructWithFlattenOptionalAndRequired, headers: reflectapi::Empty) + -> Result, reflectapi::rt::Error>{ reflectapi::rt::__request_impl( &self.client, self.base_url diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_rename_to_invalid_chars-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_rename_to_invalid_chars-3.snap index 2c20efb7..8ce018a0 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_rename_to_invalid_chars-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_rename_to_invalid_chars-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/serde.rs expression: "super::into_rust_code::()" -snapshot_kind: text --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -39,7 +38,9 @@ pub mod interface { input: super::types::reflectapi_demo::tests::serde::TestStructWithRenameToInvalidChars, headers: reflectapi::Empty, ) -> Result< - super::types::reflectapi_demo::tests::serde::TestStructWithRenameToInvalidChars, + reflectapi::rt::ApiResult< + super::types::reflectapi_demo::tests::serde::TestStructWithRenameToInvalidChars, + >, reflectapi::rt::Error, > { reflectapi::rt::__request_impl( diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_rename_to_kebab_case-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_rename_to_kebab_case-3.snap index ff22224a..95411998 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_rename_to_kebab_case-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_rename_to_kebab_case-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/serde.rs expression: "super::into_rust_code::()" -snapshot_kind: text --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -39,7 +38,7 @@ pub mod interface { input: super::types::reflectapi_demo::tests::serde::struct_name, headers: reflectapi::Empty, ) -> Result< - super::types::reflectapi_demo::tests::serde::struct_name, + reflectapi::rt::ApiResult, reflectapi::rt::Error, > { reflectapi::rt::__request_impl( diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_serde_default-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_serde_default-3.snap index debb962c..77c7f185 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_serde_default-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_serde_default-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/serde.rs expression: "super::into_rust_code::()" -snapshot_kind: text --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -39,7 +38,9 @@ pub mod interface { input: super::types::reflectapi_demo::tests::serde::input::TestStructWithSerdeDefault, headers: reflectapi::Empty, ) -> Result< - super::types::reflectapi_demo::tests::serde::output::TestStructWithSerdeDefault, + reflectapi::rt::ApiResult< + super::types::reflectapi_demo::tests::serde::output::TestStructWithSerdeDefault, + >, reflectapi::rt::Error, > { reflectapi::rt::__request_impl( diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_serde_skip-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_serde_skip-3.snap index 973dfc79..edd9e9a6 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_serde_skip-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_serde_skip-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/serde.rs expression: "super::into_rust_code::()" -snapshot_kind: text --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -39,7 +38,9 @@ pub mod interface { input: super::types::reflectapi_demo::tests::serde::TestStructWithSerdeSkip, headers: reflectapi::Empty, ) -> Result< - super::types::reflectapi_demo::tests::serde::TestStructWithSerdeSkip, + reflectapi::rt::ApiResult< + super::types::reflectapi_demo::tests::serde::TestStructWithSerdeSkip, + >, reflectapi::rt::Error, > { reflectapi::rt::__request_impl( diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_serde_skip_deserialize-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_serde_skip_deserialize-3.snap index 53a4b9ef..f9132e6f 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_serde_skip_deserialize-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_serde_skip_deserialize-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/serde.rs expression: "super::into_rust_code::()" -snapshot_kind: text --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -34,14 +33,8 @@ pub mod interface { Ok(Self { client, base_url }) } - pub async fn inout_test( - &self, - input: super::types::reflectapi_demo::tests::serde::input::TestStructWithSerdeSkipDeserialize, - headers: reflectapi::Empty, - ) -> Result< - super::types::reflectapi_demo::tests::serde::output::TestStructWithSerdeSkipDeserialize, - reflectapi::rt::Error, - > { + pub async fn inout_test(&self, input: super::types::reflectapi_demo::tests::serde::input::TestStructWithSerdeSkipDeserialize, headers: reflectapi::Empty) + -> Result, reflectapi::rt::Error>{ reflectapi::rt::__request_impl( &self.client, self.base_url diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_serde_skip_serialize-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_serde_skip_serialize-3.snap index 13fd8f57..9dd1baf4 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_serde_skip_serialize-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_serde_skip_serialize-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/serde.rs expression: "super::into_rust_code::()" -snapshot_kind: text --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -34,14 +33,8 @@ pub mod interface { Ok(Self { client, base_url }) } - pub async fn inout_test( - &self, - input: super::types::reflectapi_demo::tests::serde::input::TestStructWithSerdeSkipSerialize, - headers: reflectapi::Empty, - ) -> Result< - super::types::reflectapi_demo::tests::serde::output::TestStructWithSerdeSkipSerialize, - reflectapi::rt::Error, - > { + pub async fn inout_test(&self, input: super::types::reflectapi_demo::tests::serde::input::TestStructWithSerdeSkipSerialize, headers: reflectapi::Empty) + -> Result, reflectapi::rt::Error>{ reflectapi::rt::__request_impl( &self.client, self.base_url diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_serde_skip_serialize_if-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_serde_skip_serialize_if-3.snap index a9f25cac..bd11e68a 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_serde_skip_serialize_if-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_serde_skip_serialize_if-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/serde.rs expression: "super::into_rust_code::()" -snapshot_kind: text --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -34,14 +33,8 @@ pub mod interface { Ok(Self { client, base_url }) } - pub async fn inout_test( - &self, - input: super::types::reflectapi_demo::tests::serde::input::TestStructWithSerdeSkipSerializeIf, - headers: reflectapi::Empty, - ) -> Result< - super::types::reflectapi_demo::tests::serde::output::TestStructWithSerdeSkipSerializeIf, - reflectapi::rt::Error, - > { + pub async fn inout_test(&self, input: super::types::reflectapi_demo::tests::serde::input::TestStructWithSerdeSkipSerializeIf, headers: reflectapi::Empty) + -> Result, reflectapi::rt::Error>{ reflectapi::rt::__request_impl( &self.client, self.base_url diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_serde_transparent-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_serde_transparent-3.snap index f0718af3..fc2d03c9 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_serde_transparent-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_serde_transparent-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/serde.rs expression: "super::into_rust_code::()" -snapshot_kind: text --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -38,7 +37,8 @@ pub mod interface { &self, input: u8, headers: reflectapi::Empty, - ) -> Result> { + ) -> Result, reflectapi::rt::Error> + { reflectapi::rt::__request_impl( &self.client, self.base_url diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__unit_struct-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__unit_struct-3.snap index e5c48847..3044f341 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__unit_struct-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__unit_struct-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/serde.rs expression: "super::into_rust_code::()" -snapshot_kind: text --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -39,7 +38,7 @@ pub mod interface { input: super::types::reflectapi_demo::tests::serde::TestUnitStruct, headers: reflectapi::Empty, ) -> Result< - super::types::reflectapi_demo::tests::serde::TestUnitStruct, + reflectapi::rt::ApiResult, reflectapi::rt::Error, > { reflectapi::rt::__request_impl( diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__unit_tuple_struct-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__unit_tuple_struct-3.snap index 91289318..1eadde4b 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__unit_tuple_struct-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__unit_tuple_struct-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/serde.rs expression: "super::into_rust_code::()" -snapshot_kind: text --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -39,7 +38,9 @@ pub mod interface { input: super::types::reflectapi_demo::tests::serde::TestUnitTupleStruct, headers: reflectapi::Empty, ) -> Result< - super::types::reflectapi_demo::tests::serde::TestUnitTupleStruct, + reflectapi::rt::ApiResult< + super::types::reflectapi_demo::tests::serde::TestUnitTupleStruct, + >, reflectapi::rt::Error, > { reflectapi::rt::__request_impl( diff --git a/reflectapi-demo/src/tests/transport_metadata.rs b/reflectapi-demo/src/tests/transport_metadata.rs new file mode 100644 index 00000000..f68e8b81 --- /dev/null +++ b/reflectapi-demo/src/tests/transport_metadata.rs @@ -0,0 +1,591 @@ +// Unit tests for transport metadata functionality +// Tests all internal APIs, error variants, and edge cases comprehensively +// Import the transport metadata types directly from reflectapi crate +use reflectapi::rt::{ + ApiResult, Client, Error, ProtocolErrorStage, RequestTiming, TransportMetadata, + TransportResponse, Url, __request_impl, +}; +use std::collections::HashMap; + +/// Mock client for testing transport metadata functionality +struct MockClient { + responses: HashMap>, +} + +#[derive(Debug)] +struct MockError { + message: String, +} + +impl std::fmt::Display for MockError { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(f, "Mock error: {}", self.message) + } +} + +impl std::error::Error for MockError {} + +impl MockClient { + fn new() -> Self { + Self { + responses: HashMap::new(), + } + } + + fn with_success( + mut self, + path: &str, + status: u16, + body: &str, + headers: Vec<(&str, &str)>, + ) -> Self { + let started_at = std::time::SystemTime::now(); + let completed_at = started_at + std::time::Duration::from_millis(100); + + let mut header_map = http::HeaderMap::new(); + for (name, value) in headers { + header_map.insert( + http::HeaderName::from_bytes(name.as_bytes()).unwrap(), + http::HeaderValue::from_str(value).unwrap(), + ); + } + + let response = TransportResponse { + status: http::StatusCode::from_u16(status).unwrap(), + body: bytes::Bytes::from(body.to_string()), + headers: header_map, + timing: Some(RequestTiming { + started_at, + completed_at, + }), + extensions: HashMap::new(), + }; + + self.responses.insert(path.to_string(), Ok(response)); + self + } + + fn with_error( + mut self, + path: &str, + status: u16, + body: &str, + headers: Vec<(&str, &str)>, + ) -> Self { + let started_at = std::time::SystemTime::now(); + let completed_at = started_at + std::time::Duration::from_millis(50); + + let mut header_map = http::HeaderMap::new(); + for (name, value) in headers { + header_map.insert( + http::HeaderName::from_bytes(name.as_bytes()).unwrap(), + http::HeaderValue::from_str(value).unwrap(), + ); + } + + let response = TransportResponse { + status: http::StatusCode::from_u16(status).unwrap(), + body: bytes::Bytes::from(body.to_string()), + headers: header_map, + timing: Some(RequestTiming { + started_at, + completed_at, + }), + extensions: HashMap::new(), + }; + + self.responses.insert(path.to_string(), Ok(response)); + self + } + + fn with_network_error(mut self, path: &str, message: &str) -> Self { + self.responses.insert( + path.to_string(), + Err(MockError { + message: message.to_string(), + }), + ); + self + } +} + +impl Client for MockClient { + type Error = MockError; + + async fn request( + &self, + url: Url, + _body: bytes::Bytes, + _headers: http::HeaderMap, + ) -> Result { + let path = url.path(); + match self.responses.get(path) { + Some(Ok(response)) => Ok(TransportResponse { + status: response.status, + body: response.body.clone(), + headers: response.headers.clone(), + timing: response.timing.clone(), + extensions: HashMap::new(), // Extensions cannot be cloned as they contain Any + }), + Some(Err(error)) => Err(MockError { + message: error.message.clone(), + }), + None => Err(MockError { + message: format!("No response configured for path: {}", path), + }), + } + } +} + +#[tokio::test] +async fn test_success_response_with_metadata() { + let client = MockClient::new().with_success( + "/test", + 201, + r#"{"result": "created"}"#, + vec![ + ("content-type", "application/json"), + ("x-request-id", "12345"), + ("cache-control", "no-cache"), + ], + ); + + let url = "http://localhost:3000/test".parse().unwrap(); + let result: Result, Error> = + __request_impl(&client, url, serde_json::json!({}), serde_json::json!({})).await; + + assert!(result.is_ok()); + let api_result = result.unwrap(); + + // Test the wrapped value + assert_eq!(api_result.value["result"], "created"); + + // Test status code + assert_eq!(api_result.metadata.status, http::StatusCode::CREATED); + + // Test headers - both presence and values + assert!(api_result.metadata.headers.contains_key("content-type")); + assert_eq!( + api_result.metadata.headers.get("content-type").unwrap(), + "application/json" + ); + assert_eq!( + api_result.metadata.headers.get("x-request-id").unwrap(), + "12345" + ); + assert_eq!( + api_result.metadata.headers.get("cache-control").unwrap(), + "no-cache" + ); + + // Test timing information + assert!(api_result.metadata.timing.is_some()); + let timing = api_result.metadata.timing.as_ref().unwrap(); + assert!(timing.started_at <= timing.completed_at); + let duration = timing.duration(); + assert!(duration >= std::time::Duration::from_millis(100)); + assert!(duration < std::time::Duration::from_secs(1)); + + // Test Deref functionality for backward compatibility + let value_via_deref: &serde_json::Value = &api_result; + assert_eq!(value_via_deref["result"], "created"); +} + +#[tokio::test] +async fn test_application_error_with_metadata() { + let client = MockClient::new().with_error( + "/test", + 400, + r#"{"type": "ValidationError", "message": "Invalid input"}"#, + vec![ + ("content-type", "application/json"), + ("x-error-code", "VAL001"), + ("retry-after", "30"), + ], + ); + + let url = "http://localhost:3000/test".parse().unwrap(); + let result: Result, Error> = + __request_impl(&client, url, serde_json::json!({}), serde_json::json!({})).await; + + assert!(result.is_err()); + let error = result.unwrap_err(); + + match &error { + Error::Application { error, metadata } => { + // Test error content + assert_eq!(error["type"], "ValidationError"); + assert_eq!(error["message"], "Invalid input"); + + // Test status code + assert_eq!(metadata.status, http::StatusCode::BAD_REQUEST); + + // Test headers - both presence and values + assert_eq!( + metadata.headers.get("content-type").unwrap(), + "application/json" + ); + assert_eq!(metadata.headers.get("x-error-code").unwrap(), "VAL001"); + assert_eq!(metadata.headers.get("retry-after").unwrap(), "30"); + + // Test timing information + assert!(metadata.timing.is_some()); + let timing = metadata.timing.as_ref().unwrap(); + assert!(timing.started_at <= timing.completed_at); + let duration = timing.duration(); + assert!(duration >= std::time::Duration::from_millis(50)); + assert!(duration < std::time::Duration::from_secs(1)); + } + _ => panic!("Expected Application error, got: {:?}", error), + } + + // Test unified metadata access + let metadata = error.transport_metadata().unwrap(); + assert_eq!(metadata.status, http::StatusCode::BAD_REQUEST); + + // Test backward compatibility method + assert_eq!(error.status_code().unwrap(), http::StatusCode::BAD_REQUEST); +} + +#[tokio::test] +async fn test_server_error_with_metadata() { + let client = MockClient::new().with_error( + "/test", + 500, + "Internal Server Error", + vec![ + ("content-type", "text/plain"), + ("x-incident-id", "INC-789"), + ("server", "nginx/1.20.1"), + ], + ); + + let url = "http://localhost:3000/test".parse().unwrap(); + let result: Result, Error> = + __request_impl(&client, url, serde_json::json!({}), serde_json::json!({})).await; + + assert!(result.is_err()); + let error = result.unwrap_err(); + + match error { + Error::Server { + status, + body, + metadata, + } => { + // Test server error fields + assert_eq!(status, http::StatusCode::INTERNAL_SERVER_ERROR); + assert_eq!(body, bytes::Bytes::from("Internal Server Error")); + + // Test status code + assert_eq!(metadata.status, http::StatusCode::INTERNAL_SERVER_ERROR); + + // Test headers - both presence and values + assert_eq!(metadata.headers.get("content-type").unwrap(), "text/plain"); + assert_eq!(metadata.headers.get("x-incident-id").unwrap(), "INC-789"); + assert_eq!(metadata.headers.get("server").unwrap(), "nginx/1.20.1"); + + // Test timing information + assert!(metadata.timing.is_some()); + let timing = metadata.timing.as_ref().unwrap(); + assert!(timing.started_at <= timing.completed_at); + let duration = timing.duration(); + assert!(duration >= std::time::Duration::from_millis(50)); + } + _ => panic!("Expected Server error, got: {:?}", error), + } +} + +#[tokio::test] +async fn test_network_error_with_optional_metadata() { + let client = MockClient::new().with_network_error("/test", "Connection refused"); + + let url = "http://localhost:3000/test".parse().unwrap(); + let result: Result, Error> = + __request_impl(&client, url, serde_json::json!({}), serde_json::json!({})).await; + + assert!(result.is_err()); + let error = result.unwrap_err(); + + match &error { + Error::Network { error, metadata } => { + // Test network error content + assert_eq!(error.message, "Connection refused"); + + // Test that metadata is None for network errors (as they don't have HTTP responses) + assert!(metadata.is_none()); + } + _ => panic!("Expected Network error, got: {:?}", error), + } + + // Test unified metadata access returns None for network errors + assert!(error.transport_metadata().is_none()); + assert!(error.status_code().is_none()); +} + +#[tokio::test] +async fn test_protocol_error_with_metadata() { + // Test protocol error by providing invalid JSON in success response + let client = MockClient::new().with_success( + "/test", + 200, + "invalid json {", + vec![("content-type", "application/json")], + ); + + let url = "http://localhost:3000/test".parse().unwrap(); + let result: Result, Error> = + __request_impl(&client, url, serde_json::json!({}), serde_json::json!({})).await; + + assert!(result.is_err()); + let error = result.unwrap_err(); + + match error { + Error::Protocol { + info, + stage, + metadata, + } => { + // Test protocol error info + assert!(info.contains("expected")); + + // Test protocol error stage + match stage { + ProtocolErrorStage::DeserializeResponseBody(body) => { + assert_eq!(body, bytes::Bytes::from("invalid json {")); + } + _ => panic!("Expected DeserializeResponseBody stage, got: {:?}", stage), + } + + // Test metadata is present for protocol errors during response processing + assert_eq!(metadata.status, http::StatusCode::OK); + assert_eq!( + metadata.headers.get("content-type").unwrap(), + "application/json" + ); + assert!(metadata.timing.is_some()); + } + _ => panic!("Expected Protocol error, got: {:?}", error), + } +} + +#[tokio::test] +async fn test_protocol_error_during_serialization() { + // Create a mock URL that won't be called + let client = MockClient::new(); + let url = "http://localhost:3000/test".parse().unwrap(); + + // Create a type that fails to serialize + #[derive(Debug)] + struct FailingSerialize; + + impl serde::Serialize for FailingSerialize { + fn serialize(&self, _serializer: S) -> Result + where + S: serde::Serializer, + { + Err(serde::ser::Error::custom("Serialization failed")) + } + } + + let result: Result, Error> = + __request_impl(&client, url, FailingSerialize, serde_json::json!({})).await; + + assert!(result.is_err()); + let error = result.unwrap_err(); + + match error { + Error::Protocol { + info, + stage, + metadata, + } => { + // Test protocol error info + assert!(info.contains("Serialization failed")); + + // Test protocol error stage + match stage { + ProtocolErrorStage::SerializeRequestBody => { + // Expected stage for request body serialization failure + } + _ => panic!("Expected SerializeRequestBody stage, got: {:?}", stage), + } + + // Test that metadata has default values for pre-request errors + assert_eq!(metadata.status, http::StatusCode::BAD_REQUEST); + assert!(metadata.headers.is_empty()); + assert!(metadata.timing.is_none()); + } + _ => panic!("Expected Protocol error, got: {:?}", error), + } +} + +#[tokio::test] +async fn test_all_error_variants_have_transport_metadata_access() { + // Test that all error variants can be accessed via the unified interface + let app_error: Error = Error::Application { + error: serde_json::json!({"type": "test"}), + metadata: TransportMetadata { + status: http::StatusCode::BAD_REQUEST, + headers: http::HeaderMap::new(), + timing: None, + extensions: HashMap::new(), + }, + }; + + let net_error_with_metadata: Error = Error::Network { + error: MockError { + message: "test".to_string(), + }, + metadata: Some(TransportMetadata { + status: http::StatusCode::BAD_GATEWAY, + headers: http::HeaderMap::new(), + timing: None, + extensions: HashMap::new(), + }), + }; + + let net_error_without_metadata: Error = Error::Network { + error: MockError { + message: "test".to_string(), + }, + metadata: None, + }; + + let protocol_error: Error = Error::Protocol { + info: "test".to_string(), + stage: ProtocolErrorStage::SerializeRequestBody, + metadata: TransportMetadata { + status: http::StatusCode::BAD_REQUEST, + headers: http::HeaderMap::new(), + timing: None, + extensions: HashMap::new(), + }, + }; + + let server_error: Error = Error::Server { + status: http::StatusCode::INTERNAL_SERVER_ERROR, + body: bytes::Bytes::from("test"), + metadata: TransportMetadata { + status: http::StatusCode::INTERNAL_SERVER_ERROR, + headers: http::HeaderMap::new(), + timing: None, + extensions: HashMap::new(), + }, + }; + + // Test unified metadata access + assert_eq!( + app_error.transport_metadata().unwrap().status, + http::StatusCode::BAD_REQUEST + ); + assert_eq!( + net_error_with_metadata.transport_metadata().unwrap().status, + http::StatusCode::BAD_GATEWAY + ); + assert!(net_error_without_metadata.transport_metadata().is_none()); + assert_eq!( + protocol_error.transport_metadata().unwrap().status, + http::StatusCode::BAD_REQUEST + ); + assert_eq!( + server_error.transport_metadata().unwrap().status, + http::StatusCode::INTERNAL_SERVER_ERROR + ); + + // Test backward compatibility status_code method + assert_eq!( + app_error.status_code().unwrap(), + http::StatusCode::BAD_REQUEST + ); + assert_eq!( + net_error_with_metadata.status_code().unwrap(), + http::StatusCode::BAD_GATEWAY + ); + assert!(net_error_without_metadata.status_code().is_none()); + assert_eq!( + protocol_error.status_code().unwrap(), + http::StatusCode::BAD_REQUEST + ); + assert_eq!( + server_error.status_code().unwrap(), + http::StatusCode::INTERNAL_SERVER_ERROR + ); +} + +#[test] +fn test_transport_metadata_clone() { + let mut headers = http::HeaderMap::new(); + headers.insert("content-type", "application/json".parse().unwrap()); + + let timing = RequestTiming { + started_at: std::time::SystemTime::now(), + completed_at: std::time::SystemTime::now() + std::time::Duration::from_millis(100), + }; + + let metadata = TransportMetadata { + status: http::StatusCode::OK, + headers: headers.clone(), + timing: Some(timing.clone()), + extensions: HashMap::new(), + }; + + let cloned = metadata.clone(); + + assert_eq!(cloned.status, metadata.status); + assert_eq!(cloned.headers, metadata.headers); + assert_eq!(cloned.timing, metadata.timing); + // Extensions are always empty after clone (due to Any trait objects) + assert!(cloned.extensions.is_empty()); +} + +#[test] +fn test_request_timing_duration() { + let start = std::time::SystemTime::now(); + let end = start + std::time::Duration::from_millis(150); + + let timing = RequestTiming { + started_at: start, + completed_at: end, + }; + + let duration = timing.duration(); + assert_eq!(duration, std::time::Duration::from_millis(150)); + + // Test edge case where completed_at is before started_at (shouldn't happen in practice) + let backwards_timing = RequestTiming { + started_at: end, + completed_at: start, + }; + + let backwards_duration = backwards_timing.duration(); + assert_eq!(backwards_duration, std::time::Duration::ZERO); +} + +#[test] +fn test_api_result_methods() { + let metadata = TransportMetadata { + status: http::StatusCode::CREATED, + headers: http::HeaderMap::new(), + timing: None, + extensions: HashMap::new(), + }; + + let api_result = ApiResult { + value: "test_value".to_string(), + metadata: metadata.clone(), + }; + + // Test into_inner method + let inner = api_result.into_inner(); + assert_eq!(inner, "test_value"); + + // Test metadata access and Deref (need new instance since into_inner consumed the first) + let api_result2 = ApiResult { + value: "test_value2".to_string(), + metadata, + }; + + assert_eq!(api_result2.metadata().status, http::StatusCode::CREATED); + assert_eq!(&api_result2 as &str, "test_value2"); // Test Deref +} diff --git a/reflectapi/src/codegen/lib.ts b/reflectapi/src/codegen/lib.ts index 2415797c..51c77b48 100644 --- a/reflectapi/src/codegen/lib.ts +++ b/reflectapi/src/codegen/lib.ts @@ -1,9 +1,37 @@ +// The TypeScript equivalent of the core metadata struct +export interface TransportMetadata { + status: number; + headers: Record; + timing?: { + startedAt: number; // Unix timestamp (ms) + completedAt: number; // Unix timestamp (ms) + duration: number; // Milliseconds + }; + raw?: any; // For the raw fetch Response object +} + +// Note: ApiResult wrapper removed for backward compatibility +// Metadata is now attached directly to Result + export interface Client { request( path: string, body: string, headers: Record, - ): Promise<[number, string]>; + ): Promise; +} + +// The new standard return type for the underlying client trait +export interface TransportResponse { + status: number; + body: string; + headers: Record; + timing: { + startedAt: number; + completedAt: number; + duration: number; + }; + raw?: any; } export type NullToEmptyObject = T extends null ? {} : T; @@ -13,7 +41,9 @@ export type AsyncResult = Promise>>; export type FixedSizeArray = Array & { length: N }; export class Result { - constructor(private value: { ok: T } | { err: E }) { } + public metadata?: TransportMetadata; // Optional metadata attached to successful results + + constructor(private value: { ok: T } | { err: E }) {} public ok(): T | undefined { if ("ok" in this.value) { @@ -55,7 +85,9 @@ export class Result { return this.value.ok; } throw new Error( - `called \`unwrap_ok\` on an \`err\` value: ${JSON.stringify(this.value.err)}`, + `called \`unwrap_ok\` on an \`err\` value: ${JSON.stringify( + this.value.err, + )}`, ); } public unwrap_err(): E { @@ -100,8 +132,13 @@ export class Result { } } +// The error wrapper, updated but backward-compatible export class Err { - constructor(private value: { application_err: E } | { other_err: any }) { } + constructor( + private value: + | { application_err: E; metadata: TransportMetadata } + | { other_err: any; metadata: TransportMetadata }, + ) {} public err(): E | undefined { if ("application_err" in this.value) { @@ -123,11 +160,27 @@ export class Err { return "other_err" in this.value; } + // PRESERVED FOR BACKWARD COMPATIBILITY + public status(): number { + return this.value.metadata.status; + } + + // New method for accessing all metadata + public transport_metadata(): TransportMetadata { + return this.value.metadata; + } + public map(f: (r: E) => U): Err { if ("application_err" in this.value) { - return new Err({ application_err: f(this.value.application_err) }); + return new Err({ + application_err: f(this.value.application_err), + metadata: this.value.metadata, + }); } else { - return new Err({ other_err: this.value.other_err }); + return new Err({ + other_err: this.value.other_err, + metadata: this.value.metadata, + }); } } public unwrap(): E { @@ -175,48 +228,75 @@ export function __request( } return client .request(path, JSON.stringify(input), hdrs) - .then(([status, response_body]) => { - if (status >= 200 && status < 300) { + .then((transport_response) => { + const metadata: TransportMetadata = { + status: transport_response.status, + headers: transport_response.headers, + timing: transport_response.timing, + raw: transport_response.raw, + }; + + if (transport_response.status >= 200 && transport_response.status < 300) { try { - return new Result>({ ok: JSON.parse(response_body) as O }); + const value = JSON.parse(transport_response.body) as O; + const result = new Result>({ ok: value }); + result.metadata = metadata; // Attach metadata to successful result + return result; } catch (e) { return new Result>({ err: new Err({ other_err: "internal error: failure to parse response body as json on successful status code: " + - response_body, + transport_response.body, + metadata: metadata, }), }); } - } else if (status >= 500) { + } else if (transport_response.status >= 500) { return new Result>({ - err: new Err({ other_err: `[${status}] ${response_body}` }), - }) + err: new Err({ + other_err: `[${transport_response.status}] ${transport_response.body}`, + metadata: metadata, + }), + }); } else { try { + const error = JSON.parse(transport_response.body) as E; return new Result>({ - err: new Err({ application_err: JSON.parse(response_body) as E }), + err: new Err({ application_err: error, metadata: metadata }), }); } catch (e) { return new Result>({ - err: new Err({ other_err: `[${status}] ${response_body}` }), + err: new Err({ + other_err: `[${transport_response.status}] ${transport_response.body}`, + metadata: metadata, + }), }); } } }) .catch((e) => { - return new Result>({ err: new Err({ other_err: e }) }); + const metadata: TransportMetadata = { + status: 0, + headers: {}, + timing: undefined, + raw: e, + }; + return new Result>({ + err: new Err({ other_err: e, metadata: metadata }), + }); }); } class ClientInstance { - constructor(private base: string) { } + constructor(private base: string) {} public request( path: string, body: string, headers: Record, - ): Promise<[number, string]> { + ): Promise { + const startedAt = Date.now(); return (globalThis as any) .fetch(`${this.base}${path}`, { method: "POST", @@ -224,9 +304,24 @@ class ClientInstance { body: body, }) .then((response: any) => { + const completedAt = Date.now(); return response.text().then((text: string) => { - return [response.status, text]; + const responseHeaders: Record = {}; + response.headers.forEach((value: string, key: string) => { + responseHeaders[key] = value; + }); + return { + status: response.status, + body: text, + headers: responseHeaders, + timing: { + startedAt, + completedAt, + duration: completedAt - startedAt, + }, + raw: response, + }; }); }); } -} +} \ No newline at end of file diff --git a/reflectapi/src/codegen/rust-dependency-stubs/bytes.rs b/reflectapi/src/codegen/rust-dependency-stubs/bytes.rs index 2f7e25d9..2510aa16 100644 --- a/reflectapi/src/codegen/rust-dependency-stubs/bytes.rs +++ b/reflectapi/src/codegen/rust-dependency-stubs/bytes.rs @@ -1,3 +1,4 @@ +#[derive(Clone)] pub struct Bytes {} impl std::ops::Deref for Bytes { diff --git a/reflectapi/src/codegen/rust-dependency-stubs/http.rs b/reflectapi/src/codegen/rust-dependency-stubs/http.rs index 526028d3..ad956fcb 100644 --- a/reflectapi/src/codegen/rust-dependency-stubs/http.rs +++ b/reflectapi/src/codegen/rust-dependency-stubs/http.rs @@ -1,6 +1,6 @@ use core::fmt; -#[derive(Debug)] +#[derive(Debug, Clone, Copy)] pub struct StatusCode {} impl core::fmt::Display for StatusCode { @@ -10,6 +10,8 @@ impl core::fmt::Display for StatusCode { } impl StatusCode { + pub const BAD_REQUEST: StatusCode = StatusCode {}; + pub fn is_client_error(&self) -> bool { unimplemented!() } @@ -23,7 +25,7 @@ impl StatusCode { } } -#[derive(Clone)] +#[derive(Debug, Clone)] pub struct HeaderMap { _phantom: core::marker::PhantomData, } @@ -57,6 +59,7 @@ impl fmt::Display for InvalidHeaderName { impl std::error::Error for InvalidHeaderName {} +#[derive(Debug, Clone)] pub struct HeaderValue(()); impl HeaderValue { diff --git a/reflectapi/src/codegen/rust.rs b/reflectapi/src/codegen/rust.rs index 2f987f08..13527d1a 100644 --- a/reflectapi/src/codegen/rust.rs +++ b/reflectapi/src/codegen/rust.rs @@ -684,7 +684,7 @@ pub struct {{ name }};", {%- endif -%} {%- endif -%} {{description}}{{attributes}}pub async fn {{ name }}(&self, input: {{ input_type }}, headers: {{ input_headers }}) - -> Result<{{ output_type }}, reflectapi::rt::Error<{{ error_type }}, C::Error>> { + -> Result, reflectapi::rt::Error<{{ error_type }}, C::Error>> { reflectapi::rt::__request_impl(&self.client, self.base_url.join("{{ path }}").expect("checked base_url already and path is valid"), input, headers).await }"#, ext = "txt" diff --git a/reflectapi/src/codegen/typescript.rs b/reflectapi/src/codegen/typescript.rs index de2c2025..cbec09ee 100644 --- a/reflectapi/src/codegen/typescript.rs +++ b/reflectapi/src/codegen/typescript.rs @@ -726,7 +726,7 @@ fn interfaces_from_function_group( for function_name in &group.functions { let function = functions_by_name.get(function_name).unwrap(); - let (input_type, input_headers, output_type, error_type) = + let (input_type, _input_headers, output_type, error_type) = function_signature(function, schema, implemented_types); type_template.fields.push(templates::Field { name: function_name.split('.').last().unwrap().replace('-', "_"), @@ -736,8 +736,9 @@ fn interfaces_from_function_group( 4, ), type_: format!( - "(input: {}, headers: {})\n => AsyncResult<{}, {}>", - input_type, input_headers, output_type, error_type + "(input: {}, headers: {{}}) + => AsyncResult<{}, {}>", + input_type, output_type, error_type ), optional: false, }); diff --git a/reflectapi/src/rt.rs b/reflectapi/src/rt.rs index 9d636450..eff7b44e 100644 --- a/reflectapi/src/rt.rs +++ b/reflectapi/src/rt.rs @@ -1,5 +1,83 @@ pub use url::{ParseError as UrlParseError, Url}; +/// Captures request-response timing information +#[derive(Debug, Clone, PartialEq)] +pub struct RequestTiming { + pub started_at: std::time::SystemTime, + pub completed_at: std::time::SystemTime, +} + +impl RequestTiming { + pub fn duration(&self) -> std::time::Duration { + self.completed_at + .duration_since(self.started_at) + .unwrap_or(std::time::Duration::ZERO) + } +} + +/// Rich transport metadata for requests and responses +#[derive(Debug)] +pub struct TransportMetadata { + pub status: http::StatusCode, + pub headers: http::HeaderMap, + pub timing: Option, + /// Generic storage for transport-specific data (e.g., raw reqwest::Response) + pub extensions: std::collections::HashMap>, +} + +impl Clone for TransportMetadata { + fn clone(&self) -> Self { + TransportMetadata { + status: self.status, + headers: self.headers.clone(), + timing: self.timing.clone(), + // Extensions cannot be cloned as they contain Any trait objects + // Create a new empty HashMap instead + extensions: std::collections::HashMap::new(), + } + } +} + +/// Enhanced response type that includes full transport metadata +pub struct TransportResponse { + pub status: http::StatusCode, + pub body: bytes::Bytes, + pub headers: http::HeaderMap, + pub timing: Option, + pub extensions: std::collections::HashMap>, +} + +/// Wraps successful API responses with transport metadata +#[derive(Debug)] +pub struct ApiResult { + pub value: T, + pub metadata: TransportMetadata, +} + +impl ApiResult { + pub fn into_inner(self) -> T { + self.value + } + + pub fn metadata(&self) -> &TransportMetadata { + &self.metadata + } +} + +/// Provides ergonomic, backward-compatible-like access to the inner value +impl std::ops::Deref for ApiResult { + type Target = T; + fn deref(&self) -> &Self::Target { + &self.value + } +} + +impl std::ops::DerefMut for ApiResult { + fn deref_mut(&mut self) -> &mut Self::Target { + &mut self.value + } +} + pub trait Client { type Error; @@ -8,26 +86,37 @@ pub trait Client { url: Url, body: bytes::Bytes, headers: http::HeaderMap, - ) -> impl std::future::Future>; + ) -> impl std::future::Future>; } pub enum Error { - Application(AE), - Network(NE), + Application { + error: AE, + metadata: TransportMetadata, + }, + Network { + error: NE, + metadata: Option, // Metadata might not exist for network errors + }, Protocol { info: String, stage: ProtocolErrorStage, + metadata: TransportMetadata, + }, + Server { + status: http::StatusCode, + body: bytes::Bytes, + metadata: TransportMetadata, }, - Server(http::StatusCode, bytes::Bytes), } impl core::fmt::Debug for Error { fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { match self { - Error::Application(err) => write!(f, "application error: {err:?}"), - Error::Network(err) => write!(f, "network error: {err:?}"), - Error::Protocol { info, stage } => write!(f, "protocol error: {info} at {stage:?}"), - Error::Server(status, body) => write!( + Error::Application { error, .. } => write!(f, "application error: {error:?}"), + Error::Network { error, .. } => write!(f, "network error: {error:?}"), + Error::Protocol { info, stage, .. } => write!(f, "protocol error: {info} at {stage:?}"), + Error::Server { status, body, .. } => write!( f, "server error: {status} with body: {}", String::from_utf8_lossy(body) @@ -39,10 +128,10 @@ impl core::fmt::Debug for Error core::fmt::Display for Error { fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { match self { - Error::Application(err) => write!(f, "application error: {err}"), - Error::Network(err) => write!(f, "network error: {err}"), - Error::Protocol { info, stage } => write!(f, "protocol error: {info} at {stage}"), - Error::Server(status, body) => write!( + Error::Application { error, .. } => write!(f, "application error: {error}"), + Error::Network { error, .. } => write!(f, "network error: {error}"), + Error::Protocol { info, stage, .. } => write!(f, "protocol error: {info} at {stage}"), + Error::Server { status, body, .. } => write!( f, "server error: {status} with body: {}", String::from_utf8_lossy(body) @@ -56,14 +145,31 @@ impl std::erro { fn source(&self) -> Option<&(dyn std::error::Error + 'static)> { match self { - Error::Application(err) => Some(err), - Error::Network(err) => Some(err), + Error::Application { error, .. } => Some(error), + Error::Network { error, .. } => Some(error), Error::Protocol { .. } => None, - Error::Server(_, _) => None, + Error::Server { .. } => None, } } } +impl Error { + /// Provides unified access to metadata across all error types + pub fn transport_metadata(&self) -> Option<&TransportMetadata> { + match self { + Error::Application { metadata, .. } => Some(metadata), + Error::Network { metadata, .. } => metadata.as_ref(), + Error::Protocol { metadata, .. } => Some(metadata), + Error::Server { metadata, .. } => Some(metadata), + } + } + + /// Access HTTP status code (backward compatibility) + pub fn status_code(&self) -> Option { + self.transport_metadata().map(|m| m.status) + } +} + pub enum ProtocolErrorStage { SerializeRequestBody, SerializeRequestHeaders, @@ -120,7 +226,7 @@ pub async fn __request_impl( url: Url, body: I, headers: H, -) -> Result> +) -> Result, Error> where C: Client, I: serde::Serialize, @@ -128,18 +234,34 @@ where O: serde::de::DeserializeOwned, E: serde::de::DeserializeOwned, { - let body = serde_json::to_vec(&body).map_err(|e| Error::Protocol { + // Serialize request body + let body_bytes = serde_json::to_vec(&body).map_err(|e| Error::Protocol { info: e.to_string(), stage: ProtocolErrorStage::SerializeRequestBody, + // We don't have metadata yet for serialization errors + metadata: TransportMetadata { + status: http::StatusCode::BAD_REQUEST, // Default for protocol errors + headers: http::HeaderMap::new(), + timing: None, + extensions: std::collections::HashMap::new(), + }, })?; - let body = bytes::Bytes::from(body); - let headers = serde_json::to_value(&headers).map_err(|e| Error::Protocol { + let body_bytes = bytes::Bytes::from(body_bytes); + + // Serialize request headers + let headers_value = serde_json::to_value(&headers).map_err(|e| Error::Protocol { info: e.to_string(), stage: ProtocolErrorStage::SerializeRequestHeaders, + metadata: TransportMetadata { + status: http::StatusCode::BAD_REQUEST, + headers: http::HeaderMap::new(), + timing: None, + extensions: std::collections::HashMap::new(), + }, })?; let mut header_map = http::HeaderMap::new(); - match headers { + match headers_value { serde_json::Value::Object(headers) => { for (k, v) in headers.into_iter() { let v_str = match v { @@ -157,29 +279,66 @@ where return Err(Error::Protocol { info: "Headers must be an object".to_string(), stage: ProtocolErrorStage::SerializeRequestHeaders, + metadata: TransportMetadata { + status: http::StatusCode::BAD_REQUEST, + headers: http::HeaderMap::new(), + timing: None, + extensions: std::collections::HashMap::new(), + }, }); } } - let (status, body) = client - .request(url, body, header_map) + // Make the transport request + let transport_response = client + .request(url, body_bytes, header_map) .await - .map_err(Error::Network)?; - - if status.is_success() { - let output = serde_json::from_slice(&body).map_err(|e| Error::Protocol { - info: e.to_string(), - stage: ProtocolErrorStage::DeserializeResponseBody(body), + .map_err(|e| Error::Network { + error: e, + metadata: None, // Network errors may not have response metadata })?; - return Ok(output); + + // Create transport metadata from response + let metadata = TransportMetadata { + status: transport_response.status, + headers: transport_response.headers.clone(), + timing: transport_response.timing, + extensions: transport_response.extensions, + }; + + // Handle successful responses + if transport_response.status.is_success() { + let output = + serde_json::from_slice(&transport_response.body).map_err(|e| Error::Protocol { + info: e.to_string(), + stage: ProtocolErrorStage::DeserializeResponseBody(transport_response.body.clone()), + metadata: metadata.clone(), + })?; + + return Ok(ApiResult { + value: output, + metadata, + }); } - match serde_json::from_slice::(&body) { - Ok(error) if !status.is_server_error() => Err(Error::Application(error)), - Err(e) if status.is_client_error() => Err(Error::Protocol { + + // Handle error responses based on status code + match serde_json::from_slice::(&transport_response.body) { + Ok(error) if !transport_response.status.is_server_error() => { + Err(Error::Application { error, metadata }) + } + Err(e) if transport_response.status.is_client_error() => Err(Error::Protocol { info: e.to_string(), - stage: ProtocolErrorStage::DeserializeResponseError(status, body), + stage: ProtocolErrorStage::DeserializeResponseError( + transport_response.status, + transport_response.body, + ), + metadata, + }), + _ => Err(Error::Server { + status: transport_response.status, + body: transport_response.body, + metadata, }), - _ => Err(Error::Server(status, body)), } } @@ -189,14 +348,30 @@ impl Client for reqwest::Client { async fn request( &self, - path: Url, + url: Url, body: bytes::Bytes, headers: http::HeaderMap, - ) -> Result<(http::StatusCode, bytes::Bytes), Self::Error> { - let response = self.post(path).headers(headers).body(body).send().await?; + ) -> Result { + let started_at = std::time::SystemTime::now(); + + let response = self.post(url).headers(headers).body(body).send().await?; + + let completed_at = std::time::SystemTime::now(); let status = response.status(); + let response_headers = response.headers().clone(); + let body = response.bytes().await?; - Ok((status, body)) + + Ok(TransportResponse { + status, + body, + headers: response_headers, + timing: Some(RequestTiming { + started_at, + completed_at, + }), + extensions: std::collections::HashMap::new(), + }) } } @@ -206,13 +381,29 @@ impl Client for reqwest_middleware::ClientWithMiddleware { async fn request( &self, - path: Url, + url: Url, body: bytes::Bytes, headers: http::HeaderMap, - ) -> Result<(http::StatusCode, bytes::Bytes), Self::Error> { - let response = self.post(path).headers(headers).body(body).send().await?; + ) -> Result { + let started_at = std::time::SystemTime::now(); + + let response = self.post(url).headers(headers).body(body).send().await?; + + let completed_at = std::time::SystemTime::now(); let status = response.status(); + let response_headers = response.headers().clone(); + let body = response.bytes().await?; - Ok((status, body)) + + Ok(TransportResponse { + status, + body, + headers: response_headers, + timing: Some(RequestTiming { + started_at, + completed_at, + }), + extensions: std::collections::HashMap::new(), + }) } }