Skip to content

Commit

Permalink
fix: Allow more specific object keys
Browse files Browse the repository at this point in the history
Signed-off-by: Joas Schilling <[email protected]>
  • Loading branch information
nickvergessen committed Nov 11, 2024
1 parent b8b55cc commit befa43b
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/OpenApiType.php
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,13 @@ public static function resolve(string $context, array $definitions, ParamTagValu
}

if ($node instanceof GenericTypeNode && $node->type->name === 'array' && count($node->genericTypes) === 2 && $node->genericTypes[0] instanceof IdentifierTypeNode) {
if ($node->genericTypes[0]->name === 'string') {
if (in_array($node->genericTypes[0]->name, ['string', 'lowercase-string', 'non-empty-string', 'non-empty-lowercase-string'], true)) {
if (str_starts_with($node->genericTypes[0]->name, 'non-empty-')) {
// FIXME Make sure the keys are non-empty
}
if (str_ends_with($node->genericTypes[0]->name, 'lowercase-string')) {
// FIXME Make sure the keys are lowercase only
}
return new OpenApiType(
context: $context,
type: 'object',
Expand Down

0 comments on commit befa43b

Please sign in to comment.