diff --git a/src/ApiPlatform/AddDocumentedAPIPropertiesJSONSchemaFactory.php b/src/ApiPlatform/AddDocumentedAPIPropertiesJSONSchemaFactory.php index 98b92a41..c13af396 100644 --- a/src/ApiPlatform/AddDocumentedAPIPropertiesJSONSchemaFactory.php +++ b/src/ApiPlatform/AddDocumentedAPIPropertiesJSONSchemaFactory.php @@ -98,6 +98,8 @@ class AddDocumentedAPIPropertiesJSONSchemaFactory implements SchemaFactoryInterf $version = $schema->getVersion(); $swagger = Schema::VERSION_SWAGGER === $version; + $propertySchema = []; + if (false === $propertyMetadata->writeable) { $propertySchema['readOnly'] = true; } @@ -115,14 +117,14 @@ class AddDocumentedAPIPropertiesJSONSchemaFactory implements SchemaFactoryInterf $propertySchema['deprecated'] = true; } - if (!isset($propertySchema['default']) && !empty($default = $propertyMetadata->default)) { + if (!empty($default = $propertyMetadata->default)) { if ($default instanceof \BackedEnum) { $default = $default->value; } $propertySchema['default'] = $default; } - if (!isset($propertySchema['example']) && !empty($example = $propertyMetadata->example)) { + if (!empty($example = $propertyMetadata->example)) { $propertySchema['example'] = $example; } diff --git a/src/Entity/Parameters/AbstractParameter.php b/src/Entity/Parameters/AbstractParameter.php index b8b1e169..015e496d 100644 --- a/src/Entity/Parameters/AbstractParameter.php +++ b/src/Entity/Parameters/AbstractParameter.php @@ -191,7 +191,7 @@ abstract class AbstractParameter extends AbstractNamedDBElement * Return a formatted string version of the values of the string. * Based on the set values it can return something like this: 34 V (12 V ... 50 V) [Text]. */ - #[Groups('parameter:read', 'full')] + #[Groups(['parameter:read', 'full'])] #[SerializedName('formatted')] public function getFormattedValue(): string {