diff --git a/components/catalogs/back/src/Infrastructure/Symfony/Resources/schemas/product-0.0.1.json b/components/catalogs/back/src/Infrastructure/Symfony/Resources/meta-schemas/product-0.0.1.json similarity index 81% rename from components/catalogs/back/src/Infrastructure/Symfony/Resources/schemas/product-0.0.1.json rename to components/catalogs/back/src/Infrastructure/Symfony/Resources/meta-schemas/product-0.0.1.json index b17b6b5bc22e..80f02d076b8d 100644 --- a/components/catalogs/back/src/Infrastructure/Symfony/Resources/schemas/product-0.0.1.json +++ b/components/catalogs/back/src/Infrastructure/Symfony/Resources/meta-schemas/product-0.0.1.json @@ -18,11 +18,9 @@ }, "$defs": { "$id": { - "$ref": "#/$defs/uriReferenceString", "$comment": "Non-empty fragments not allowed.", "pattern": "^[^#]*#?$" }, - "$ref": { "$ref": "#/$defs/uriReferenceString" }, "$schema": { "$ref": "#/$defs/uriString" }, "$comment": { "type": "string" @@ -47,18 +45,14 @@ "properties": { "title": { "$ref": "#/$defs/title" }, "description": { "$ref": "#/$defs/description" }, - "type": { "$ref": "#/$defs/propertyType" }, - "$ref": { "$ref": "#/$defs/$ref" } + "type": { "$ref": "#/$defs/propertyType" } }, - "additionalProperties": false + "additionalProperties": false, + "required": ["type"] }, "uriString": { "type": "string", "format": "uri" - }, - "uriReferenceString": { - "type": "string", - "format": "uri-reference" } }, "additionalProperties": false diff --git a/components/catalogs/back/src/Infrastructure/Validation/ProductSchemaValidator.php b/components/catalogs/back/src/Infrastructure/Validation/ProductSchemaValidator.php index 616317d733d3..72bede5cedbc 100644 --- a/components/catalogs/back/src/Infrastructure/Validation/ProductSchemaValidator.php +++ b/components/catalogs/back/src/Infrastructure/Validation/ProductSchemaValidator.php @@ -73,7 +73,7 @@ public function validate($value, Constraint $constraint): void private function getMetaSchemaLocalPath(string $id): ?string { return match ($id) { - 'https://api.akeneo.com/mapping/product/0.0.1/schema' => __DIR__.'/../Symfony/Resources/schemas/product-0.0.1.json', + 'https://api.akeneo.com/mapping/product/0.0.1/schema' => __DIR__.'/../Symfony/Resources/meta-schemas/product-0.0.1.json', default => null, }; } diff --git a/components/catalogs/back/tests/Integration/Infrastructure/Validation/ProductSchemaValidatorTest.php b/components/catalogs/back/tests/Integration/Infrastructure/Validation/ProductSchemaValidatorTest.php index 2ca0a96074c5..d33aace7cd2c 100644 --- a/components/catalogs/back/tests/Integration/Infrastructure/Validation/ProductSchemaValidatorTest.php +++ b/components/catalogs/back/tests/Integration/Infrastructure/Validation/ProductSchemaValidatorTest.php @@ -72,13 +72,6 @@ public function validSchemaDataProvider(): array "title": "Description", "description": "Product description in raw HTML", "type": "string" - }, - "url": { "$ref": "#/$defs/url" } - }, - "$defs": { - "url": { - "title": "Url", - "type": "string" } } } @@ -100,6 +93,16 @@ public function invalidSchemaDataProvider(): array } } } +JSON, + ], + '0.0.1 with missing target type' => [ + 'schema' => <<<'JSON' +{ + "$schema": "https://api.akeneo.com/mapping/product/0.0.1/schema", + "properties": { + "price": {} + } +} JSON, ], ];