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)
- [Question]: Assert/Choice overrides enum HOT 1
- `OpenApi\Processors\ProcessorInterface` has been deprecated
- [Question]: GitHub Sponsors HOT 5
- [Bug]: Symfony 7.1 - MapRequestPayload resolves array with new "type" parameter
- [Bug]: UuidPropertyDescriber::describe()" method will require a new "array $context" argument in the next major version of its interface HOT 1
- [Question]: Why I cant see in swagger properties from model? HOT 5
- [Bug]: Not nullable with default are required HOT 3
- [Feature]: Easy way to ignore properties from schema generation without relying on Symfony's `#[Ignore]` attribute HOT 1
- [Feature]: Define "tags" list via attributes HOT 1
- [Bug]: tags within api definition are not unique HOT 1
- [Bug]: Using #[NotNull] / #[NotBlank] doesn't influence nullable HOT 1
- [Feature]: PHPDoc with union of constant strings could/should be considered an enum HOT 1
- [Question]: Is there a way to hide route by method ?
- Duplication of query parameter if it's a reference HOT 2
- Components `property` is ignored for `@OA\Property` HOT 4
- [Bug]: Documentation is deprecated HOT 4
- [Bug]: problem with traversables HOT 2
- The "Nelmio\ApiDocBundle\Processor\MapRequestPayloadProcessor" class implements "OpenApi\Processors\ProcessorInterface" that is deprecated[Bug]: HOT 4
- [Bug]: Bad generated json (or clients?) since upgrade from 4.12 HOT 2
- [Bug]: enum_exists(): Argument #1 ($enum) must be of type string, array given HOT 3
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.