-
Notifications
You must be signed in to change notification settings - Fork 933
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Parent attributes have missing named parameters #1036
Comments
I'll need to go through this list in more details but it is quite possible that there are named parameters missing. I didn't take a very structured approach adding them... Happy to add missing ones.
Yes, that should be ok.
This is new to me. Certainly will look into that. Documentation definitely needs some more love too :) Help / PRs are definitely welcome. |
Have a look at #1037 - there are still some pure JSON schema related properties missing, but at least it will be easy to add those if needed in all the right places. $ref is now I've also updated some of the tests adding a couple of your example attributes :) |
Had some time to try it today, had an issue with the missing ref for the Response, but I see that was fixed (pending release), other than that it seems OK, kudos! An issue I have, is I cant update because |
There is work being done to support V4 I think: nelmio/NelmioApiDocBundle#1916 |
Annotations worked better than attributes in this regard, the extended properties were autocompleted and worked (they were public properties).
Since attributes are more strict, they dont inherit the extended class properties (it's in the constructor, so it doesnt work in the same way)
An example would be
Property extends Schema
Right now
Property
has these named argumentsAnd
Schema
has theseAs you can see enum is not present in the
Property
constructor, so you have to use the properties array#[OA\Property(properties: ['enum' => 'foo'])]
which kind of defeats the purpose, since we dont have autocomplete anymoreBut
Schema
has more properties which are not added in its constructor (and some in theProperty
constructor)maximum
,minimum
,minItems
to name a few.The only way I see that can be working with autocomplete, is every class has all its named attributes, and the class that extends that one should have all the parents named arguments + the ones that it declares (that is a lot of copy and paste for each class that extends Schema for example, if it declares new properties, a simple extend would not require it)
Another thing to consider, would be to allow
$ref
to pass non strings (in the named parameters)With annotations we were able to pass a NelmioApiDocBundle
@Model
to the refRight now for attributes we have to trick it in using the properties with the
ref
indexWhere it could be
Which again loses the autocomplete which the annotations had
Another another thing, would be to allow to pass objects in the properties array without an index
Before
After
For this to work, a small
is_string($property)
check is needed in theAbstractAnnotation::__construct
The
JsonContent
actually expects the properties to be of timeProperty
as per the nestedProperty::class => ['properties', 'property'],
also theproperty
named argument is missingThoughts?
I'm not bashing on the library, its a great one which could be even greater.
I'm happy to work on these changes, but want to see if you're ok with going in this direction before I do it.
The text was updated successfully, but these errors were encountered: