-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
29 changed files
with
1,421 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# These are supported funding model platforms | ||
github: chriskapp | ||
patreon: fusio | ||
custom: https://www.paypal.me/fusioapi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
name: CI | ||
on: | ||
- pull_request | ||
- push | ||
jobs: | ||
psalm: | ||
name: Psalm | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
- name: Install PHP | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: 8.1 | ||
coverage: none | ||
- name: Composer install | ||
run: composer install --no-interaction --no-ansi --no-progress | ||
- name: Run Psalm | ||
run: vendor/bin/psalm --no-progress --shepherd --show-info=false --stats |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
name: SDKgen | ||
on: | ||
- workflow_dispatch | ||
permissions: | ||
contents: 'write' | ||
jobs: | ||
generate: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: apioo/sdkgen-generator-action@v0.1.4 | ||
with: | ||
client_id: '${{ secrets.SDKGEN_CLIENT_ID }}' | ||
client_secret: '${{ secrets.SDKGEN_CLIENT_SECRET }}' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
|
||
# About | ||
|
||
This library contains the official models to represent a [TypeAPI](https://typeapi.org/) or [TypeSchema](https://typeschema.org/) specification. | ||
It can be used to build i.e. code generators or other tools which need to | ||
interact with a TypeAPI or TypeSchema specification. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{ | ||
"name": "typeapi/model", | ||
"description": "This library contains models to represent a TypeAPI or TypeSchema specification", | ||
"homepage": "https://typeapi.org/", | ||
"license": "MIT", | ||
"authors": [ | ||
{ | ||
"name": "Christoph Kappestein", | ||
"email": "christoph.kappestein@gmail.com", | ||
"homepage": "https://chrisk.app/" | ||
} | ||
], | ||
"require-dev": { | ||
"vimeo/psalm": "^5.0" | ||
}, | ||
"autoload": { | ||
"psr-4": { | ||
"TypeAPI\\Model\\": "src/" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<?xml version="1.0"?> | ||
<psalm | ||
errorLevel="2" | ||
resolveFromConfigFile="true" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xmlns="https://getpsalm.org/schema/config" | ||
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd" | ||
> | ||
<projectFiles> | ||
<directory name="src" /> | ||
<ignoreFiles> | ||
<directory name="vendor" /> | ||
</ignoreFiles> | ||
</projectFiles> | ||
</psalm> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"type": "model-php", | ||
"require": { | ||
"typehub/typeapi": { | ||
"target": "./src", | ||
"namespace": "TypeAPI\\Model" | ||
}, | ||
"typehub/typeschema": { | ||
"target": "./src", | ||
"namespace": "TypeAPI\\Model" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<?php | ||
|
||
declare(strict_types = 1); | ||
|
||
namespace TypeAPI\Model; | ||
|
||
use PSX\Schema\Attribute\Description; | ||
|
||
#[Description('Represents an any type')] | ||
class AnyType extends CommonType implements \JsonSerializable, \PSX\Record\RecordableInterface | ||
Check failure on line 10 in src/AnyType.php GitHub Actions / PsalmMissingDependency
|
||
{ | ||
#[Description('')] | ||
protected ?string $type = null; | ||
public function setType(?string $type) : void | ||
{ | ||
$this->type = $type; | ||
} | ||
public function getType() : ?string | ||
{ | ||
return $this->type; | ||
} | ||
public function toRecord() : \PSX\Record\RecordInterface | ||
{ | ||
/** @var \PSX\Record\Record<mixed> $record */ | ||
$record = parent::toRecord(); | ||
$record->put('type', $this->type); | ||
return $record; | ||
} | ||
public function jsonSerialize() : object | ||
{ | ||
return (object) $this->toRecord()->getAll(); | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
<?php | ||
|
||
declare(strict_types = 1); | ||
|
||
namespace TypeAPI\Model; | ||
|
||
use PSX\Schema\Attribute\Description; | ||
|
||
#[Description('')] | ||
class Argument implements \JsonSerializable, \PSX\Record\RecordableInterface | ||
{ | ||
#[Description('The location where the value can be found either in the path, query, header or body. If you choose path, then your path must have a fitting variable path fragment')] | ||
protected ?string $in = null; | ||
#[Description('')] | ||
protected BooleanType|NumberType|IntegerType|StringType|ReferenceType|null $schema = null; | ||
#[Description('Optional the actual path, query or header name. If not provided the key of the argument map is used')] | ||
protected ?string $name = null; | ||
public function setIn(?string $in) : void | ||
{ | ||
$this->in = $in; | ||
} | ||
public function getIn() : ?string | ||
{ | ||
return $this->in; | ||
} | ||
public function setSchema(BooleanType|NumberType|IntegerType|StringType|ReferenceType|null $schema) : void | ||
{ | ||
$this->schema = $schema; | ||
} | ||
public function getSchema() : BooleanType|NumberType|IntegerType|StringType|ReferenceType|null | ||
{ | ||
return $this->schema; | ||
} | ||
public function setName(?string $name) : void | ||
{ | ||
$this->name = $name; | ||
} | ||
public function getName() : ?string | ||
{ | ||
return $this->name; | ||
} | ||
public function toRecord() : \PSX\Record\RecordInterface | ||
{ | ||
/** @var \PSX\Record\Record<mixed> $record */ | ||
$record = new \PSX\Record\Record(); | ||
$record->put('in', $this->in); | ||
$record->put('schema', $this->schema); | ||
$record->put('name', $this->name); | ||
return $record; | ||
} | ||
public function jsonSerialize() : object | ||
{ | ||
return (object) $this->toRecord()->getAll(); | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
<?php | ||
|
||
declare(strict_types = 1); | ||
|
||
namespace TypeAPI\Model; | ||
|
||
use PSX\Schema\Attribute\Description; | ||
|
||
#[Description('Represents an array type. An array type contains an ordered list of a specific type')] | ||
class ArrayType extends CommonType implements \JsonSerializable, \PSX\Record\RecordableInterface | ||
Check failure on line 10 in src/ArrayType.php GitHub Actions / PsalmMissingDependency
|
||
{ | ||
#[Description('')] | ||
protected ?string $type = null; | ||
#[Description('')] | ||
protected BooleanType|NumberType|IntegerType|StringType|AnyType|ReferenceType|GenericType|null $items = null; | ||
#[Description('Positive integer value')] | ||
protected ?int $maxItems = null; | ||
#[Description('Positive integer value')] | ||
protected ?int $minItems = null; | ||
public function setType(?string $type) : void | ||
{ | ||
$this->type = $type; | ||
} | ||
public function getType() : ?string | ||
{ | ||
return $this->type; | ||
} | ||
public function setItems(BooleanType|NumberType|IntegerType|StringType|AnyType|ReferenceType|GenericType|null $items) : void | ||
{ | ||
$this->items = $items; | ||
} | ||
public function getItems() : BooleanType|NumberType|IntegerType|StringType|AnyType|ReferenceType|GenericType|null | ||
{ | ||
return $this->items; | ||
} | ||
public function setMaxItems(?int $maxItems) : void | ||
{ | ||
$this->maxItems = $maxItems; | ||
} | ||
public function getMaxItems() : ?int | ||
{ | ||
return $this->maxItems; | ||
} | ||
public function setMinItems(?int $minItems) : void | ||
{ | ||
$this->minItems = $minItems; | ||
} | ||
public function getMinItems() : ?int | ||
{ | ||
return $this->minItems; | ||
} | ||
public function toRecord() : \PSX\Record\RecordInterface | ||
{ | ||
/** @var \PSX\Record\Record<mixed> $record */ | ||
$record = parent::toRecord(); | ||
$record->put('type', $this->type); | ||
$record->put('items', $this->items); | ||
$record->put('maxItems', $this->maxItems); | ||
$record->put('minItems', $this->minItems); | ||
return $record; | ||
} | ||
public function jsonSerialize() : object | ||
{ | ||
return (object) $this->toRecord()->getAll(); | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<?php | ||
|
||
declare(strict_types = 1); | ||
|
||
namespace TypeAPI\Model; | ||
|
||
use PSX\Schema\Attribute\Description; | ||
|
||
#[Description('Represents a boolean type')] | ||
class BooleanType extends ScalarType implements \JsonSerializable, \PSX\Record\RecordableInterface | ||
Check failure on line 10 in src/BooleanType.php GitHub Actions / PsalmMissingDependency
|
||
{ | ||
#[Description('')] | ||
protected ?string $type = null; | ||
public function setType(?string $type) : void | ||
{ | ||
$this->type = $type; | ||
} | ||
public function getType() : ?string | ||
{ | ||
return $this->type; | ||
} | ||
public function toRecord() : \PSX\Record\RecordInterface | ||
{ | ||
/** @var \PSX\Record\Record<mixed> $record */ | ||
$record = parent::toRecord(); | ||
$record->put('type', $this->type); | ||
return $record; | ||
} | ||
public function jsonSerialize() : object | ||
{ | ||
return (object) $this->toRecord()->getAll(); | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
<?php | ||
|
||
declare(strict_types = 1); | ||
|
||
namespace TypeAPI\Model; | ||
|
||
use PSX\Schema\Attribute\Description; | ||
|
||
#[Description('Represents a base type. Every type extends from this common type and shares the defined properties')] | ||
class CommonType implements \JsonSerializable, \PSX\Record\RecordableInterface | ||
{ | ||
#[Description('General description of this type, should not contain any new lines.')] | ||
protected ?string $description = null; | ||
#[Description('Type of the property')] | ||
protected ?string $type = null; | ||
#[Description('Indicates whether it is possible to use a null value')] | ||
protected ?bool $nullable = null; | ||
#[Description('Indicates whether this type is deprecated')] | ||
protected ?bool $deprecated = null; | ||
#[Description('Indicates whether this type is readonly')] | ||
protected ?bool $readonly = null; | ||
public function setDescription(?string $description) : void | ||
{ | ||
$this->description = $description; | ||
} | ||
public function getDescription() : ?string | ||
{ | ||
return $this->description; | ||
} | ||
public function setType(?string $type) : void | ||
{ | ||
$this->type = $type; | ||
} | ||
public function getType() : ?string | ||
{ | ||
return $this->type; | ||
} | ||
public function setNullable(?bool $nullable) : void | ||
{ | ||
$this->nullable = $nullable; | ||
} | ||
public function getNullable() : ?bool | ||
{ | ||
return $this->nullable; | ||
} | ||
public function setDeprecated(?bool $deprecated) : void | ||
{ | ||
$this->deprecated = $deprecated; | ||
} | ||
public function getDeprecated() : ?bool | ||
{ | ||
return $this->deprecated; | ||
} | ||
public function setReadonly(?bool $readonly) : void | ||
{ | ||
$this->readonly = $readonly; | ||
} | ||
public function getReadonly() : ?bool | ||
{ | ||
return $this->readonly; | ||
} | ||
public function toRecord() : \PSX\Record\RecordInterface | ||
{ | ||
/** @var \PSX\Record\Record<mixed> $record */ | ||
$record = new \PSX\Record\Record(); | ||
$record->put('description', $this->description); | ||
$record->put('type', $this->type); | ||
$record->put('nullable', $this->nullable); | ||
$record->put('deprecated', $this->deprecated); | ||
$record->put('readonly', $this->readonly); | ||
return $record; | ||
} | ||
public function jsonSerialize() : object | ||
{ | ||
return (object) $this->toRecord()->getAll(); | ||
} | ||
} | ||
|
Oops, something went wrong.