Comments (5)
I can confirm that. There is also another thing : if an option is required but does not have a default value.
from nelmioapidocbundle.
Tagged as "enhancement", feel free to work on it :)
from nelmioapidocbundle.
Small work on this task : doc is empty because the formType cannot be created. This is because when you use dataTransformers, you have to extend setDefaultOptions() and require an option 'em' as ObjectManager.
NelmioDocType does not pass it at creation, and silently dropped the error (better have an empty doc for this form, than no doc at all).
So this works:
public function setDefaultOptions(OptionsResolverInterface $resolver)
{
$resolver->setDefaults(array(
'data_class' => 'My\APIBundle\Entity\User',
'csrf_protection' => false,
));
}
And this does not :
public function setDefaultOptions(OptionsResolverInterface $resolver)
{
$resolver->setDefaults(array(
'data_class' => 'My\APIBundle\Entity\User',
'csrf_protection' => false,
))
->setRequired(array(
'em'
))
->setAllowedTypes(array(
'em' => 'Doctrine\Common\Persistence\ObjectManager',
))
;
}
So to support DataTransformer, I think we need to modify Parser/FormTypeParser.php
from nelmioapidocbundle.
Hi guys, I've faced the same problem. But looking at how ApiDoc bundle works for few minutes I've found a solution for my case! Here it is:
- First, define your form as service, it is pretty easy, suppose it is "form_alias_you_defined"
- Inject needed services to form (ex. EntityManager)
- Use your form name in ApiDoc instead of form class like this:
/**
* ...
* input = "form_alias_you_defined"
*/
Profit!
Also don't forget to read official documentation with usefull tips, like passing method (GET, POST, etc).
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)
- [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
- [Bug]: explicit setting of default value in Property causes error "Multiple definitions for [property]" HOT 1
- [Feature]: Create top level OpenApi Tag when processing Tag annotation
- [Bug]: Upgrading v4.29.1 -> v4.29.2 breaks documentation rendering HOT 4
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.