Skip to content
This repository has been archived by the owner on May 8, 2024. It is now read-only.

Commit

Permalink
Merge pull request #319 from Azure/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
katmsft authored Oct 8, 2021
2 parents 2930b73 + d3f85a2 commit 0539ffb
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,8 @@ private function parseOneEntity($rawEntity)
$edmType;
if (array_key_exists($key . Resources::JSON_ODATA_TYPE_SUFFIX, $rawEntity)) {
$edmType = $rawEntity[$key . Resources::JSON_ODATA_TYPE_SUFFIX];
} elseif (in_array($key, [Resources::JSON_PARTITION_KEY, Resources::JSON_ROW_KEY], true)) {
$edmType = EdmType::STRING;
} else {
// Guess the property type
$edmType = EdmType::propertyType($value);
Expand Down
22 changes: 22 additions & 0 deletions tests/Unit/Table/Internal/JsonODataReaderWriterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,28 @@ public function testParseEntity()
}
}


public function testParseEntityStringKeys()
{
// Setup
$serializer = new JsonODataReaderWriter();
$expected = TestResources::getExpectedTestEntity('0e123', '123e456');
$json = TestResources::getEntityMinimalMetaResult('0e123', '123e456');

// Test
$actual = $serializer->parseEntity($json);

// Assert
$this->assertSame(
$expected->getPartitionKey(),
$actual->getPartitionKey()
);
$this->assertSame(
$expected->getRowKey(),
$actual->getRowKey()
);
}

public function testParseEntities()
{
// Setup
Expand Down

0 comments on commit 0539ffb

Please sign in to comment.