Giter VIP home page Giter VIP logo

Comments (13)

willdurand avatar willdurand commented on May 20, 2024

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.

duanegran avatar duanegran commented on May 20, 2024

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.

fieg avatar fieg commented on May 20, 2024

+1 for reading @Assert annonation

from nelmioapidocbundle.

drgomesp avatar drgomesp commented on May 20, 2024

I agree with @willdurand .

from nelmioapidocbundle.

pkruithof avatar pkruithof commented on May 20, 2024

👍

from nelmioapidocbundle.

kallosz avatar kallosz commented on May 20, 2024

+1

from nelmioapidocbundle.

willdurand avatar willdurand commented on May 20, 2024

It's marked as "Easy Pick", dear upvoters, who wants to work on this?

from nelmioapidocbundle.

maxpowel avatar maxpowel commented on May 20, 2024

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.

willdurand avatar willdurand commented on May 20, 2024

anyone willing to write a PR?

from nelmioapidocbundle.

magnetik avatar magnetik commented on May 20, 2024

Looks like it's working now ?

from nelmioapidocbundle.

catchamonkey avatar catchamonkey commented on May 20, 2024

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.

sromano88 avatar sromano88 commented on May 20, 2024

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.

dbu avatar dbu commented on May 20, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.