Skip to content

Remove XML type configuration support #852

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

Merged
merged 1 commit into from
May 23, 2021
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
5 changes: 5 additions & 0 deletions UPGRADE.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ UPGRADE FROM 0.13 to 0.14
- [Rename `ResolverInterface` to `QueryInterface`](#rename-resolverinterface-to-queryinterface)
- [Remove Argument deprecated method](#remove-argument-deprecated-method)
- [Remove ConnectionBuilder deprecated class](#remove-connectionbuilder-deprecated-class)
- [Remove XML type configuration](#remove-xml-type-configuration-support)

### Customize the cursor encoder of the edges of a connection

Expand Down Expand Up @@ -216,6 +217,10 @@ Method `Overblog\GraphQLBundle\Definition\Argument::getRawArguments` is replaced
Class `Overblog\GraphQLBundle\Relay\Connection\Output\ConnectionBuilder` is replaced by
`Overblog\GraphQLBundle\Relay\Connection\ConnectionBuilder`.

### Remove XML type configuration support

XML type configuration is no longer supported.

UPGRADE FROM 0.12 to 0.13
=======================

Expand Down
4 changes: 2 additions & 2 deletions docs/definitions/type-system/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Types can be define 3 different ways:

1. **The configuration way**

Creating this file extension **.types.yml** or **.types.xml**
Creating this file extension **.types.yml**
in `src/*Bundle/Resources/config/graphql` or `app/config/graphql`.
See the different possible types:
* [Scalars](scalars.md)
Expand All @@ -28,7 +28,7 @@ Types can be define 3 different ways:
# auto_discover: false # to disable bundles and root dir auto discover
types:
-
type: yaml # or xml or graphql or annotation null
type: yaml # or graphql or annotation null
dir: "%kernel.root_dir%/.../mapping" # sub directories are also searched
# suffix: .types # use to change default file suffix
-
Expand Down
9 changes: 2 additions & 7 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -100,11 +100,6 @@ parameters:
count: 1
path: src/Config/Parser/GraphQLParser.php

-
message: "#^Parameter \\#1 \\$resource of class Symfony\\\\Component\\\\Config\\\\Resource\\\\FileResource constructor expects string, string\\|false given\\.$#"
count: 1
path: src/Config/Parser/XmlParser.php

-
message: "#^Parameter \\#1 \\$file of static method Symfony\\\\Component\\\\Config\\\\Util\\\\XmlUtils\\:\\:loadFile\\(\\) expects string, string\\|false given\\.$#"
count: 1
Expand All @@ -126,7 +121,7 @@ parameters:
path: src/DependencyInjection/Compiler/AliasedPass.php

-
message: "#^Parameter \\#1 \\$function of function call_user_func expects callable\\(\\)\\: mixed, array\\('Overblog…'\\|'Overblog…'\\|'Overblog…'\\|'Overblog…'\\|'Overblog…', 'parse'\\|'preParse'\\) given\\.$#"
message: "#^Parameter \\#1 \\$function of function call_user_func expects callable\\(\\)\\: mixed, array\\('Overblog…'\\|'Overblog…'\\|'Overblog…'\\|'Overblog…', 'parse'\\|'preParse'\\) given\\.$#"
count: 1
path: src/DependencyInjection/Compiler/ConfigParserPass.php

Expand Down Expand Up @@ -448,4 +443,4 @@ parameters:
-
message: "#^Call to an undefined method ReflectionClass|ReflectionMethod|ReflectionProperty::getAttributes().$#"
count: 1
path: src/Config/Parser/AttributeParser.php
path: src/Config/Parser/AttributeParser.php
43 changes: 0 additions & 43 deletions src/Config/Parser/XmlParser.php

This file was deleted.

5 changes: 1 addition & 4 deletions src/DependencyInjection/Compiler/ConfigParserPass.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
use Overblog\GraphQLBundle\Config\Parser\AttributeParser;
use Overblog\GraphQLBundle\Config\Parser\GraphQLParser;
use Overblog\GraphQLBundle\Config\Parser\PreParserInterface;
use Overblog\GraphQLBundle\Config\Parser\XmlParser;
use Overblog\GraphQLBundle\Config\Parser\YamlParser;
use Overblog\GraphQLBundle\DependencyInjection\TypesConfiguration;
use Overblog\GraphQLBundle\OverblogGraphQLBundle;
Expand Down Expand Up @@ -39,15 +38,13 @@ class ConfigParserPass implements CompilerPassInterface
{
public const SUPPORTED_TYPES_EXTENSIONS = [
'yaml' => '{yaml,yml}',
'xml' => 'xml',
'graphql' => '{graphql,graphqls}',
'annotation' => 'php',
'attribute' => 'php',
];

public const PARSERS = [
'yaml' => YamlParser::class,
'xml' => XmlParser::class,
'graphql' => GraphQLParser::class,
'annotation' => AnnotationParser::class,
'attribute' => AttributeParser::class,
Expand Down Expand Up @@ -224,7 +221,7 @@ private function mappingFromBundles(ContainerBuilder $container): array

$bundleDir = $this->bundleDir($class);

// only config files (yml or xml)
// only config files (yml)
$typesMappings[] = ['dir' => $bundleDir.'/Resources/config/graphql', 'types' => null];
}

Expand Down
7 changes: 0 additions & 7 deletions tests/DependencyInjection/Compiler/ConfigParserPassTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,6 @@ public function testBrokenYmlOnPrepend(): void
$this->processCompilerPass($this->getMappingConfig('yaml'));
}

public function testBrokenXmlOnPrepend(): void
{
$this->expectException(InvalidArgumentException::class);
$this->expectExceptionMessageMatches('#Unable to parse file "(.*)'.preg_quote(DIRECTORY_SEPARATOR).'broken.types.xml"\.#');
$this->processCompilerPass($this->getMappingConfig('xml'));
}

public function testPreparseOnPrepend(): void
{
$this->expectException(InvalidConfigurationException::class);
Expand Down
1 change: 0 additions & 1 deletion tests/DependencyInjection/mapping/xml/broken.types.xml

This file was deleted.

2 changes: 1 addition & 1 deletion tests/Functional/App/config/plural/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@ overblog_graphql:
mappings:
types:
-
type: xml
type: yaml
dir: "%kernel.project_dir%/config/plural/mapping"
25 changes: 0 additions & 25 deletions tests/Functional/App/config/plural/mapping/Query.types.xml

This file was deleted.

12 changes: 12 additions & 0 deletions tests/Functional/App/config/plural/mapping/Query.types.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
Query:
type: object
config:
fields:
usernames:
builder: Relay::PluralIdentifyingRoot
builderConfig:
argName: usernames
description: Map from a username to the user
inputType: String
outputType: User
resolveSingleInput: '@=query("plural_resolver", value, info)'
21 changes: 0 additions & 21 deletions tests/Functional/App/config/plural/mapping/User.types.xml

This file was deleted.

8 changes: 8 additions & 0 deletions tests/Functional/App/config/plural/mapping/User.types.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
User:
type: object
config:
fields:
username:
type: String
url:
type: String
8 changes: 0 additions & 8 deletions tests/Functional/App/config/plural/mapping/empty.types.xml

This file was deleted.