Nelmioapidocbundle: Using `date-time` pattern

Created on 16 Apr 2018  路  1Comment  路  Source: nelmio/NelmioApiDocBundle

I'm trying to receive proper exmaple for \DateTime property: 2018-04-16 11:11:11 but I have: 2018-04-16T11:11:11.632Z. I know that SymfonyConstraintAnnotationReader is adding pattern for property but this does change nothing. I think better solution would be to set example for that property with given format instead of pattern. I've tested it and this working fine.

What is also important (see: https://github.com/swagger-api/swagger-editor/issues/1225#issuecomment-288286561) combaining format and pattern is not recommended and will not work.

Most helpful comment

Well you can do that by adding the following annotation to your property:

/**
 * @SWG\Property(example="2018-04-16 11:11:11")
 */
 private $date;

But I don't think we should add it automatically in the bundle since we don't know the actual format used by the user.

>All comments

Well you can do that by adding the following annotation to your property:

/**
 * @SWG\Property(example="2018-04-16 11:11:11")
 */
 private $date;

But I don't think we should add it automatically in the bundle since we don't know the actual format used by the user.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ganchito55 picture ganchito55  路  4Comments

kojidev picture kojidev  路  6Comments

DavidGarciaCat picture DavidGarciaCat  路  4Comments

andydandy80 picture andydandy80  路  4Comments

BraisGabin picture BraisGabin  路  7Comments