Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
rubenvdlinde committed Jan 14, 2020
2 parents b734bb1 + 8105549 commit 5f75498
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 12 deletions.
2 changes: 1 addition & 1 deletion .env
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ NOTIFICATION_ENABLED_AUTHORIZATION=sasd

AUTH_ENABLED=false
AUTH_PROVIDER=sasdadad
AUTH_AUTHORIZATION=sasd
AUTH_AUTHORIZATION=sasdfdsag

##################################################
# Auditrail settings
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: "irc.zaakonline.nl"
isBasedOn: "https://github.com/ConductionNL/Proto-component-commonground.git"
softwareVersion: "V.0.1"
releaseDate: "2020-07-01"
releaseDate: "2020-09-01"
logo: irc.zaakonline.nl
monochromeLogo: img/logo-mono.svg

Expand Down
5 changes: 5 additions & 0 deletions api/src/Entity/Assent.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@
use Symfony\Component\Validator\Constraints as Assert;

/**
* An assent registers if assents are given for mutations that require one
*
* @author Ruben van der Linde <[email protected]>
* @license EUPL <https://github.com/ConductionNL/contactcatalogus/blob/master/LICENSE.md>
*
* @ApiResource(
* normalizationContext={"groups"={"read"}, "enable_max_depth"=true},
* denormalizationContext={"groups"={"write"}, "enable_max_depth"=true}
Expand Down
53 changes: 43 additions & 10 deletions api/src/Swagger/SwaggerDecorator.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@ final class SwaggerDecorator implements NormalizerInterface
private $camelCaseToSnakeCaseNameConverter;

public function __construct(
NormalizerInterface $decorated,
ParameterBagInterface $params,
CacheInterface $cache,
EntityManagerInterface $em,
AnnotationReader $annotationReader,
CamelCaseToSnakeCaseNameConverter $camelCaseToSnakeCaseNameConverter
) {
NormalizerInterface $decorated,
ParameterBagInterface $params,
CacheInterface $cache,
EntityManagerInterface $em,
AnnotationReader $annotationReader,
CamelCaseToSnakeCaseNameConverter $camelCaseToSnakeCaseNameConverter
) {
$this->decorated = $decorated;
$this->params = $params;
$this->cash = $cache;
Expand Down Expand Up @@ -114,7 +114,7 @@ public function normalize($object, $format = null, array $context = [])
//$additionalEntityDocs = $this->getAdditionalEntityDocs($entity);
$entityDocs = $this->getAdditionalEntityDocs($entity);
// Only run if we have aditional docs
if (array_key_exists('properties', $entityDocs)) {
if(array_key_exists('properties',$entityDocs)){
$additionalDocs = array_merge($additionalDocs, $entityDocs['properties']);
}

Expand Down Expand Up @@ -418,13 +418,20 @@ private function getAdditionalEntityDocs($entity)
$atributes = [];
$groups = [];


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

switch ($name) {

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

break;

// Docblocks
case 'example':
$atributes['example'] = (string) $description;
Expand All @@ -437,22 +444,48 @@ private function getAdditionalEntityDocs($entity)
break;

// 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 5f75498

Please sign in to comment.