Skip to content

Bug: Parameter‑level #[Schema] wraps output in extra definition key #55

@micbenner

Description

@micbenner

Hi there

When using a parameter level Schema override e.g.:

public function __invoke(
    #[Schema(
        definition: [
            'description' => 'This parameter has some complex definition which warrants manually entering the schema.',
        ],
    )]
    string $test,
}

The output schema for the property will look like this:

[
    'type' => ['string'],
    'definition' => [
        'description => '...',
    ],
]

I think the culprit is here, where it should just return $this->definition, instead of ['definition' => $this->definition]:

public function toArray(): array
{
if ($this->definition !== null) {
return [
'definition' => $this->definition,
];
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions