Skip to content

Commit

Permalink
Merge branch 'master' into development
Browse files Browse the repository at this point in the history
  • Loading branch information
rubenvdlinde committed Jan 13, 2020
2 parents f9f1832 + 9b263de commit b15a4d4
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 8 deletions.
1 change: 0 additions & 1 deletion .env
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ APP_BUILD=dev
# The description for this api
APP_DESCRIPTION='Naast deze JSON rest API is er ook een [graphql](/graphql) interface beschikbaar.'


APP_LOGO=pc.zaakonline.nl
APP_HOME=pc.zaakonline.nl

Expand Down
2 changes: 1 addition & 1 deletion api/public/schema/publiccode.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ url: "https://github.com/ConductionNL/Proto-component-commonground"
landingURL: "pc.zaakonline.nl"
isBasedOn: "https://github.com/ConductionNL/Proto-component-commonground.git"
softwareVersion: "V.0.1"
releaseDate: "2020-06-01"
releaseDate: "2020-13-01"
logo: pc.zaakonline.nl
monochromeLogo: img/logo-mono.svg

Expand Down
2 changes: 1 addition & 1 deletion api/src/Entity/ExampleEntity.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
class ExampleEntity
{
/**
* @var \Ramsey\Uuid\UuidInterface
* @var \Ramsey\Uuid\UuidInterface The id of this entity
*
* @example e2984465-190a-4562-829e-a8cca81aa35d
*
Expand Down
43 changes: 38 additions & 5 deletions api/src/Swagger/SwaggerDecorator.php
Original file line number Diff line number Diff line change
Expand Up @@ -416,15 +416,22 @@ private function getAdditionalEntityDocs($entity)
$docblock = $factory->create($property->getDocComment());
$tags = $docblock->getTags();
$atributes = [];
$groups = [];
$groups = [];


foreach ($tags as $tag) {
$name = $tag->getName();
$description = $tag->getDescription();
//
//$description = (string) $description;
$description = $tag->getDescription();

switch ($name) {

// Description
case 'var':
$atributes['description'] = (string) $description;
$atributes['type'] = (string) $tag->getType();

break;

// Docblocks
case 'example':
$atributes['example'] = (string) $description;
Expand All @@ -436,23 +443,49 @@ private function getAdditionalEntityDocs($entity)
$groups = $propertyAnnotation->getGroups();
break;

// Constrainds (Validation)
// Constrainds (Validation)
case "Assert\Date":
$atributes['type'] = "string";
$atributes['format'] = 'date';
$atributes['example'] = \date('Y-m-d');
break;
case "Assert\DateTime":
$atributes['type'] = "string";
$atributes['format'] = 'date-time';
$atributes['example'] = \date('Y-m-d H:i:s');
break;
case "Assert\Time":
$atributes['type'] = "string";
$atributes['format'] = 'time';
$atributes['example'] = \date('H:i:s');
break;
case "Assert\Timezone":
$atributes['type'] = "string";
$atributes['format'] = 'timezone';
$atributes['example'] = 'America/New_York';
break;
case "Assert\Uuid":
$atributes['type'] = "string";
$atributes['format'] = 'uuid';
break;
case "Assert\Email":
$atributes['type'] = "string";
$atributes['format'] = 'email';
break;
case "Assert\Url":
$atributes['type'] = "string";
$atributes['format'] = 'url';
break;
case "Assert\Regex":
$atributes['type'] = "string";
$atributes['format'] = 'regex';
break;
case "Assert\Ip":
$atributes['type'] = "string";
$atributes['format'] = 'ip';
break;
case "Assert\Json":
$atributes['type'] = "string";
$atributes['format'] = 'json';
break;
case "Assert\Choice":
Expand Down

0 comments on commit b15a4d4

Please sign in to comment.