-
Notifications
You must be signed in to change notification settings - Fork 941
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
allOf/anyOf/etc. in PHP Attributes #1022
Comments
All the properties are still the same. In your attribute you've used |
@DerManoMann Turns out that's not exactly true, as things are moved around when using annotations. For example, the name of a parameter is now being used to determine its ref path, not the
Also, I figured out how to do the "anyOf" thing, and it's a bit more complicated than I expected: <?php
#[
OA\Parameter(
name: "station_id_required",
in: "path",
required: true,
schema: new OA\Schema(
properties: [
'anyOf' => [
new OA\Schema(type: "integer", format: "int64"),
new OA\Schema(type: "string", format: "string")
]
]
),
)
] |
Sounds like a bug to me :) |
@SlvrEagle23 Could you please try the PR and see if that fixes things? |
@DerManoMann Testing with the latest dev-master and discovering that now there is no official way to specify How would I accomplish what I was trying to do above? Basically, the given parameter can be AnyOf a string or an integer. |
As frustrating as it is, basically it appears that every single possible parameter that could be passed to a property has to be specified in its constructor, and just having it as a public property isn't sufficient for IDEs not to have a fit. |
Ah, this might be a merge issue. Certainly those should be there... |
Pretty much all named parameters should now be available |
@DerManoMann Playing with it locally and it's working wonderfully, basically as a drop-in replacement for the annotations at this point. Thank you for your hard work on this, it really makes our code look great when everything's in the attributes! |
Thanks. Glad you like it. |
@DerManoMann One thing I noticed: |
@DerManoMann Also noticing |
@DerManoMann I'm back on the dev-master branch to play with the latest changes and with |
I think that might be correct; at least the response parameter is required as it is the key (status code or |
@DerManoMann Looking through the spec document, it would appear all you need is the name and the |
The name? How would that look in yaml? |
@DerManoMann Sorry, by the response's "name" I mean the |
Hey all! I've scoured the documentation and I really can't find out the recommended way of implementing something like this:
into PHP attributes.
The closest I've been able to come so far is:
But I'm not sure how to express the "anyOf" value for the parameter using the attributes. Nothing I'm trying is validating properly. Any ideas?
The text was updated successfully, but these errors were encountered: