Repository navigation
feat: operation context for @input/@output [method], object schemas, input.undeclared lint rule - #2
Merged
Conversation
…ndeclared Один метод контроллера может обслуживать много маршрутов — обобщённый CRUD-контроллер регистрируется под ключом на каждую сущность, и набор полей зависит от маршрута. `[method]` вызывался без аргументов и не мог ответить за конкретный маршрут; на практике это значило «ни одного поля». - OperationContext (версия, класс Api, ключ контроллера и действия, класс и метод контроллера, HTTP-метод, input/output, опции действия) уходит в метод через контейнер: по типу или по именам $version, $controllerKey, $actionKey, $httpMethod. Метод без этих параметров вызывается как раньше. - `[method]` может вернуть JSON Schema объекта — с ограничениями, nullable, enum; сливается с остальными @input (POST — JSON-тело, GET — query). - `@output [method]` с тем же контекстом. - `$tags[]` без потомка — массив скаляров. - Вложенная нотация сохраняет required; корень, объявленный после детей, их не затирает; вложенный @output не теряет плоских соседей. - Линтер: input.undeclared — метод валидирует вход и не объявляет @input. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2 of 3 tasks
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
One controller method may serve many routes: a generic CRUD controller is registered under a controller key per entity, and the fields an action accepts depend on the entity.
@input [method]called the method with no arguments, so it could not answer for a particular route — in practice the operation documented no fields at all.OperationContext(Dskripchenko\LaravelApi\Services\OpenApi\OperationContext): version, Api class, controller key, action key, controller class/method, HTTP verb,input/output, the action's options. Passed through the container: declare a parameter typedOperationContext(any name) or any of$version,$controllerKey,$actionKey,$httpMethod. Methods that declare none of them are called exactly as before — backward compatible.[method]may return a JSON Schema object instead of docblock lines; it goes into the spec as is (constraints,nullable,enum, nesteditems) and is merged with the other@inputlines (requiredlists united). POST → JSON body; GET → one query parameter per top-level property.@output [method]with the same context and return forms.$tags[]with no child describes a list of scalars.requiredis kept at every level; a root declared after its children no longer wipes them; nested@outputno longer drops flat siblings.input.undeclared(warning): the method visibly validates input (validate(),Validator::make(),validator(), aFormRequestparameter) while its docblock declares no@input. Scoped to validating methods so actions that take nothing are not reported.Docs: README,
docs/{en,ru,de,zh}/docblock-tags.mdandlinting.md. CHANGELOG under[Unreleased]— intended as 5.11.0 (minor).Consumer: dskripchenko/laravel-admin needs this release to describe per-resource
create/update/action/… inputs.Test plan
vendor/bin/pest— 453 passed (17 new: operation context per controller key, schema pass-through and merge, GET → query params,@output [method], legacy no-arg callables unchanged, scalar binding by name/type, nested required/order/scalar arrays/output siblings,input.undeclaredpositives and negatives)🤖 Generated with Claude Code