Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/JsonApi/JsonSchema/SchemaFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ public function buildSchema(string $className, string $format = 'jsonapi', strin
'items' => [
'allOf' => [
['$ref' => $prefix.$key],
['type' => 'object', 'properties' => ['source' => ['type' => 'object'], 'status' => ['type' => 'string']]],
['type' => 'object', 'properties' => ['source' => ['type' => 'object'], 'status' => ['type' => ['string', 'integer', 'null']]]],
],
],
],
Expand Down
2 changes: 1 addition & 1 deletion src/State/ApiResource/Error.php
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ public function __construct(
identifier: true,
writable: false,
initializable: false,
schema: ['type' => ['number', 'null'], 'examples' => [404], 'default' => 400]
schema: ['type' => ['integer', 'null'], 'examples' => [404], 'default' => 400]
)] private ?int $status,
?array $originalTrace = null,
private ?string $instance = null,
Expand Down
2 changes: 1 addition & 1 deletion tests/Fixtures/TestBundle/Entity/Issue5793/BagOfTests.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class BagOfTests
#[Groups(['read', 'write'])]
// ignore "type" schema property to ensure "schema" is properly overridden
// see JsonSchemaGenerateCommandTest::testArraySchemaWithReference
#[ApiProperty(schema: ['maxLength' => 255])]
#[ApiProperty(schema: ['type' => 'string', 'maxLength' => 255])]
private ?string $description = null;

#[ORM\OneToMany(mappedBy: 'bagOfTests', targetEntity: TestEntity::class)]
Expand Down
1 change: 1 addition & 0 deletions tests/Functional/JsonSchema/JsonLdJsonSchemaTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ public function testSubSchemaJsonLd(): void
'readOnly' => true,
]),
'description' => new \ArrayObject([
'type' => 'string',
'maxLength' => 255,
]),
'tests' => new \ArrayObject([
Expand Down
1 change: 1 addition & 0 deletions tests/Functional/JsonSchema/JsonSchemaTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ public function testArraySchemaWithReference(): void
]));

$this->assertEquals($schema['definitions']['BagOfTests-write']['properties']['description'], new \ArrayObject([
'type' => 'string',
'maxLength' => 255,
]));

Expand Down
8 changes: 6 additions & 2 deletions tests/Functional/OpenApiTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ public function testErrorsAreDocumented(): void
],
'status' => [
'type' => [
'number',
'integer',
'null',
],
'examples' => [
Expand Down Expand Up @@ -202,7 +202,11 @@ public function testErrorsAreDocumented(): void
'type' => 'object',
],
'status' => [
'type' => 'string',
'type' => [
'string',
'integer',
'null',
],
],
]],
]], $res['components']['schemas']['Error.jsonapi']['properties']['errors']['items']);
Expand Down
Loading