Skip to content

Commit

Permalink
Merge branch 'fix-go-request-samples' of github.com:seamapi/blueprint…
Browse files Browse the repository at this point in the history
… into fix-go-response-samples
  • Loading branch information
andrii-balitskyi committed Oct 3, 2024
2 parents d37b42d + 40f0f25 commit f0513a9
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 25 deletions.
2 changes: 1 addition & 1 deletion src/lib/code-sample/php.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 `<?php\n$seam${parts.map((p) => snakeCase(p)).join('->')}(${requestParams})`
Expand Down
48 changes: 24 additions & 24 deletions test/snapshots/blueprint.test.ts.md
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ Generated by [AVA](https://avajs.dev).
},
php: {
request: `<?php␊
$seam->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',
Expand Down Expand Up @@ -251,7 +251,7 @@ Generated by [AVA](https://avajs.dev).
},
php: {
request: `<?php␊
$seam->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',
Expand Down Expand Up @@ -353,7 +353,7 @@ Generated by [AVA](https://avajs.dev).
},
php: {
request: `<?php␊
$seam->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',
Expand Down Expand Up @@ -456,7 +456,7 @@ Generated by [AVA](https://avajs.dev).
},
php: {
request: `<?php␊
$seam->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',
Expand Down Expand Up @@ -559,7 +559,7 @@ Generated by [AVA](https://avajs.dev).
},
php: {
request: `<?php␊
$seam->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',
Expand Down Expand Up @@ -661,7 +661,7 @@ Generated by [AVA](https://avajs.dev).
},
php: {
request: `<?php␊
$seam->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',
Expand Down Expand Up @@ -763,7 +763,7 @@ Generated by [AVA](https://avajs.dev).
},
php: {
request: `<?php␊
$seam->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',
Expand Down Expand Up @@ -866,7 +866,7 @@ Generated by [AVA](https://avajs.dev).
},
php: {
request: `<?php␊
$seam->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',
Expand Down Expand Up @@ -969,7 +969,7 @@ Generated by [AVA](https://avajs.dev).
},
php: {
request: `<?php␊
$seam->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',
Expand Down Expand Up @@ -1071,7 +1071,7 @@ Generated by [AVA](https://avajs.dev).
},
php: {
request: `<?php␊
$seam->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',
Expand Down Expand Up @@ -1173,7 +1173,7 @@ Generated by [AVA](https://avajs.dev).
},
php: {
request: `<?php␊
$seam->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',
Expand Down Expand Up @@ -1276,7 +1276,7 @@ Generated by [AVA](https://avajs.dev).
},
php: {
request: `<?php␊
$seam->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',
Expand Down Expand Up @@ -2048,7 +2048,7 @@ Generated by [AVA](https://avajs.dev).
php: {
request: `// php␊
<?php␊
$seam->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"]]`,
Expand Down Expand Up @@ -2162,7 +2162,7 @@ Generated by [AVA](https://avajs.dev).
php: {
request: `// php␊
<?php␊
$seam->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"]]`,
Expand Down Expand Up @@ -2276,7 +2276,7 @@ Generated by [AVA](https://avajs.dev).
php: {
request: `// php␊
<?php␊
$seam->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"]]]`,
Expand Down Expand Up @@ -2391,7 +2391,7 @@ Generated by [AVA](https://avajs.dev).
php: {
request: `// php␊
<?php␊
$seam->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"]]]`,
Expand Down Expand Up @@ -2506,7 +2506,7 @@ Generated by [AVA](https://avajs.dev).
php: {
request: `// php␊
<?php␊
$seam->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"]]`,
Expand Down Expand Up @@ -2620,7 +2620,7 @@ Generated by [AVA](https://avajs.dev).
php: {
request: `// php␊
<?php␊
$seam->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"]]`,
Expand Down Expand Up @@ -2734,7 +2734,7 @@ Generated by [AVA](https://avajs.dev).
php: {
request: `// php␊
<?php␊
$seam->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"]]]`,
Expand Down Expand Up @@ -2849,7 +2849,7 @@ Generated by [AVA](https://avajs.dev).
php: {
request: `// php␊
<?php␊
$seam->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"]]]`,
Expand Down Expand Up @@ -2964,7 +2964,7 @@ Generated by [AVA](https://avajs.dev).
php: {
request: `// php␊
<?php␊
$seam->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"]]`,
Expand Down Expand Up @@ -3078,7 +3078,7 @@ Generated by [AVA](https://avajs.dev).
php: {
request: `// php␊
<?php␊
$seam->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"]]`,
Expand Down Expand Up @@ -3192,7 +3192,7 @@ Generated by [AVA](https://avajs.dev).
php: {
request: `// php␊
<?php␊
$seam->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"]]]`,
Expand Down Expand Up @@ -3307,7 +3307,7 @@ Generated by [AVA](https://avajs.dev).
php: {
request: `// php␊
<?php␊
$seam->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"]]]`,
Expand Down
Binary file modified test/snapshots/blueprint.test.ts.snap
Binary file not shown.

0 comments on commit f0513a9

Please sign in to comment.