diff --git a/.gitignore b/.gitignore index c4dd0691..baa17284 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,5 @@ api/helm/kubeconfig.yaml !/api/public/bundle/* + +.idea/ diff --git a/api/src/Entity/Property.php b/api/src/Entity/Property.php index a1fc67f1..02c84a65 100644 --- a/api/src/Entity/Property.php +++ b/api/src/Entity/Property.php @@ -10,6 +10,7 @@ use Doctrine\Common\Collections\Collection; use Gedmo\Mapping\Annotation as Gedmo; use Doctrine\ORM\Mapping as ORM; +use Ramsey\Uuid\UuidInterface; use Symfony\Component\Serializer\Annotation\Groups; use Symfony\Component\Validator\Constraints as Assert; use Symfony\Component\Serializer\Annotation\MaxDepth; @@ -19,10 +20,10 @@ /** * This property follows the following schemes (in order of importance) - * https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.2.md + * https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.2.md * https://tools.ietf.org/html/draft-wright-json-schema-validation-00 * http://json-schema.org/ - * + * * @ApiResource( * normalizationContext={"groups"={"read"}, "enable_max_depth"=true}, * denormalizationContext={"groups"={"write"}, "enable_max_depth"=true} @@ -32,7 +33,7 @@ class Property { /** - * @var \Ramsey\Uuid\UuidInterface $id The UUID identifier of this object + * @var UuidInterface $id The UUID identifier of this object * @example e2984465-190a-4562-829e-a8cca81aa35d * * @ApiProperty( @@ -57,15 +58,16 @@ class Property /** * @var Object $requestType The requestType that this property belongs to - * + * * @Assert\NotBlank + * @Assert\Valid * @MaxDepth(1) * @Groups({"read", "write"}) * @ORM\ManyToOne(targetEntity="App\Entity\RequestType", inversedBy="properties",cascade={"persist"}) * @ORM\JoinColumn(nullable=false) */ - private $requestType; - + private $requestType; + /** * @var string $title The title of this property * @example My Property @@ -77,7 +79,7 @@ class Property * "description" = "The title of this property", * "type"="string", * "example"="My Property", - * "maxLength"="15", + * "minLength"="15", * "maxLength"="255", * "required" = true * } @@ -89,7 +91,7 @@ class Property * @ORM\Column(type="string", length=255) */ private $title; - + /** * * @var string $name The name of the property as used in api calls, extracted from title on snake_case basis * @example my_property @@ -101,17 +103,18 @@ class Property * "description" = "The name of the property as used in api calls, extracted from title on snake_case basis", * "type"="string", * "example"="my_property", - * "maxLength"="15", + * "minLength"="15", * "maxLength"="255", * "required" = true * } * } * ) + * @Assert\Length(min = 15, max = 255) * @Groups({"read"}) */ private $name; - - /** + + /** * @var string $type The type of this property * @example string * @@ -134,9 +137,9 @@ class Property * @Groups({"read", "write"}) * @ORM\Column(type="string", length=255) */ - private $type; - - /** + private $type; + + /** * @var string $type The swagger type of the property as used in api calls * @example string * @@ -152,7 +155,7 @@ class Property * } * } * ) - * + * * @Assert\NotBlank * @Assert\Length(max = 255) * @Assert\Choice({"int32","int64","float","double","byte","binary","date","date-time","duration","password","boolean","string","uuid","uri","email","rsin","bag","bsn","iban","challenge","service","assent"}) @@ -162,7 +165,7 @@ class Property private $format; /** - * @var string $multipleOf *Can only be used in combination with type integer* Specifies a number where the value should be a multiple of, e.g. a multiple of 2 would validate 2,4 and 6 but would prevent 5 + * @var string $multipleOf *Can only be used in combination with type integer* Specifies a number where the value should be a multiple of, e.g. a multiple of 2 would validate 2,4 and 6 but would prevent 5 * @example 2 * * @ApiProperty( @@ -175,7 +178,7 @@ class Property * } * } * ) - * + * * @Assert\Type("integer") * @Groups({"read", "write"}) * @ORM\Column(type="integer", nullable=true) @@ -183,7 +186,7 @@ class Property private $multipleOf; /** - * @var string $multipleOf *Can only be used in combination with type integer* The maximum allowed value + * @var string $multipleOf *Can only be used in combination with type integer* The maximum allowed value * @example 2 * * @ApiProperty( @@ -196,7 +199,7 @@ class Property * } * } * ) - * + * * @Assert\Type("integer") * @Groups({"read", "write"}) * @ORM\Column(type="integer", nullable=true) @@ -216,7 +219,7 @@ class Property * } * } * ) - * + * * @Assert\Type("bool") * @Groups({"read", "write"}) * @ORM\Column(type="boolean", nullable=true) @@ -224,7 +227,7 @@ class Property private $exclusiveMaximum; /** - * @var string $minimum *Can only be used in combination with type integer* The minimum allowed value + * @var string $minimum *Can only be used in combination with type integer* The minimum allowed value * @example 2 * * @ApiProperty( @@ -237,7 +240,7 @@ class Property * } * } * ) - * + * * @Assert\Type("integer") * @Groups({"read", "write"}) * @ORM\Column(type="integer", nullable=true) @@ -245,7 +248,7 @@ class Property private $minimum; /** - * + * * @var string $exclusiveMinimum *Can only be used in combination with type integer* Defines if the minimum is exclusive, e.g. a exclusive minimum of 5 would invalidate 5 but validate 6 * @example true * @@ -258,7 +261,7 @@ class Property * } * } * ) - * + * * @Assert\Type("bool") * @Groups({"read", "write"}) * @ORM\Column(type="boolean", nullable=true) @@ -266,7 +269,7 @@ class Property private $exclusiveMinimum; /** - * @var string $maxLength The maximum amount of characters in the value + * @var string $maxLength The maximum amount of characters in the value * @example 2 * * @ApiProperty( @@ -278,7 +281,7 @@ class Property * } * } * ) - * + * * @Assert\Type("integer") * @Groups({"read", "write"}) * @ORM\Column(type="integer", nullable=true) @@ -298,7 +301,7 @@ class Property * } * } * ) - * + * * @Assert\Type("integer") * @Groups({"read", "write"}) * @ORM\Column(type="integer", nullable=true) @@ -319,7 +322,7 @@ class Property * } * } * ) - * + * * @Assert\Length(max = 255) * @Groups({"read", "write"}) * @ORM\Column(type="string", length=255, nullable=true) @@ -328,14 +331,14 @@ class Property /** * Not yet supported by business logic - * + * * @ORM\ManyToMany(targetEntity="App\Entity\Property") */ private $items; /** * Not yet supported by business logic - * + * * @Assert\Type("bool") * @Groups({"read", "write"}) * @ORM\Column(type="boolean", nullable=true) @@ -343,7 +346,7 @@ class Property private $additionalItems; /** - * @var string $maxItems *Can only be used in combination with type array* The maximum array length + * @var string $maxItems *Can only be used in combination with type array* The maximum array length * @example 2 * * @ApiProperty( @@ -356,7 +359,7 @@ class Property * } * } * ) - * + * * @Assert\Type("integer") * @Groups({"read", "write"}) * @ORM\Column(type="integer", nullable=true) @@ -364,7 +367,7 @@ class Property private $maxItems; /** - * @var string $minItems *Can only be used in combination with type array* The minimum allowed value + * @var string $minItems *Can only be used in combination with type array* The minimum allowed value * @example 2 * * @ApiProperty( @@ -377,7 +380,7 @@ class Property * } * } * ) - * + * * @Assert\Type("integer") * @Groups({"read", "write"}) * @ORM\Column(type="integer", nullable=true) @@ -397,7 +400,7 @@ class Property * } * } * ) - * + * * @Assert\Type("bool") * @Groups({"read", "write"}) * @ORM\Column(type="boolean", nullable=true) @@ -405,7 +408,7 @@ class Property private $uniqueItems; /** - * @var string $maxProperties *Can only be used in combination with type integer* The maximum amount of properties an object should contain + * @var string $maxProperties *Can only be used in combination with type integer* The maximum amount of properties an object should contain * @example 2 * * @ApiProperty( @@ -418,7 +421,7 @@ class Property * } * } * ) - * + * * @Assert\Type("integer") * @Groups({"read", "write"}) * @ORM\Column(type="integer", nullable=true) @@ -439,7 +442,7 @@ class Property * } * } * ) - * + * * @Assert\Type("integer") * @Groups({"read", "write"}) * @ORM\Column(type="integer", nullable=true) @@ -459,7 +462,7 @@ class Property * } * } * ) - * + * * @Assert\Type("bool") * @Groups({"read", "write"}) * @ORM\Column(type="boolean", nullable=true) @@ -468,7 +471,7 @@ class Property /** * Not yet supported by business logic - * + * * @Groups({"read", "write"}) * @ORM\Column(type="object", nullable=true) */ @@ -476,7 +479,7 @@ class Property /** * Not yet supported by business logic - * + * * @Groups({"read", "write"}) * @ORM\Column(type="object", nullable=true) */ @@ -484,7 +487,7 @@ class Property /** * Not yet supported by business logic - * + * * @Groups({"read", "write"}) * @ORM\Column(type="object", nullable=true) */ @@ -503,7 +506,7 @@ class Property * } * } * ) - * + * * @Groups({"read", "write"}) * @ORM\Column(type="array", nullable=true) */ @@ -522,7 +525,7 @@ class Property * } * } * ) - * + * * @ORM\Column(type="array", nullable=true) */ private $allOf = []; @@ -540,7 +543,7 @@ class Property * } * } * ) - * + * * @ORM\Column(type="array", nullable=true) */ private $anyOf = []; @@ -558,14 +561,14 @@ class Property * } * } * ) - * + * * @ORM\Column(type="array", nullable=true) */ private $oneOf = []; /** * Not yet supported by business logic - * + * * @ORM\Column(type="object", nullable=true) */ private $definitions; @@ -584,7 +587,7 @@ class Property * } * } * ) - * + * * @Groups({"read", "write"}) * @ORM\Column(type="text", nullable=true) */ @@ -604,7 +607,7 @@ class Property * } * } * ) - * + * * @Assert\Length(max = 255) * @Groups({"read", "write"}) * @ORM\Column(type="string", length=255, nullable=true) @@ -625,7 +628,7 @@ class Property * } * } * ) - * + * * @Assert\Type("bool") * @Groups({"read", "write"}) * @ORM\Column(type="boolean", nullable=true) @@ -646,7 +649,7 @@ class Property * } * } * ) - * + * * @Assert\Length(max = 255) * @Groups({"read", "write"}) * @ORM\Column(type="string", length=255, nullable=true) @@ -666,7 +669,7 @@ class Property * } * } * ) - * + * * @Assert\Type("bool") * @Groups({"read", "write"}) * @ORM\Column(type="boolean", nullable=true) @@ -686,7 +689,7 @@ class Property * } * } * ) - * + * * @Assert\Type("bool") * @Groups({"read", "write"}) * @ORM\Column(type="boolean", nullable=true) @@ -708,7 +711,7 @@ class Property * } * } * ) - * + * * @Groups({"read", "write"}) * @ORM\Column(type="text", nullable=true) */ @@ -729,7 +732,7 @@ class Property * } * } * ) - * + * * @Assert\Length(max = 255) * @Groups({"read", "write"}) * @ORM\Column(type="string", length=255, nullable=true) @@ -750,7 +753,7 @@ class Property * } * } * ) - * + * * @Assert\Length(max = 255) * @Groups({"read", "write"}) * @ORM\Column(type="string", length=255, nullable=true) @@ -770,7 +773,7 @@ class Property * } * } * ) - * + * * @Assert\Type("bool") * @Groups({"read", "write"}) * @ORM\Column(type="boolean", nullable=true) @@ -791,7 +794,7 @@ class Property * } * } * ) - * + * * @Groups({"read", "write"}) * @Assert\DateTime * @ORM\Column(type="datetime", nullable=true) @@ -812,7 +815,7 @@ class Property * } * } * ) - * + * * @Groups({"read", "write"}) * @Assert\DateTime * @ORM\Column(type="datetime", nullable=true) @@ -833,7 +836,7 @@ class Property * } * } * ) - * + * * @Groups({"read", "write"}) * @ORM\Column(type="string", length=255, nullable=true) */ @@ -853,7 +856,7 @@ class Property * } * } * ) - * + * * @Groups({"read", "write"}) * @ORM\Column(type="string", length=255, nullable=true) */ @@ -868,11 +871,11 @@ public function getId() { return $this->id; } - + public function setId(string $id): self { $this->id = $id; - + return $this; } @@ -894,12 +897,12 @@ public function getTitle(): ?string } public function setTitle(string $title): self - { + { $this->title = $title; return $this; } - + public function getName(): ?string { // titles wil be used as strings so lets convert the to camelcase @@ -907,7 +910,7 @@ public function getName(): ?string $string = trim($string); //removes whitespace at begin and ending $string = preg_replace('/\s+/', '_', $string); // replaces other whitespaces with _ $string = strtolower($string); - + return $string; } diff --git a/api/src/Entity/RequestType.php b/api/src/Entity/RequestType.php index bbebd23c..314944ba 100644 --- a/api/src/Entity/RequestType.php +++ b/api/src/Entity/RequestType.php @@ -16,7 +16,7 @@ use Symfony\Component\Serializer\Annotation\MaxDepth; /** - * @ApiResource( + * @ApiResource( * normalizationContext={"groups"={"read"}, "enable_max_depth"=true}, * denormalizationContext={"groups"={"write"}, "enable_max_depth"=true}, * collectionOperations={ @@ -35,7 +35,7 @@ * "type" : "boolean" * } * } - * } + * } * }, * "put", * "delete" @@ -72,7 +72,7 @@ class RequestType /** * @var string $sourceOrganization The RSIN of the organization that owns this process * @example 002851234 - * + * * @ApiProperty( * attributes={ * "swagger_context"={ @@ -83,7 +83,7 @@ class RequestType * } * } * ) - * + * * @Assert\NotNull * @Assert\Length( * min = 8, @@ -111,7 +111,7 @@ class RequestType * } * } * ) - * + * * @Assert\NotNull * @Assert\Length( * max = 255 @@ -136,7 +136,7 @@ class RequestType * } * } * ) - * + * * @Assert\Length( * max = 2550 * ) @@ -149,12 +149,13 @@ class RequestType * @Groups({"read", "write"}) * @MaxDepth(1) * @ORM\OneToMany(targetEntity="App\Entity\Property", mappedBy="requestType", orphanRemoval=true, fetch="EAGER", cascade={"persist"}) + * @Assert\Valid */ private $properties; /** * @var object $extends The requestType that this requestType extends - * + * * @Groups({"write-requesttype"}) * @ORM\ManyToOne(targetEntity="App\Entity\RequestType", inversedBy="extendedBy", fetch="EAGER") */ @@ -162,7 +163,7 @@ class RequestType /** * @var object $extendedBy The requestTypes that extend this requestType - * + * * @ORM\OneToMany(targetEntity="App\Entity\RequestType", mappedBy="extends") */ private $extendedBy; @@ -188,11 +189,11 @@ public function getId() { return $this->id; } - + public function setId(string $id): self { $this->id = $id; - + return $this; } @@ -249,7 +250,7 @@ public function addProperty(Property $property): self return $this; } - + /* * Used for soft adding properties for the extension functionality */ @@ -258,7 +259,7 @@ public function extendProperty(Property $property): self if (!$this->properties->contains($property)) { $this->properties[] = $property; } - + return $this; }