Skip to content

Commit b72c6c8

Browse files
committed
Fix duplicating parameter schema if it already exists
1 parent ed6bc45 commit b72c6c8

1 file changed

Lines changed: 13 additions & 9 deletions

File tree

src/Processors/AugmentParameters.php

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -65,15 +65,19 @@ protected function augmentParameters(Analysis $analysis): void
6565
}
6666

6767
if ($context->reflector instanceof \ReflectionParameter) {
68-
$schema = new OA\Schema(['_context' => new Context(['reflector' => $context->reflector], $context)]);
69-
$this->generator->getTypeResolver()->augmentSchemaType($analysis, $schema);
70-
71-
$parameter->merge([new OA\Schema([
72-
'type' => $schema->type,
73-
'format' => $schema->format,
74-
'ref' => $schema->ref,
75-
'_context' => new Context(['nested' => $this, 'comment' => null, 'reflector' => $context->reflector], $context)]),
76-
]);
68+
if (Generator::isDefault($parameter->schema)) {
69+
$schema = new OA\Schema(['_context' => new Context(['reflector' => $context->reflector], $context)]);
70+
$this->generator->getTypeResolver()->augmentSchemaType($analysis, $schema);
71+
72+
$parameter->merge([new OA\Schema([
73+
'type' => $schema->type,
74+
'format' => $schema->format,
75+
'ref' => $schema->ref,
76+
'_context' => new Context(['nested' => $this, 'comment' => null, 'reflector' => $context->reflector], $context)]),
77+
]);
78+
} else {
79+
$schema = $parameter->schema;
80+
}
7781

7882
if (Generator::isDefault($parameter->required)) {
7983
$parameter->required = !$schema->isNullable();

0 commit comments

Comments
 (0)