Skip to content

Commit 55d13b9

Browse files
committed
feat: Allow schema generator to use labels for naming API resources and PHP classes
1 parent 997f6f8 commit 55d13b9

31 files changed

+1430
-42
lines changed

src/CardinalitiesExtractor.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313

1414
namespace ApiPlatform\SchemaGenerator;
1515

16-
use EasyRdf\Graph as RdfGraph;
17-
use EasyRdf\Resource as RdfResource;
16+
use ApiPlatform\SchemaGenerator\Schema\Rdf\RdfGraph;
17+
use ApiPlatform\SchemaGenerator\Schema\Rdf\RdfResource;
1818

1919
/**
2020
* Extracts cardinalities from the OWL definition, from GoodRelations or from Schema.org's comments.
@@ -104,7 +104,7 @@ private function extractForProperty(RdfResource $property): string
104104
return self::CARDINALITY_UNKNOWN;
105105
}
106106

107-
$fromGoodRelations = $this->goodRelationsBridge->extractCardinality($localName);
107+
$fromGoodRelations = $this->goodRelationsBridge->extractCardinality($property->localId());
108108
if (false !== $fromGoodRelations) {
109109
return $fromGoodRelations;
110110
}

src/ClassMutator/AnnotationsAppender.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
use ApiPlatform\SchemaGenerator\AnnotationGenerator\AnnotationGeneratorInterface;
1717
use ApiPlatform\SchemaGenerator\Model\Class_;
1818
use ApiPlatform\SchemaGenerator\Model\Use_;
19-
use EasyRdf\Resource as RdfResource;
19+
use ApiPlatform\SchemaGenerator\Schema\Rdf\RdfResource;
2020

2121
final class AnnotationsAppender implements ClassMutatorInterface
2222
{

src/ClassMutator/ClassPropertiesAppender.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616
use ApiPlatform\SchemaGenerator\Model\Class_;
1717
use ApiPlatform\SchemaGenerator\PropertyGenerator\PropertyGeneratorInterface;
1818
use ApiPlatform\SchemaGenerator\Schema\Model\Class_ as SchemaClass;
19-
use EasyRdf\Graph as RdfGraph;
20-
use EasyRdf\Resource as RdfResource;
19+
use ApiPlatform\SchemaGenerator\Schema\Rdf\RdfGraph;
20+
use ApiPlatform\SchemaGenerator\Schema\Rdf\RdfResource;
2121
use Psr\Log\LoggerAwareTrait;
2222

2323
final class ClassPropertiesAppender implements ClassMutatorInterface

src/Command/ExtractCardinalitiesCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515

1616
use ApiPlatform\SchemaGenerator\CardinalitiesExtractor;
1717
use ApiPlatform\SchemaGenerator\GoodRelationsBridge;
18+
use ApiPlatform\SchemaGenerator\Schema\Rdf\RdfGraph;
1819
use ApiPlatform\SchemaGenerator\SchemaGeneratorConfiguration;
19-
use EasyRdf\Graph as RdfGraph;
2020
use Symfony\Component\Console\Command\Command;
2121
use Symfony\Component\Console\Input\InputInterface;
2222
use Symfony\Component\Console\Input\InputOption;

src/Schema/ClassMutator/EnumClassMutator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
use ApiPlatform\SchemaGenerator\Model\Class_;
1818
use ApiPlatform\SchemaGenerator\PhpTypeConverterInterface;
1919
use ApiPlatform\SchemaGenerator\Schema\Model\Constant as SchemaConstant;
20-
use EasyRdf\Graph as RdfGraph;
20+
use ApiPlatform\SchemaGenerator\Schema\Rdf\RdfGraph;
2121

2222
final class EnumClassMutator extends BaseEnumClassMutator
2323
{

src/Schema/Generator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@
1818
use ApiPlatform\SchemaGenerator\GoodRelationsBridge;
1919
use ApiPlatform\SchemaGenerator\PhpTypeConverter;
2020
use ApiPlatform\SchemaGenerator\Printer;
21+
use ApiPlatform\SchemaGenerator\Schema\Rdf\RdfGraph;
2122
use ApiPlatform\SchemaGenerator\TwigBuilder;
2223
use ApiPlatform\SchemaGenerator\TypesGenerator;
23-
use EasyRdf\Graph as RdfGraph;
2424
use Symfony\Component\Console\Logger\ConsoleLogger;
2525
use Symfony\Component\Console\Output\OutputInterface;
2626
use Symfony\Component\Console\Style\SymfonyStyle;

src/Schema/Model/Class_.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
namespace ApiPlatform\SchemaGenerator\Schema\Model;
1515

1616
use ApiPlatform\SchemaGenerator\Model\Class_ as BaseClass_;
17-
use EasyRdf\Resource as RdfResource;
17+
use ApiPlatform\SchemaGenerator\Schema\Rdf\RdfResource;
1818

1919
final class Class_ extends BaseClass_
2020
{

src/Schema/Model/Constant.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
namespace ApiPlatform\SchemaGenerator\Schema\Model;
1515

1616
use ApiPlatform\SchemaGenerator\Model\Constant as BaseConstant;
17-
use EasyRdf\Resource as RdfResource;
17+
use ApiPlatform\SchemaGenerator\Schema\Rdf\RdfResource;
1818

1919
final class Constant extends BaseConstant
2020
{

src/Schema/Model/Property.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
namespace ApiPlatform\SchemaGenerator\Schema\Model;
1515

1616
use ApiPlatform\SchemaGenerator\Model\Property as BaseProperty;
17-
use EasyRdf\Resource as RdfResource;
17+
use ApiPlatform\SchemaGenerator\Schema\Rdf\RdfResource;
1818

1919
final class Property extends BaseProperty
2020
{

src/Schema/PropertyGenerator/IdPropertyGenerator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
use ApiPlatform\SchemaGenerator\PropertyGenerator\IdPropertyGeneratorInterface;
2020
use ApiPlatform\SchemaGenerator\Schema\Model\Property as SchemaProperty;
2121
use ApiPlatform\SchemaGenerator\Schema\Model\Type\PrimitiveType as SchemaPrimitiveType;
22-
use EasyRdf\Resource as RdfResource;
22+
use ApiPlatform\SchemaGenerator\Schema\Rdf\RdfResource;
2323

2424
final class IdPropertyGenerator implements IdPropertyGeneratorInterface
2525
{

0 commit comments

Comments
 (0)