-
Notifications
You must be signed in to change notification settings - Fork 827
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
Read @Assert annotations to determine required fields #125
Comments
Saying that the column is nullable in the database doesn't mean your API expects a value. You should use a Form to manage your incoming data. What should be done is a Parser for the validation layer (your |
Good point. I had not thought of it that way. I've revised the title of this issue to reflect that |
+1 for reading |
I agree with @willdurand . |
👍 |
1 similar comment
+1 |
It's marked as "Easy Pick", dear upvoters, who wants to work on this? |
For output data would be useful. I have the following attribute: At the moment I am writing the max and min in the description, but would be great if this information could be fetched from Assert |
anyone willing to write a PR? |
Looks like it's working now ? |
Confirmed, We use @Assert at entity level, and the docs are pulling that through. The only problem I can see is that it doesn't support validation groups. |
The Nelmio\ApiDocBundle\Parser\ValidationParser is taking care of the @Assert annotations, but does not consider the groups defined in it. The problem of not supporting validation groups is that validations that are only part of a specific group, are handled as if they are in the Default group. Excluding them would be a better (not final) solution. The Nelmio\ApiDocBundle\Parser\JmsMetadataParser consider the @jms\Serializer\Annotation\JMS\Groups annotation. Does anyone knows how to solve it? |
version 3 is a complete rewrite. please check if this is still a problem with version 3 and a recent symfony version. |
Suppose you use an entity for your input class, it would be nice if the "required" flag on the documentation would read from the @Orm annotation. For example, I have a property like the following:
It would be really nice if the "nullable" attribute was read. I could also see the "Assert\NotBlank()" doing this. If we had a way to utilize the "Assert\Choice" list that would be especially nice.
I didn't see a way to set the description for input parameters using an entity with JMS.
The text was updated successfully, but these errors were encountered: