mirror of
https://github.com/appwrite/appwrite.git
synced 2026-05-26 13:51:13 +00:00
Merge pull request #11817 from appwrite/fix/specs-unresolved-model
fix: throw RuntimeException for unresolved response models in spec generation
This commit is contained in:
@@ -161,6 +161,27 @@ jobs:
|
||||
- name: Run PHPStan
|
||||
run: composer analyze -- --no-progress
|
||||
|
||||
specs:
|
||||
name: Checks / Specs
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Check out the repo
|
||||
uses: actions/checkout@v6
|
||||
|
||||
- name: Setup PHP
|
||||
uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: '8.3'
|
||||
extensions: swoole
|
||||
tools: composer:v2
|
||||
coverage: none
|
||||
|
||||
- name: Install dependencies
|
||||
run: composer install --prefer-dist --no-progress --ignore-platform-reqs
|
||||
|
||||
- name: Generate specs
|
||||
run: _APP_STORAGE_LIMIT=5368709120 php app/cli.php specs --version=latest --git=no
|
||||
|
||||
locale:
|
||||
name: Checks / Locale
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
@@ -482,7 +482,12 @@ class Specs extends Action
|
||||
? $specsDir . '/' . $format . '-mocks-' . $platform . '.json'
|
||||
: $specsDir . '/' . $format . '-' . $version . '-' . $platform . '.json';
|
||||
|
||||
$parsedSpecs = $specs->parse();
|
||||
try {
|
||||
$parsedSpecs = $specs->parse();
|
||||
} catch (\RuntimeException $e) {
|
||||
throw new \RuntimeException("Spec generation failed for {$platform} ({$format}): " . $e->getMessage(), 0, $e);
|
||||
}
|
||||
|
||||
$encodedSpecs = \json_encode($parsedSpecs, JSON_PRETTY_PRINT);
|
||||
|
||||
unset($parsedSpecs);
|
||||
|
||||
@@ -278,6 +278,18 @@ class OpenAPI3 extends Format
|
||||
}
|
||||
}
|
||||
|
||||
if (\is_string($model)) {
|
||||
throw new \RuntimeException("Unresolved response model '{$model}' for method '{$sdk->getNamespace()}.{$sdk->getMethodName()}'. Ensure the model is registered.");
|
||||
}
|
||||
|
||||
if (\is_array($model)) {
|
||||
foreach ($model as $m) {
|
||||
if (\is_string($m)) {
|
||||
throw new \RuntimeException("Unresolved response model '{$m}' for method '{$sdk->getNamespace()}.{$sdk->getMethodName()}'. Ensure the model is registered.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!(\is_array($model)) && $model->isNone()) {
|
||||
$temp['responses'][(string)$response->getCode() ?? '500'] = [
|
||||
'description' => in_array($produces, [
|
||||
|
||||
@@ -285,6 +285,18 @@ class Swagger2 extends Format
|
||||
}
|
||||
}
|
||||
|
||||
if (\is_string($model)) {
|
||||
throw new \RuntimeException("Unresolved response model '{$model}' for method '{$sdk->getNamespace()}.{$sdk->getMethodName()}'. Ensure the model is registered.");
|
||||
}
|
||||
|
||||
if (\is_array($model)) {
|
||||
foreach ($model as $m) {
|
||||
if (\is_string($m)) {
|
||||
throw new \RuntimeException("Unresolved response model '{$m}' for method '{$sdk->getNamespace()}.{$sdk->getMethodName()}'. Ensure the model is registered.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!(\is_array($model)) && $model->isNone()) {
|
||||
$temp['responses'][(string)$response->getCode() ?? '500'] = [
|
||||
'description' => in_array($produces, [
|
||||
|
||||
@@ -12,7 +12,7 @@ class Project extends Model
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
protected bool $public = false;
|
||||
protected bool $public = true;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user