Skip to content

Commit

Permalink
feat: add basic XSD and OWL support (#204)
Browse files Browse the repository at this point in the history
* feat: add basic XSD and OWL support

* fix: Doctrine ORM support

* fix: MongoDB ODM generator

* fix: ConstraintAnnotationGenerator

* feat: exclude deprecated properties

* feat: OWL cardinality support

* fix: detect parent classes

* fix: many fixes

* feat: stop pluralizing or singularizing property names

* fix: add ignored properties

* fix: many fixes improving ActivityPub support

* feat: add support for types and properties exclusion

* fix: various fixes and improvements

* fix some tests

* fix: tests

* fix: cs

* fix: better composer.json

* fix: some bugs and tests

* docs: add changelog
  • Loading branch information
dunglas authored Jan 20, 2021
1 parent f077769 commit cf7aaca
Show file tree
Hide file tree
Showing 43 changed files with 5,945 additions and 2,544 deletions.
20 changes: 9 additions & 11 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,32 +6,30 @@ cache:

matrix:
include:
- php: '7.4'
- php: '8.0'
env: coverage=1 lint=1
- php: '7.4'
env: deps='low'

before_install:
- phpenv config-rm xdebug.ini || echo "xdebug not available"
- echo "memory_limit=-1" >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini
- export PATH="$PATH:$HOME/.composer/vendor/bin"
- if [[ $coverage = 1 ]]; then mkdir -p build/logs; fi
- if [[ $coverage = 1 ]]; then wget https://github.com/satooshi/php-coveralls/releases/download/v2.2.0/php-coveralls.phar; fi
- if [[ $lint = 1 ]]; then wget https://github.com/phpstan/phpstan/releases/download/0.12.9/phpstan.phar; fi
- wget -O box.phar https://github.com/humbug/box/releases/download/3.8.4/box.phar
- if [[ $coverage = 1 ]]; then wget https://github.com/satooshi/php-coveralls/releases/download/v2.4.3/php-coveralls.phar; fi
- wget -O box.phar https://github.com/humbug/box/releases/download/3.11.1/box.phar
- export BOX_BIN=$(pwd)/box.phar

install:
- if [[ $coverage = 1 ]]; then composer require --dev --no-update 'phpunit/php-code-coverage:^8.0'; fi
- if [[ ! $deps && $TRAVIS_PHP_VERSION = "7.4" ]]; then composer install --prefer-dist --no-progress --no-suggest --ansi; fi
- if [[ $TRAVIS_PHP_VERSION != "7.4" ]]; then composer update --prefer-stable --prefer-dist --no-progress --no-suggest --ansi; fi
- if [[ $coverage = 1 ]]; then composer require --dev --no-update 'phpunit/php-code-coverage:^9.2'; fi
- if [[ ! $deps && $TRAVIS_PHP_VERSION = "8.0" ]]; then composer install --prefer-dist --no-progress --no-suggest --ansi; fi
- if [[ $TRAVIS_PHP_VERSION != "8.0" ]]; then composer update --prefer-stable --prefer-dist --no-progress --no-suggest --ansi; fi
- if [[ $deps = 'low' ]]; then composer update --prefer-dist --no-progress --no-suggest --prefer-stable --prefer-lowest --ansi; fi

script:
- if [[ $coverage = 1 ]]; then phpdbg -qrr vendor/bin/simple-phpunit --coverage-clover build/logs/clover.xml; else vendor/bin/simple-phpunit; fi
- if [[ $lint = 1 ]]; then vendor/bin/php-cs-fixer fix --dry-run --diff --no-ansi; fi
- if [[ $lint = 1 ]]; then php phpstan.phar analyse; fi
- if [[ ! $deps && $TRAVIS_PHP_VERSION = "7.4" ]]; then ./bin/compile; fi
- if [[ $lint = 1 ]]; then vendor/bin/phpstan analyse; fi
- if [[ ! $deps && $TRAVIS_PHP_VERSION = "8.0" ]]; then ./bin/compile; fi

after_success:
- if [[ $coverage = 1 ]]; then travis_retry php php-coveralls.phar; fi
Expand All @@ -45,5 +43,5 @@ deploy:
on:
tags: true
repo: api-platform/schema-generator
php: '7.4'
php: '8.0'
condition: "! $deps"
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
# Changelog

## 3.0.0

* Support for [the Web Ontology Language (OWL)](https://en.wikipedia.org/wiki/Web_Ontology_Language) (including for [the ActivityStream vocabulary](https://www.w3.org/TR/activitystreams-core/))
* Support for [XML Schema](https://en.wikipedia.org/wiki/XML_Schema_(W3C)) types
* Compatbility with the latest version of Schema.org
* Improved PHP type hints generation (including support for typed properties)
* Improved PHPDoc support
* Upgrade to EasyRDF 1 and Doctrine Inflector 2
* More flexible configuration
* The `generate-types` command has been renamed `generate`

## 2.2.2

* Update to Symfony 5
Expand Down
2 changes: 1 addition & 1 deletion bin/compile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ set -eox pipefail

php "$BOX_BIN" compile;

php schema.phar generate-types tmp/ tests/e2e/schema.yml;
php schema.phar generate tmp/ tests/e2e/schema.yml;

diff tests/e2e/src/App/Entity/Person.php tmp/App/Entity/Person.php;
diff tests/e2e/src/App/Entity/PostalAddress.php tmp/App/Entity/PostalAddress.php;
Expand Down
4 changes: 2 additions & 2 deletions bin/schema
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ if (file_exists(__DIR__ . '/../../../autoload.php')) {
use Symfony\Component\Console\Application;
use ApiPlatform\SchemaGenerator\Command\ExtractCardinalitiesCommand;
use ApiPlatform\SchemaGenerator\Command\DumpConfigurationCommand;
use ApiPlatform\SchemaGenerator\Command\GenerateTypesCommand;
use ApiPlatform\SchemaGenerator\Command\GenerateCommand;

$application = new Application();
$application->add(new ExtractCardinalitiesCommand());
$application->add(new DumpConfigurationCommand());
$application->add(new GenerateTypesCommand());
$application->add(new GenerateCommand());
$application->run();
1 change: 0 additions & 1 deletion box.json.dist
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
],

"directories-bin": [
"data/",
"templates/"
],
"files": [
Expand Down
26 changes: 14 additions & 12 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"type": "library",
"description": "Various tools to generate a data model based on Schema.org vocables",
"keywords": ["schema.org", "semantic", "model", "doctrine", "symfony", "entity", "enum"],
"homepage": "https://api-platform.com",
"homepage": "https://api-platform.com/docs/schema-generator/",
"license": "MIT",
"authors": [
{
Expand All @@ -21,24 +21,26 @@
"php": ">=7.4",
"ext-json": "*",
"doctrine/inflector": "^1.4.3 || ^2.0",
"easyrdf/easyrdf": "dev-master",
"easyrdf/easyrdf": "^1.1",
"friendsofphp/php-cs-fixer": "^2.15",
"league/html-to-markdown": "^4.9",
"psr/log": "^1.0",
"symfony/config": "^5.1",
"symfony/console": "^5.1",
"symfony/yaml": "^5.1",
"symfony/filesystem": "^5.1",
"twig/twig": " ^3.0"
"symfony/config": "^5.2",
"symfony/console": "^5.2",
"symfony/yaml": "^5.2",
"symfony/filesystem": "^5.2",
"twig/twig": "^3.0"
},
"require-dev": {
"api-platform/core": "^2.6",
"api-platform/core": "^2.5",
"doctrine/orm": "^2.7",
"myclabs/php-enum": "^1.7",
"symfony/doctrine-bridge": "^5.1",
"symfony/phpunit-bridge": "^5.1",
"symfony/serializer": "^5.1",
"symfony/validator": "^5.1"
"symfony/doctrine-bridge": "^5.2",
"symfony/phpunit-bridge": "^5.2",
"symfony/serializer": "^5.2",
"symfony/validator": "^5.2",
"phpspec/prophecy-phpunit": "^2.0",
"phpstan/phpstan": "^0.12"
},
"bin": ["bin/schema"],
"minimum-stability": "dev"
Expand Down
Loading

0 comments on commit cf7aaca

Please sign in to comment.