From 3d23e0a53909040ae0ad06ffa54f6532b0fc7c76 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 16 Feb 2026 16:20:22 +0000 Subject: [PATCH 1/3] Initial plan From edf29dbc11e005d4821b7cb2484d5427ca9d0f42 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 16 Feb 2026 16:33:33 +0000 Subject: [PATCH 2/3] Fix Hydra example type - use @type instead of type Co-authored-by: soyuka <1321971+soyuka@users.noreply.github.com> --- src/Hydra/JsonSchema/SchemaFactory.php | 2 +- .../JsonSchema/JsonLdJsonSchemaTest.php | 20 +++++++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/src/Hydra/JsonSchema/SchemaFactory.php b/src/Hydra/JsonSchema/SchemaFactory.php index b966632f848..08f7816db12 100644 --- a/src/Hydra/JsonSchema/SchemaFactory.php +++ b/src/Hydra/JsonSchema/SchemaFactory.php @@ -229,7 +229,7 @@ public function buildSchema(string $className, string $format = 'jsonld', string ], 'example' => [ '@id' => 'string', - 'type' => 'string', + '@type' => 'string', $hydraPrefix.'first' => 'string', $hydraPrefix.'last' => 'string', $hydraPrefix.'previous' => 'string', diff --git a/tests/Functional/JsonSchema/JsonLdJsonSchemaTest.php b/tests/Functional/JsonSchema/JsonLdJsonSchemaTest.php index b1380c4ec7d..488441c3d16 100644 --- a/tests/Functional/JsonSchema/JsonLdJsonSchemaTest.php +++ b/tests/Functional/JsonSchema/JsonLdJsonSchemaTest.php @@ -163,6 +163,26 @@ public function testSchemaJsonLdCollection(): void $this->assertEquals(['$ref' => '#/definitions/BagOfTests.jsonld-read'], $schema['allOf'][1]['properties']['hydra:member']['items']); } + public function testHydraCollectionBaseSchemaExample(): void + { + $schema = $this->schemaFactory->buildSchema(BagOfTests::class, 'jsonld', forceCollection: true); + + $this->assertArrayHasKey('HydraCollectionBaseSchema', $schema['definitions']); + $hydraCollectionSchema = $schema['definitions']['HydraCollectionBaseSchema']; + + // Navigate to the hydra:view property example + $this->assertArrayHasKey('allOf', $hydraCollectionSchema); + $viewProperty = $hydraCollectionSchema['allOf'][1]['properties']['hydra:view'] ?? null; + $this->assertNotNull($viewProperty, 'hydra:view property should exist'); + + // Check that the example uses @type instead of type + $this->assertArrayHasKey('example', $viewProperty); + $example = $viewProperty['example']; + $this->assertArrayHasKey('@type', $example, 'Example should use @type with @ prefix'); + $this->assertArrayNotHasKey('type', $example, 'Example should not use type without @ prefix'); + $this->assertArrayHasKey('@id', $example, 'Example should have @id'); + } + public function testArraySchemaWithMultipleUnionTypes(): void { $schema = $this->schemaFactory->buildSchema(Nest::class, 'jsonld', 'output'); From b7267fbdb9fbbc1db8256f1f66217d420c66088a Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 16 Feb 2026 16:34:17 +0000 Subject: [PATCH 3/3] Add Redocly OpenAPI linter to CI workflow Co-authored-by: soyuka <1321971+soyuka@users.noreply.github.com> --- .github/workflows/ci.yml | 51 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f212c877699..fd7686fc5ce 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -178,6 +178,57 @@ jobs: run: | ./vendor/bin/phpstan analyse --no-interaction --no-progress --ansi + redocly-lint: + name: Lint OpenAPI with Redocly + runs-on: ubuntu-latest + timeout-minutes: 20 + strategy: + matrix: + php: + - '8.4' + fail-fast: false + steps: + - name: Checkout + uses: actions/checkout@v6 + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + extensions: intl, bcmath, curl, openssl, mbstring + ini-values: memory_limit=-1 + tools: composer + coverage: none + - name: Get composer cache directory + id: composercache + run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT + - name: Cache dependencies + uses: actions/cache@v5 + with: + path: ${{ steps.composercache.outputs.dir }} + key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }} + restore-keys: ${{ runner.os }}-composer- + - name: Update project dependencies + run: | + composer global require soyuka/pmu + composer global config allow-plugins.soyuka/pmu true --no-interaction + composer global link . + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '20' + - name: Install Redocly CLI + run: npm install -g @redocly/cli@latest + - name: Clear test app cache + run: | + rm -Rf tests/Fixtures/app/var/cache/* + tests/Fixtures/app/console cache:warmup + - name: Generate OpenAPI spec + run: | + mkdir -p /tmp/openapi + tests/Fixtures/app/console api:openapi:export --output=/tmp/openapi/openapi.json --no-ansi + - name: Lint OpenAPI spec with Redocly + run: redocly lint /tmp/openapi/openapi.json + phpunit: name: PHPUnit (PHP ${{ matrix.php }}) runs-on: ubuntu-latest