Skip to content

Commit 2ec8626

Browse files
authored
Merge pull request #1080 from scollado/2.0
Add attributes to metadata XSD file
2 parents 587bdb1 + 0fbe666 commit 2ec8626

File tree

8 files changed

+33
-16
lines changed

8 files changed

+33
-16
lines changed

src/Metadata/schema/metadata.xsd

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
<?xml version="1.0" ?>
22

33
<xsd:schema
4+
xmlns="https://api-platform.com/schema/metadata"
45
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
6+
targetNamespace="https://api-platform.com/schema/metadata"
57
elementFormDefault="qualified">
68

79
<xsd:element name="resources" type="resources"/>

tests/Fixtures/FileConfigurations/propertyinvalid.xml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
<?xml version="1.0" ?>
22

3-
<resources>
3+
<resources xmlns="https://api-platform.com/schema/metadata"
4+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
5+
xsi:schemaLocation="https://api-platform.com/schema/metadata
6+
https://api-platform.com/schema/metadata/metadata-2.0.xsd">
47
<resource class="ApiPlatform\Core\Tests\Fixtures\TestBundle\Entity\FileConfigDummy">
58
<property name="foo">
69
<foo>Foo</foo>
Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
<?xml version="1.0" encoding="UTF-8" ?>
22

3-
<resources>
3+
<resources xmlns="https://api-platform.com/schema/metadata"
4+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
5+
xsi:schemaLocation="https://api-platform.com/schema/metadata
6+
https://api-platform.com/schema/metadata/metadata-2.0.xsd">
47
<resource class="ApiPlatform\Core\Tests\Fixtures\TestBundle\Entity\ThisDoesNotExist">
58
</resource>
69
</resources>

tests/Fixtures/FileConfigurations/resources.xml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
<?xml version="1.0" ?>
22

3-
<resources>
3+
<resources xmlns="https://api-platform.com/schema/metadata"
4+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
5+
xsi:schemaLocation="https://api-platform.com/schema/metadata
6+
https://api-platform.com/schema/metadata/metadata-2.0.xsd">
47
<resource class="ApiPlatform\Core\Tests\Fixtures\TestBundle\Entity\Dummy"/>
58
<resource
69
class="ApiPlatform\Core\Tests\Fixtures\TestBundle\Entity\FileConfigDummy"
@@ -56,6 +59,6 @@
5659
<attribute name="baz">Baz</attribute>
5760
</property>
5861

59-
<property name="name" description="The dummy name" />
62+
<property name="name" description="The dummy name"/>
6063
</resource>
6164
</resources>
Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
<?xml version="1.0" encoding="UTF-8" ?>
22

3-
<resources>
4-
<resource class="ApiPlatform\Core\Tests\Fixtures\TestBundle\Entity\FileConfigDummy">
5-
<foo name="my_op_name" />
6-
</resource>
3+
<resources xmlns="https://api-platform.com/schema/metadata"
4+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
5+
xsi:schemaLocation="https://api-platform.com/schema/metadata
6+
https://api-platform.com/schema/metadata/metadata-2.0.xsd">
7+
<resource class="ApiPlatform\Core\Tests\Fixtures\TestBundle\Entity\FileConfigDummy">
8+
<foo name="my_op_name"/>
9+
</resource>
710
</resources>
Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
<?xml version="1.0" encoding="UTF-8" ?>
22

3-
<resources>
4-
<resource class="ApiPlatform\Core\Tests\Fixtures\TestBundle\Entity\FileConfigDummy">
5-
<itemOperation name="my_op_name">
6-
<attribute name="method">POST</attribute>
7-
</itemOperation>
8-
</resource>
3+
<resources xmlns="https://api-platform.com/schema/metadata"
4+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
5+
xsi:schemaLocation="https://api-platform.com/schema/metadata
6+
https://api-platform.com/schema/metadata/metadata-2.0.xsd">
7+
<resource class="ApiPlatform\Core\Tests\Fixtures\TestBundle\Entity\FileConfigDummy">
8+
<itemOperation name="my_op_name">
9+
<attribute name="method">POST</attribute>
10+
</itemOperation>
11+
</resource>
912
</resources>

tests/Metadata/Property/Factory/ExtractorPropertyMetadataFactoryTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ public function testCreateWithNonexistentPropertyXml()
8383

8484
/**
8585
* @expectedException \ApiPlatform\Core\Exception\InvalidArgumentException
86-
* @expectedExceptionMessageRegExp /.+Element 'foo': This element is not expected\..+/
86+
* @expectedExceptionMessageRegExp #.+Element '\{https://api-platform.com/schema/metadata\}foo': This element is not expected\..+#
8787
*/
8888
public function testCreateWithInvalidXml()
8989
{

tests/Metadata/Property/Factory/ExtractorPropertyNameCollectionFactoryTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ public function testCreateWithNonexistentResourceXml()
6464

6565
/**
6666
* @expectedException \ApiPlatform\Core\Exception\InvalidArgumentException
67-
* @expectedExceptionMessageRegExp /.+Element 'foo': This element is not expected\..+/
67+
* @expectedExceptionMessageRegExp #.+Element '\{https://api-platform.com/schema/metadata\}foo': This element is not expected\..+#
6868
*/
6969
public function testCreateWithInvalidXml()
7070
{

0 commit comments

Comments
 (0)