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

Commit 0539ffb

Browse files
authored
Merge pull request #319 from Azure/dev
Dev
2 parents 2930b73 + d3f85a2 commit 0539ffb

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

azure-storage-table/src/Table/Internal/JsonODataReaderWriter.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,8 @@ private function parseOneEntity($rawEntity)
202202
$edmType;
203203
if (array_key_exists($key . Resources::JSON_ODATA_TYPE_SUFFIX, $rawEntity)) {
204204
$edmType = $rawEntity[$key . Resources::JSON_ODATA_TYPE_SUFFIX];
205+
} elseif (in_array($key, [Resources::JSON_PARTITION_KEY, Resources::JSON_ROW_KEY], true)) {
206+
$edmType = EdmType::STRING;
205207
} else {
206208
// Guess the property type
207209
$edmType = EdmType::propertyType($value);

tests/Unit/Table/Internal/JsonODataReaderWriterTest.php

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,28 @@ public function testParseEntity()
135135
}
136136
}
137137

138+
139+
public function testParseEntityStringKeys()
140+
{
141+
// Setup
142+
$serializer = new JsonODataReaderWriter();
143+
$expected = TestResources::getExpectedTestEntity('0e123', '123e456');
144+
$json = TestResources::getEntityMinimalMetaResult('0e123', '123e456');
145+
146+
// Test
147+
$actual = $serializer->parseEntity($json);
148+
149+
// Assert
150+
$this->assertSame(
151+
$expected->getPartitionKey(),
152+
$actual->getPartitionKey()
153+
);
154+
$this->assertSame(
155+
$expected->getRowKey(),
156+
$actual->getRowKey()
157+
);
158+
}
159+
138160
public function testParseEntities()
139161
{
140162
// Setup

0 commit comments

Comments
 (0)