Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor XML loaders and various quality fixes #738

Merged
merged 1 commit into from
Sep 9, 2016

Conversation

dunglas
Copy link
Member

@dunglas dunglas commented Sep 7, 2016

Q A
Bug fix? no
New feature? no
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets n/a
License MIT
Doc PR todo
  • fix various quality problems
  • rely on symfony/config for XML parsing
  • decrease the complexity of XML parsers
  • fix the XML schema (it can be simplified a lot and currently doesn't allow some possibilities offered by other formats).

@dunglas
Copy link
Member Author

dunglas commented Sep 8, 2016

I rewrote the XML Schema. The new format looks like:

<?xml version="1.0" encoding="UTF-8" ?>

<resources>
    <resource class="ApiPlatform\Core\Tests\Fixtures\TestBundle\Entity\Dummy"/>
    <resource
            class="ApiPlatform\Core\Tests\Fixtures\TestBundle\Entity\FileConfigDummy"
            shortName="thedummyshortname"
            description="Dummy resource"
            iri="someirischema"
    >
        <itemOperation name="my_op_name">
            <attribute name="method">GET</attribute>
        </itemOperation>
        <itemOperation name="my_other_op_name">
            <attribute name="method">POST</attribute>
        </itemOperation>

        <collectionOperation name="my_collection_op">
            <attribute name="method">POST</attribute>
            <attribute name="path">the/collection/path</attribute>
        </collectionOperation>

        <attribute name="normalization_context">
            <attribute name="groups">
                <attribute>default</attribute>
            </attribute>
        </attribute>
        <attribute name="denormalization_context">
            <attribute name="groups">
                <attribute>default</attribute>
            </attribute>
        </attribute>
        <attribute name="hydra_context">
            <attribute name="@type">hydra:Operation</attribute>
            <attribute name="@hydra:title">File config Dummy</attribute>
        </attribute>
    </resource>
</resources>

WDYT @soyuka?

{
private function __construct()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are we adding empty contruct functions?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The constructor is private. It's to block the possibility of initializing this class (it should only conain static methods).

@dunglas dunglas changed the title [WIP] Refactor XML loaders and various quality fixes Refactor XML loaders and various quality fixes Sep 8, 2016
@@ -20,8 +20,12 @@
* @author Teoh Han Hui <teohhanhui@gmail.com>
* @author Vincent Chalamon <vincentchalamon@gmail.com>
*/
abstract class QueryChecker
final class QueryChecker
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

\o/

@soyuka
Copy link
Member

soyuka commented Sep 8, 2016

Great improvements!! 👍

@teohhanhui
Copy link
Contributor

👍

@@ -1,8 +1,8 @@
{
"name": "api-platform/core",
"type": "library",
"description": "JSON-LD / Hydra REST API for Symfony",
"keywords": ["REST", "API", "JSON", "JSON-LD", "Hydra"],
"description": "The ultimate solution to create web APIs.",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😉

@dunglas dunglas merged commit 72dde50 into api-platform:master Sep 9, 2016
@dunglas dunglas deleted the quality branch September 9, 2016 08:49
magarzon pushed a commit to magarzon/core that referenced this pull request Feb 12, 2017
Refactor XML loaders and various quality fixes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants