Skip to content

Commit ca58a7b

Browse files
committed
Allow schema generator to use labels for naming
API resources and PHP classes
1 parent 1709653 commit ca58a7b

32 files changed

+1424
-42
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Changelog
22

3+
## 5.2.3
4+
5+
* feat: Allow schema generator to use labels for naming API resources and PHP classes
6+
37
## 5.2.2
48

59
* fix: detect enum detection when an ancestor is an enum

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
@@ -16,7 +16,7 @@
1616
use ApiPlatform\SchemaGenerator\CardinalitiesExtractor;
1717
use ApiPlatform\SchemaGenerator\GoodRelationsBridge;
1818
use ApiPlatform\SchemaGenerator\SchemaGeneratorConfiguration;
19-
use EasyRdf\Graph as RdfGraph;
19+
use ApiPlatform\SchemaGenerator\Schema\Rdf\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
@@ -20,7 +20,7 @@
2020
use ApiPlatform\SchemaGenerator\Printer;
2121
use ApiPlatform\SchemaGenerator\TwigBuilder;
2222
use ApiPlatform\SchemaGenerator\TypesGenerator;
23-
use EasyRdf\Graph as RdfGraph;
23+
use ApiPlatform\SchemaGenerator\Schema\Rdf\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
{

0 commit comments

Comments
 (0)