Skip to content

Commit

Permalink
feat(OpenApiType): Show better error messages for unsupported types
Browse files Browse the repository at this point in the history
Signed-off-by: provokateurin <[email protected]>
  • Loading branch information
provokateurin committed Jan 18, 2024
1 parent c69ac97 commit d80ff19
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/OpenApiType.php
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,9 @@ public static function resolve(string $context, array $definitions, ParamTagValu
}
return new OpenApiType(type: "array", items: self::resolve($context, $definitions, $node->genericTypes[0]));
}
if ($node instanceof GenericTypeNode && $node->type->name === 'value-of') {
Logger::panic($context, "'value-of' is not supported");
}

if ($node instanceof ArrayShapeNode) {
$properties = [];
Expand Down Expand Up @@ -266,7 +269,11 @@ enum: [(int)$node->constExpr->value],
);
}

Logger::panic($context, "Unable to resolve OpenAPI type for type '" . get_class($node) . "'");
if ($node instanceof ConstTypeNode) {
Logger::panic($context, 'Constants are not supported');
}

Logger::panic($context, "Unable to resolve OpenAPI type:\n" . var_export($node, true) . "\nPlease open an issue at https://github.com/nextcloud/openapi-extractor/issues/new with a link to your source code.");
}

/**
Expand Down

0 comments on commit d80ff19

Please sign in to comment.