Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
services:
laya-serve:
build:
context: https://github.com/NandhaKishorM/laya.git#c73908d96ff73c0062c340a11bf7c54ec7d8bc4d
context: https://github.com/NandhaKishorM/laya.git#ffc142012af63d015fa19f05f29f9c5ff329a2cc
Comment thread
marcreichel marked this conversation as resolved.
command: ["laya-serve"]
ports:
- "127.0.0.1:${LAYA_PORT:-8000}:8000"
Expand Down
6 changes: 3 additions & 3 deletions tests/OpenApiContractTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Loading