diff --git a/src/lib/code-sample/php.ts b/src/lib/code-sample/php.ts index be7de60..25d6bc2 100644 --- a/src/lib/code-sample/php.ts +++ b/src/lib/code-sample/php.ts @@ -10,7 +10,7 @@ export const createPhpRequest = ( ): string => { const parts = request.path.split('/') const requestParams = Object.entries(request.parameters) - .map(([key, value]) => `${key}:${JSON.stringify(value)}`) + .map(([key, value]) => `${key}: ${formatPhpValue(value)}`) .join(',') return ` snakeCase(p)).join('->')}(${requestParams})` diff --git a/test/snapshots/blueprint.test.ts.md b/test/snapshots/blueprint.test.ts.md index 9425855..0595c3c 100644 --- a/test/snapshots/blueprint.test.ts.md +++ b/test/snapshots/blueprint.test.ts.md @@ -149,7 +149,7 @@ Generated by [AVA](https://avajs.dev). }, php: { request: `foos->get(foo_id:"8d7e0b3a-b889-49a7-9164-4b71a0506a33")`, + $seam->foos->get(foo_id: "8d7e0b3a-b889-49a7-9164-4b71a0506a33")`, request_syntax: 'php', response: '["foo_id" => "8d7e0b3a-b889-49a7-9164-4b71a0506a33","name" => "Best foo","nullable_prop" => null,"number_prop" => 10,"object_prop" => ["foo" => "bar", "nested_object_prop" => ["foo" => "bar"]],"array_prop" => ["foo", "bar"]]', response_syntax: 'php', @@ -251,7 +251,7 @@ Generated by [AVA](https://avajs.dev). }, php: { request: `foos->get(foo_id:"8d7e0b3a-b889-49a7-9164-4b71a0506a33")`, + $seam->foos->get(foo_id: "8d7e0b3a-b889-49a7-9164-4b71a0506a33")`, request_syntax: 'php', response: '["foo_id" => "8d7e0b3a-b889-49a7-9164-4b71a0506a33","name" => "Best foo","nullable_prop" => null,"number_prop" => 10,"object_prop" => ["foo" => "bar", "nested_object_prop" => ["foo" => "bar"]],"array_prop" => ["foo", "bar"]]', response_syntax: 'php', @@ -353,7 +353,7 @@ Generated by [AVA](https://avajs.dev). }, php: { request: `foos->list(object_prop:{"foo":"bar"})`, + $seam->foos->list(object_prop: ["foo" => "bar"])`, request_syntax: 'php', response: '[["foo_id" => "8d7e0b3a-b889-49a7-9164-4b71a0506a33","name" => "Best foo","nullable_prop" => null,"number_prop" => 10,"object_prop" => ["foo" => "bar"],"array_prop" => ["foo", "bar"]]]', response_syntax: 'php', @@ -456,7 +456,7 @@ Generated by [AVA](https://avajs.dev). }, php: { request: `foos->list(object_prop:{"foo":"bar"})`, + $seam->foos->list(object_prop: ["foo" => "bar"])`, request_syntax: 'php', response: '[["foo_id" => "8d7e0b3a-b889-49a7-9164-4b71a0506a33","name" => "Best foo","nullable_prop" => null,"number_prop" => 10,"object_prop" => ["foo" => "bar"],"array_prop" => ["foo", "bar"]]]', response_syntax: 'php', @@ -559,7 +559,7 @@ Generated by [AVA](https://avajs.dev). }, php: { request: `foos->get(foo_id:"8d7e0b3a-b889-49a7-9164-4b71a0506a33")`, + $seam->foos->get(foo_id: "8d7e0b3a-b889-49a7-9164-4b71a0506a33")`, request_syntax: 'php', response: '["foo_id" => "8d7e0b3a-b889-49a7-9164-4b71a0506a33","name" => "Best foo","nullable_prop" => null,"number_prop" => 10,"object_prop" => ["foo" => "bar", "nested_object_prop" => ["foo" => "bar"]],"array_prop" => ["foo", "bar"]]', response_syntax: 'php', @@ -661,7 +661,7 @@ Generated by [AVA](https://avajs.dev). }, php: { request: `foos->get(foo_id:"8d7e0b3a-b889-49a7-9164-4b71a0506a33")`, + $seam->foos->get(foo_id: "8d7e0b3a-b889-49a7-9164-4b71a0506a33")`, request_syntax: 'php', response: '["foo_id" => "8d7e0b3a-b889-49a7-9164-4b71a0506a33","name" => "Best foo","nullable_prop" => null,"number_prop" => 10,"object_prop" => ["foo" => "bar", "nested_object_prop" => ["foo" => "bar"]],"array_prop" => ["foo", "bar"]]', response_syntax: 'php', @@ -763,7 +763,7 @@ Generated by [AVA](https://avajs.dev). }, php: { request: `foos->list(object_prop:{"foo":"bar"})`, + $seam->foos->list(object_prop: ["foo" => "bar"])`, request_syntax: 'php', response: '[["foo_id" => "8d7e0b3a-b889-49a7-9164-4b71a0506a33","name" => "Best foo","nullable_prop" => null,"number_prop" => 10,"object_prop" => ["foo" => "bar"],"array_prop" => ["foo", "bar"]]]', response_syntax: 'php', @@ -866,7 +866,7 @@ Generated by [AVA](https://avajs.dev). }, php: { request: `foos->list(object_prop:{"foo":"bar"})`, + $seam->foos->list(object_prop: ["foo" => "bar"])`, request_syntax: 'php', response: '[["foo_id" => "8d7e0b3a-b889-49a7-9164-4b71a0506a33","name" => "Best foo","nullable_prop" => null,"number_prop" => 10,"object_prop" => ["foo" => "bar"],"array_prop" => ["foo", "bar"]]]', response_syntax: 'php', @@ -969,7 +969,7 @@ Generated by [AVA](https://avajs.dev). }, php: { request: `foos->get(foo_id:"8d7e0b3a-b889-49a7-9164-4b71a0506a33")`, + $seam->foos->get(foo_id: "8d7e0b3a-b889-49a7-9164-4b71a0506a33")`, request_syntax: 'php', response: '["foo_id" => "8d7e0b3a-b889-49a7-9164-4b71a0506a33","name" => "Best foo","nullable_prop" => null,"number_prop" => 10,"object_prop" => ["foo" => "bar", "nested_object_prop" => ["foo" => "bar"]],"array_prop" => ["foo", "bar"]]', response_syntax: 'php', @@ -1071,7 +1071,7 @@ Generated by [AVA](https://avajs.dev). }, php: { request: `foos->get(foo_id:"8d7e0b3a-b889-49a7-9164-4b71a0506a33")`, + $seam->foos->get(foo_id: "8d7e0b3a-b889-49a7-9164-4b71a0506a33")`, request_syntax: 'php', response: '["foo_id" => "8d7e0b3a-b889-49a7-9164-4b71a0506a33","name" => "Best foo","nullable_prop" => null,"number_prop" => 10,"object_prop" => ["foo" => "bar", "nested_object_prop" => ["foo" => "bar"]],"array_prop" => ["foo", "bar"]]', response_syntax: 'php', @@ -1173,7 +1173,7 @@ Generated by [AVA](https://avajs.dev). }, php: { request: `foos->list(object_prop:{"foo":"bar"})`, + $seam->foos->list(object_prop: ["foo" => "bar"])`, request_syntax: 'php', response: '[["foo_id" => "8d7e0b3a-b889-49a7-9164-4b71a0506a33","name" => "Best foo","nullable_prop" => null,"number_prop" => 10,"object_prop" => ["foo" => "bar"],"array_prop" => ["foo", "bar"]]]', response_syntax: 'php', @@ -1276,7 +1276,7 @@ Generated by [AVA](https://avajs.dev). }, php: { request: `foos->list(object_prop:{"foo":"bar"})`, + $seam->foos->list(object_prop: ["foo" => "bar"])`, request_syntax: 'php', response: '[["foo_id" => "8d7e0b3a-b889-49a7-9164-4b71a0506a33","name" => "Best foo","nullable_prop" => null,"number_prop" => 10,"object_prop" => ["foo" => "bar"],"array_prop" => ["foo", "bar"]]]', response_syntax: 'php', @@ -2048,7 +2048,7 @@ Generated by [AVA](https://avajs.dev). php: { request: `// php␊ foos->get(foo_id:"8d7e0b3a-b889-49a7-9164-4b71a0506a33")`, + $seam->foos->get(foo_id: "8d7e0b3a-b889-49a7-9164-4b71a0506a33")`, request_syntax: 'php', response: `// php␊ ["foo_id" => "8d7e0b3a-b889-49a7-9164-4b71a0506a33","name" => "Best foo","nullable_prop" => null,"number_prop" => 10,"object_prop" => ["foo" => "bar", "nested_object_prop" => ["foo" => "bar"]],"array_prop" => ["foo", "bar"]]`, @@ -2162,7 +2162,7 @@ Generated by [AVA](https://avajs.dev). php: { request: `// php␊ foos->get(foo_id:"8d7e0b3a-b889-49a7-9164-4b71a0506a33")`, + $seam->foos->get(foo_id: "8d7e0b3a-b889-49a7-9164-4b71a0506a33")`, request_syntax: 'php', response: `// php␊ ["foo_id" => "8d7e0b3a-b889-49a7-9164-4b71a0506a33","name" => "Best foo","nullable_prop" => null,"number_prop" => 10,"object_prop" => ["foo" => "bar", "nested_object_prop" => ["foo" => "bar"]],"array_prop" => ["foo", "bar"]]`, @@ -2276,7 +2276,7 @@ Generated by [AVA](https://avajs.dev). php: { request: `// php␊ foos->list(object_prop:{"foo":"bar"})`, + $seam->foos->list(object_prop: ["foo" => "bar"])`, request_syntax: 'php', response: `// php␊ [["foo_id" => "8d7e0b3a-b889-49a7-9164-4b71a0506a33","name" => "Best foo","nullable_prop" => null,"number_prop" => 10,"object_prop" => ["foo" => "bar"],"array_prop" => ["foo", "bar"]]]`, @@ -2391,7 +2391,7 @@ Generated by [AVA](https://avajs.dev). php: { request: `// php␊ foos->list(object_prop:{"foo":"bar"})`, + $seam->foos->list(object_prop: ["foo" => "bar"])`, request_syntax: 'php', response: `// php␊ [["foo_id" => "8d7e0b3a-b889-49a7-9164-4b71a0506a33","name" => "Best foo","nullable_prop" => null,"number_prop" => 10,"object_prop" => ["foo" => "bar"],"array_prop" => ["foo", "bar"]]]`, @@ -2506,7 +2506,7 @@ Generated by [AVA](https://avajs.dev). php: { request: `// php␊ foos->get(foo_id:"8d7e0b3a-b889-49a7-9164-4b71a0506a33")`, + $seam->foos->get(foo_id: "8d7e0b3a-b889-49a7-9164-4b71a0506a33")`, request_syntax: 'php', response: `// php␊ ["foo_id" => "8d7e0b3a-b889-49a7-9164-4b71a0506a33","name" => "Best foo","nullable_prop" => null,"number_prop" => 10,"object_prop" => ["foo" => "bar", "nested_object_prop" => ["foo" => "bar"]],"array_prop" => ["foo", "bar"]]`, @@ -2620,7 +2620,7 @@ Generated by [AVA](https://avajs.dev). php: { request: `// php␊ foos->get(foo_id:"8d7e0b3a-b889-49a7-9164-4b71a0506a33")`, + $seam->foos->get(foo_id: "8d7e0b3a-b889-49a7-9164-4b71a0506a33")`, request_syntax: 'php', response: `// php␊ ["foo_id" => "8d7e0b3a-b889-49a7-9164-4b71a0506a33","name" => "Best foo","nullable_prop" => null,"number_prop" => 10,"object_prop" => ["foo" => "bar", "nested_object_prop" => ["foo" => "bar"]],"array_prop" => ["foo", "bar"]]`, @@ -2734,7 +2734,7 @@ Generated by [AVA](https://avajs.dev). php: { request: `// php␊ foos->list(object_prop:{"foo":"bar"})`, + $seam->foos->list(object_prop: ["foo" => "bar"])`, request_syntax: 'php', response: `// php␊ [["foo_id" => "8d7e0b3a-b889-49a7-9164-4b71a0506a33","name" => "Best foo","nullable_prop" => null,"number_prop" => 10,"object_prop" => ["foo" => "bar"],"array_prop" => ["foo", "bar"]]]`, @@ -2849,7 +2849,7 @@ Generated by [AVA](https://avajs.dev). php: { request: `// php␊ foos->list(object_prop:{"foo":"bar"})`, + $seam->foos->list(object_prop: ["foo" => "bar"])`, request_syntax: 'php', response: `// php␊ [["foo_id" => "8d7e0b3a-b889-49a7-9164-4b71a0506a33","name" => "Best foo","nullable_prop" => null,"number_prop" => 10,"object_prop" => ["foo" => "bar"],"array_prop" => ["foo", "bar"]]]`, @@ -2964,7 +2964,7 @@ Generated by [AVA](https://avajs.dev). php: { request: `// php␊ foos->get(foo_id:"8d7e0b3a-b889-49a7-9164-4b71a0506a33")`, + $seam->foos->get(foo_id: "8d7e0b3a-b889-49a7-9164-4b71a0506a33")`, request_syntax: 'php', response: `// php␊ ["foo_id" => "8d7e0b3a-b889-49a7-9164-4b71a0506a33","name" => "Best foo","nullable_prop" => null,"number_prop" => 10,"object_prop" => ["foo" => "bar", "nested_object_prop" => ["foo" => "bar"]],"array_prop" => ["foo", "bar"]]`, @@ -3078,7 +3078,7 @@ Generated by [AVA](https://avajs.dev). php: { request: `// php␊ foos->get(foo_id:"8d7e0b3a-b889-49a7-9164-4b71a0506a33")`, + $seam->foos->get(foo_id: "8d7e0b3a-b889-49a7-9164-4b71a0506a33")`, request_syntax: 'php', response: `// php␊ ["foo_id" => "8d7e0b3a-b889-49a7-9164-4b71a0506a33","name" => "Best foo","nullable_prop" => null,"number_prop" => 10,"object_prop" => ["foo" => "bar", "nested_object_prop" => ["foo" => "bar"]],"array_prop" => ["foo", "bar"]]`, @@ -3192,7 +3192,7 @@ Generated by [AVA](https://avajs.dev). php: { request: `// php␊ foos->list(object_prop:{"foo":"bar"})`, + $seam->foos->list(object_prop: ["foo" => "bar"])`, request_syntax: 'php', response: `// php␊ [["foo_id" => "8d7e0b3a-b889-49a7-9164-4b71a0506a33","name" => "Best foo","nullable_prop" => null,"number_prop" => 10,"object_prop" => ["foo" => "bar"],"array_prop" => ["foo", "bar"]]]`, @@ -3307,7 +3307,7 @@ Generated by [AVA](https://avajs.dev). php: { request: `// php␊ foos->list(object_prop:{"foo":"bar"})`, + $seam->foos->list(object_prop: ["foo" => "bar"])`, request_syntax: 'php', response: `// php␊ [["foo_id" => "8d7e0b3a-b889-49a7-9164-4b71a0506a33","name" => "Best foo","nullable_prop" => null,"number_prop" => 10,"object_prop" => ["foo" => "bar"],"array_prop" => ["foo", "bar"]]]`, diff --git a/test/snapshots/blueprint.test.ts.snap b/test/snapshots/blueprint.test.ts.snap index e767e15..ef2e63e 100644 Binary files a/test/snapshots/blueprint.test.ts.snap and b/test/snapshots/blueprint.test.ts.snap differ