diff --git a/README.md b/README.md index 58c355c..df9154f 100644 --- a/README.md +++ b/README.md @@ -38,7 +38,7 @@ composer require marcreichel/laya-php PHP 8.4+. You also need a PSR-18 HTTP client (Guzzle, Symfony HttpClient, …). The SDK finds the installed one automatically. -To run `laya-serve` locally, use the `compose.yaml` in this repository (it pins upstream Laya to v0.4.6, commit [`c73908d`](https://github.com/NandhaKishorM/laya/commit/c73908d96ff73c0062c340a11bf7c54ec7d8bc4d)) or follow [Laya's Docker guide](https://github.com/NandhaKishorM/laya/blob/main/docs/docker.md): +To run `laya-serve` locally, use the `compose.yaml` in this repository (it pins upstream Laya to v0.4.12, commit [`ffc1420`](https://github.com/NandhaKishorM/laya/commit/ffc142012af63d015fa19f05f29f9c5ff329a2cc)) or follow [Laya's Docker guide](https://github.com/NandhaKishorM/laya/blob/main/docs/docker.md): ```bash docker compose up -d --wait # http://localhost:8000 diff --git a/compose.yaml b/compose.yaml index d6cf609..2f22aef 100644 --- a/compose.yaml +++ b/compose.yaml @@ -9,7 +9,7 @@ services: laya-serve: build: - context: https://github.com/NandhaKishorM/laya.git#c73908d96ff73c0062c340a11bf7c54ec7d8bc4d + context: https://github.com/NandhaKishorM/laya.git#ffc142012af63d015fa19f05f29f9c5ff329a2cc command: ["laya-serve"] ports: - "127.0.0.1:${LAYA_PORT:-8000}:8000" diff --git a/tests/OpenApiContractTest.php b/tests/OpenApiContractTest.php index 560e495..d479fd1 100644 --- a/tests/OpenApiContractTest.php +++ b/tests/OpenApiContractTest.php @@ -155,13 +155,13 @@ function expectMatchesSchema(array $spec, mixed $schema, array $value, string $w } })->group('contract'); -it('reads every answer type the spec can send, from responses that match it', function () { +it('reads every answer type it can ask for, from responses that match it', function () { $schema = $this->operation['responses']['200']['content']['application/json']['schema'] ?? null; $response = openApiBranches($this->spec, $schema)[0] ?? []; $answers = openApiByType($this->spec, openApiBranches($this->spec, $response['properties']['answers'] ?? null)[0] ?? []); - // Answer::fromArray() throws on any other type, so a new one in the spec needs support here first. - expect(array_keys($answers))->toEqualCanonicalizing(['choice', 'score', 'noul']); + // An answer has its question's type, so other types (box, for images) only come back for questions this client can't send. + expect(array_keys($answers))->toContain('choice', 'score', 'noul'); expectMatchesSchema($this->spec, $schema, TYPESAFE_RESPONSE, 'TYPESAFE_RESPONSE'); foreach (TYPESAFE_RESPONSE['answers'] as $id => $answer) {