Comments (13)
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 Assert
annotations), but not for the ORM part.
from nelmioapidocbundle.
Good point. I had not thought of it that way. I've revised the title of this issue to reflect that Assert
should be parsed. I presume this would be an enhancement. I'm happy to help on this. Any pointers where I would start to put something like this together?
from nelmioapidocbundle.
+1 for reading @Assert
annonation
from nelmioapidocbundle.
I agree with @willdurand .
from nelmioapidocbundle.
👍
from nelmioapidocbundle.
+1
from nelmioapidocbundle.
It's marked as "Easy Pick", dear upvoters, who wants to work on this?
from nelmioapidocbundle.
For output data would be useful.
I have the following attribute:
/**
* Application valoration from 0 to 5
* @Assert\Max(limit = 5)
* @Assert\Min(limit = 0)
* @jms\Type("double")
*/
private $valoration;
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
from nelmioapidocbundle.
anyone willing to write a PR?
from nelmioapidocbundle.
Looks like it's working now ?
from nelmioapidocbundle.
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.
from nelmioapidocbundle.
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.
The Nelmio\ApiDocBundle\Parser\ValidationParser does not consider Symfony asserts groups (@symfony\Component\Validator\Constraints\Assert) nor JMS groups (@jms\Serializer\Annotation\JMS\Groups).
Does anyone knows how to solve it?
from nelmioapidocbundle.
version 3 is a complete rewrite. please check if this is still a problem with version 3 and a recent symfony version.
from nelmioapidocbundle.
Related Issues (20)
- incorrect server url in openapi document when behind reverse proxy HOT 1
- [Bug]: Not all integer range types supported HOT 3
- [Bug]: Object of class Nelmio\ApiDocBundle\Annotation\Model could not be converted to string HOT 4
- [Bug]: Assert\NotBlank is considered regardless of it's group values HOT 1
- [Question]: Discriminator schema with Doctrine ORM Discriminator map HOT 2
- [Feature]: Webhook support
- [RFC]: Adopt Conventional Commits HOT 1
- [Question]: Is it possible to view a web form when mediaType is "application/json"? HOT 2
- [Feature]: FOSRestBundle QueryParam AND nelmio_api_doc.yaml
- [Feature]: FOSRestBundle QueryParam AND nelmio_api_doc.yaml
- [Bug]: @OA\Property excludes property from model's required array HOT 2
- [Bug]: Lost data format in schema for array of objects HOT 1
- [Feature]: Describing default error response
- [Question]: Code breaks after updating from 4.25.2 to 4.25.3 HOT 2
- [Bug]: Upgrade to 4.26.0 breaks phpunit-tests HOT 2
- [Bug]: Deprecation errors after updating to 4.26.1 HOT 4
- [Question]: Is there a way to override the documentation for a specific class/type? HOT 1
- [Bug]: Type required for oneOf defined property HOT 1
- [Question]: multiple allow_origin entries HOT 1
- [Bug]: The PropertyInfo component was not able to guess the type of Company::$edAt. You may need to add a `@var` annotation or use `@OA\Property(type="")` to make its type explicit HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nelmioapidocbundle.