Skip to content

Commit

Permalink
[ODS-6122] Extension names in JSON response not serialized with camel…
Browse files Browse the repository at this point in the history
…-casing applied (#896)
  • Loading branch information
gmcelhanon authored and semalaiappan committed Feb 8, 2024
1 parent 0ed30c5 commit 020baf0
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,11 @@ public void Configure(MvcNewtonsoftJsonOptions options)
_profileResourceModelProvider,
_schemaNameMapProvider)
{
NamingStrategy = new CamelCaseNamingStrategy()
NamingStrategy = new CamelCaseNamingStrategy
{
ProcessDictionaryKeys = true,
OverrideSpecifiedNames = true
}
};
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public Schema GetEdFiExtensionBridgeSchema(ResourceClassBase resourceClassBase,
properties = resourceClassBase.ExtensionByName
.Where(kvp => _documentContext.IsIncludedExtension(kvp.Value.ObjectType))
.ToDictionary(
pair => pair.Key,
pair => pair.Value.JsonPropertyName,
pair =>
new Schema
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -526,13 +526,13 @@ public void Should_Contain_Extended_EdFi_Resource_Bridge_Definition_With_A_Defin
.Select(e => e.Schema)
.Select(
l => _schemaNameMapProvider.GetSchemaMapByPhysicalName(l)
.ProperCaseName);
.ProperCaseName.ToCamelCase());

var expectedBridgeSchemaExtensionReferences = expectedExtensions
.Select(e => e.Schema)
.Select(
l => _schemaNameMapProvider.GetSchemaMapByPhysicalName(l)
.ProperCaseName)
.ProperCaseName.ToCamelCase())
.Select(p => $"#/definitions/{p.ToCamelCase()}_staffExtension");

var extendedEdFiResource = _actualDefinitions["staffExtensions"];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5049,7 +5049,7 @@
"",
"pm.test(\"Should not include the extension metadata property\", () => {",
" pm.expect(responseItem._ext).to.deep.equal({",
" \"Sample\": {",
" \"sample\": {",
" \"petPreference\": {",
" \"minimumWeight\": 20",
" },",
Expand Down Expand Up @@ -5122,7 +5122,7 @@
"",
"pm.test(\"Should not include the extension metadata property\", () => {",
" pm.expect(responseItem._ext).to.deep.equal({",
" \"Sample\": {",
" \"sample\": {",
" \"petPreference\": {",
" \"maximumWeight\": 35",
" },",
Expand Down Expand Up @@ -5194,7 +5194,7 @@
"const responseItem = pm.response.json();",
"",
"pm.test(\"Should not include the extension metadata property\", () => {",
" pm.expect(responseItem._ext).to.deep.equal({ \"Sample\": {} });",
" pm.expect(responseItem._ext).to.deep.equal({ \"sample\": {} });",
"});"
],
"type": "text/javascript"
Expand Down Expand Up @@ -5262,7 +5262,7 @@
"",
"pm.test(\"Should not include the extension metadata property\", () => {",
" pm.expect(responseItem._ext).to.deep.equal({",
" \"Sample\": {",
" \"sample\": {",
" \"petPreference\": {",
" \"minimumWeight\": 5",
" },",
Expand Down Expand Up @@ -5335,7 +5335,7 @@
"",
"pm.test(\"Should not include the extension metadata property\", () => {",
" pm.expect(responseItem._ext).to.deep.equal({",
" \"Sample\": {",
" \"sample\": {",
" \"petPreference\": {",
" \"maximumWeight\": 15",
" },",
Expand Down Expand Up @@ -5407,7 +5407,7 @@
"const responseItem = pm.response.json();",
"",
"pm.test(\"Should not include the extension metadata property\", () => {",
" pm.expect(responseItem._ext).to.deep.equal({ \"Sample\": {} });",
" pm.expect(responseItem._ext).to.deep.equal({ \"sample\": {} });",
"});"
],
"type": "text/javascript"
Expand Down Expand Up @@ -5470,7 +5470,7 @@
"",
"pm.test(\"Should not include the extension metadata property\", () => {",
" pm.expect(responseItem._ext).to.deep.equal({",
" \"Sample\": {",
" \"sample\": {",
" \"favoriteBooks\": [",
" {",
" \"favoriteBookCategoryDescriptor\": \"uri://ed-fi.org/FavoriteBookCategoryDescriptor#Non-Fiction\",",
Expand Down Expand Up @@ -5546,7 +5546,7 @@
"",
"pm.test(\"Should not include the extension metadata property\", () => {",
" pm.expect(responseItem._ext).to.deep.equal({",
" \"Sample\": {",
" \"sample\": {",
" \"favoriteBooks\": [",
" {",
" \"favoriteBookCategoryDescriptor\": \"uri://ed-fi.org/FavoriteBookCategoryDescriptor#Non-Fiction\",",
Expand Down Expand Up @@ -5626,7 +5626,7 @@
"const responseItem = pm.response.json();\r",
"\r",
"pm.test(\"Should have multiple extensions present with no Profile supplied\", () => {\r",
" pm.expect(responseItem._ext).to.have.all.keys([\"Sample\", \"TPDM\"]);\r",
" pm.expect(responseItem._ext).to.have.all.keys([\"sample\", \"tpdm\"]);\r",
"});"
],
"type": "text/javascript"
Expand Down Expand Up @@ -5672,7 +5672,7 @@
"\r",
"pm.test(\"Should only have the included extension present\", () => {\r",
" pm.expect(responseItem._ext).to.deep.equal({\r",
" \"Sample\": {\r",
" \"sample\": {\r",
" \"isExemplary\": false,\r",
" \"directlyOwnedBuses\": []\r",
" }\r",
Expand Down Expand Up @@ -5728,7 +5728,7 @@
"const responseItem = pm.response.json();\r",
"\r",
"pm.test(\"Should not have the excluded extension present\", () => {\r",
" pm.expect(responseItem._ext).to.contain.all.keys([\"TPDM\"]);\r",
" pm.expect(responseItem._ext).to.contain.all.keys([\"tpdm\"]);\r",
"});"
],
"type": "text/javascript"
Expand Down Expand Up @@ -5805,7 +5805,7 @@
"header": [],
"body": {
"mode": "raw",
"raw": "{\r\n \"staffUniqueId\": \"{{supplied:staffUniqueId}}\",\r\n \"firstName\": \"John\",\r\n \"lastSurname\": \"Doe\",\r\n \"_ext\": {\r\n \"Sample\": {\r\n \"firstPetOwnedDate\": \"2000-01-01\",\r\n \"pets\": [\r\n {\r\n \"petName\": \"Rex\",\r\n \"isFixed\": false\r\n }\r\n ],\r\n \"petPreference\": {\r\n \"minimumWeight\": 20,\r\n \"maximumWeight\": 35\r\n }\r\n }\r\n }\r\n}",
"raw": "{\r\n \"staffUniqueId\": \"{{supplied:staffUniqueId}}\",\r\n \"firstName\": \"John\",\r\n \"lastSurname\": \"Doe\",\r\n \"_ext\": {\r\n \"sample\": {\r\n \"firstPetOwnedDate\": \"2000-01-01\",\r\n \"pets\": [\r\n {\r\n \"petName\": \"Rex\",\r\n \"isFixed\": false\r\n }\r\n ],\r\n \"petPreference\": {\r\n \"minimumWeight\": 20,\r\n \"maximumWeight\": 35\r\n }\r\n }\r\n }\r\n}",
"options": {
"raw": {
"language": "json"
Expand Down Expand Up @@ -5865,7 +5865,7 @@
],
"body": {
"mode": "raw",
"raw": "{\r\n \"staffUniqueId\": \"{{supplied:staffUniqueId}}\",\r\n \"firstName\": \"John\",\r\n \"lastSurname\": \"Doe\",\r\n \"_ext\": {\r\n \"Sample\": {\r\n \"petPreference\": {\r\n \"maximumWeight\": 200,\r\n \"minimumWeight\": 100\r\n },\r\n \"pets\": [\r\n {\r\n \"petName\": \"Rex\",\r\n \"isFixed\": true\r\n }\r\n ]\r\n }\r\n }\r\n}",
"raw": "{\r\n \"staffUniqueId\": \"{{supplied:staffUniqueId}}\",\r\n \"firstName\": \"John\",\r\n \"lastSurname\": \"Doe\",\r\n \"_ext\": {\r\n \"sample\": {\r\n \"petPreference\": {\r\n \"maximumWeight\": 200,\r\n \"minimumWeight\": 100\r\n },\r\n \"pets\": [\r\n {\r\n \"petName\": \"Rex\",\r\n \"isFixed\": true\r\n }\r\n ]\r\n }\r\n }\r\n}",
"options": {
"raw": {
"language": "json"
Expand Down Expand Up @@ -5904,7 +5904,7 @@
"",
"pm.test(\"Should not have updated the extension data\", () => {",
" pm.expect(responseItem._ext).to.deep.equal({",
" \"Sample\": {",
" \"sample\": {",
" \"firstPetOwnedDate\": \"2000-01-01\",",
" \"petPreference\": {",
" \"maximumWeight\": 35,",
Expand Down Expand Up @@ -5987,7 +5987,7 @@
"header": [],
"body": {
"mode": "raw",
"raw": "{\r\n \"staffUniqueId\": \"{{supplied:staffUniqueId}}\",\r\n \"firstName\": \"John\",\r\n \"lastSurname\": \"Doe\",\r\n \"_ext\": {\r\n \"Sample\": {\r\n \"firstPetOwnedDate\": \"2000-01-01\",\r\n \"pets\": [\r\n {\r\n \"petName\": \"Rex\",\r\n \"isFixed\": false\r\n }\r\n ],\r\n \"petPreference\": {\r\n \"minimumWeight\": 20,\r\n \"maximumWeight\": 35\r\n }\r\n }\r\n }\r\n}",
"raw": "{\r\n \"staffUniqueId\": \"{{supplied:staffUniqueId}}\",\r\n \"firstName\": \"John\",\r\n \"lastSurname\": \"Doe\",\r\n \"_ext\": {\r\n \"sample\": {\r\n \"firstPetOwnedDate\": \"2000-01-01\",\r\n \"pets\": [\r\n {\r\n \"petName\": \"Rex\",\r\n \"isFixed\": false\r\n }\r\n ],\r\n \"petPreference\": {\r\n \"minimumWeight\": 20,\r\n \"maximumWeight\": 35\r\n }\r\n }\r\n }\r\n}",
"options": {
"raw": {
"language": "json"
Expand Down Expand Up @@ -6047,7 +6047,7 @@
],
"body": {
"mode": "raw",
"raw": "{\r\n \"staffUniqueId\": \"{{supplied:staffUniqueId}}\",\r\n \"firstName\": \"John\",\r\n \"lastSurname\": \"Doe\",\r\n \"_ext\": {\r\n \"Sample\": {\r\n \"petPreference\": {\r\n \"maximumWeight\": 135,\r\n \"minimumWeight\": 120\r\n },\r\n \"pets\": [\r\n {\r\n \"petName\": \"Rex\",\r\n \"isFixed\": true\r\n }\r\n ]\r\n }\r\n }\r\n}",
"raw": "{\r\n \"staffUniqueId\": \"{{supplied:staffUniqueId}}\",\r\n \"firstName\": \"John\",\r\n \"lastSurname\": \"Doe\",\r\n \"_ext\": {\r\n \"sample\": {\r\n \"petPreference\": {\r\n \"maximumWeight\": 135,\r\n \"minimumWeight\": 120\r\n },\r\n \"pets\": [\r\n {\r\n \"petName\": \"Rex\",\r\n \"isFixed\": true\r\n }\r\n ]\r\n }\r\n }\r\n}",
"options": {
"raw": {
"language": "json"
Expand Down Expand Up @@ -6086,7 +6086,7 @@
"",
"pm.test(\"Should not have updated the extension data\", () => {",
" pm.expect(responseItem._ext).to.deep.equal({",
" \"Sample\": {",
" \"sample\": {",
" \"firstPetOwnedDate\": \"2000-01-01\",",
" \"petPreference\": {",
" \"maximumWeight\": 35,",
Expand Down Expand Up @@ -6169,7 +6169,7 @@
"header": [],
"body": {
"mode": "raw",
"raw": "{\r\n \"staffUniqueId\": \"{{supplied:staffUniqueId}}\",\r\n \"firstName\": \"John\",\r\n \"lastSurname\": \"Doe\",\r\n \"_ext\": {\r\n \"Sample\": {\r\n \"firstPetOwnedDate\": \"2000-01-01\",\r\n \"pets\": [\r\n {\r\n \"petName\": \"Rex\",\r\n \"isFixed\": false\r\n }\r\n ],\r\n \"petPreference\": {\r\n \"minimumWeight\": 20,\r\n \"maximumWeight\": 35\r\n }\r\n }\r\n }\r\n}",
"raw": "{\r\n \"staffUniqueId\": \"{{supplied:staffUniqueId}}\",\r\n \"firstName\": \"John\",\r\n \"lastSurname\": \"Doe\",\r\n \"_ext\": {\r\n \"sample\": {\r\n \"firstPetOwnedDate\": \"2000-01-01\",\r\n \"pets\": [\r\n {\r\n \"petName\": \"Rex\",\r\n \"isFixed\": false\r\n }\r\n ],\r\n \"petPreference\": {\r\n \"minimumWeight\": 20,\r\n \"maximumWeight\": 35\r\n }\r\n }\r\n }\r\n}",
"options": {
"raw": {
"language": "json"
Expand Down Expand Up @@ -6229,7 +6229,7 @@
],
"body": {
"mode": "raw",
"raw": "{\r\n \"staffUniqueId\": \"{{supplied:staffUniqueId}}\",\r\n \"firstName\": \"John\",\r\n \"lastSurname\": \"Doe\",\r\n \"_ext\": {\r\n \"Sample\": {\r\n \"firstPetOwnedDate\": \"2020-02-02\",\r\n \"petPreference\": {\r\n \"maximumWeight\": 200,\r\n \"minimumWeight\": 100\r\n },\r\n \"pets\": [\r\n {\r\n \"petName\": \"Rex\",\r\n \"isFixed\": true\r\n }\r\n ]\r\n }\r\n }\r\n}",
"raw": "{\r\n \"staffUniqueId\": \"{{supplied:staffUniqueId}}\",\r\n \"firstName\": \"John\",\r\n \"lastSurname\": \"Doe\",\r\n \"_ext\": {\r\n \"sample\": {\r\n \"firstPetOwnedDate\": \"2020-02-02\",\r\n \"petPreference\": {\r\n \"maximumWeight\": 200,\r\n \"minimumWeight\": 100\r\n },\r\n \"pets\": [\r\n {\r\n \"petName\": \"Rex\",\r\n \"isFixed\": true\r\n }\r\n ]\r\n }\r\n }\r\n}",
"options": {
"raw": {
"language": "json"
Expand Down Expand Up @@ -6268,7 +6268,7 @@
"",
"pm.test(\"Should not have only updated the included extension elements\", () => {",
" pm.expect(responseItem._ext).to.deep.equal({",
" \"Sample\": {",
" \"sample\": {",
" \"firstPetOwnedDate\": \"2020-02-02\",",
" \"petPreference\": {",
" \"maximumWeight\": 35,",
Expand Down Expand Up @@ -6351,7 +6351,7 @@
"header": [],
"body": {
"mode": "raw",
"raw": "{\r\n \"staffUniqueId\": \"{{supplied:staffUniqueId}}\",\r\n \"firstName\": \"John\",\r\n \"lastSurname\": \"Doe\",\r\n \"_ext\": {\r\n \"Sample\": {\r\n \"firstPetOwnedDate\": \"2000-01-01\",\r\n \"pets\": [\r\n {\r\n \"petName\": \"Rex\",\r\n \"isFixed\": false\r\n }\r\n ],\r\n \"petPreference\": {\r\n \"minimumWeight\": 20,\r\n \"maximumWeight\": 35\r\n }\r\n }\r\n }\r\n}",
"raw": "{\r\n \"staffUniqueId\": \"{{supplied:staffUniqueId}}\",\r\n \"firstName\": \"John\",\r\n \"lastSurname\": \"Doe\",\r\n \"_ext\": {\r\n \"sample\": {\r\n \"firstPetOwnedDate\": \"2000-01-01\",\r\n \"pets\": [\r\n {\r\n \"petName\": \"Rex\",\r\n \"isFixed\": false\r\n }\r\n ],\r\n \"petPreference\": {\r\n \"minimumWeight\": 20,\r\n \"maximumWeight\": 35\r\n }\r\n }\r\n }\r\n}",
"options": {
"raw": {
"language": "json"
Expand Down Expand Up @@ -6411,7 +6411,7 @@
],
"body": {
"mode": "raw",
"raw": "{\r\n \"staffUniqueId\": \"{{supplied:staffUniqueId}}\",\r\n \"firstName\": \"John\",\r\n \"lastSurname\": \"Doe\",\r\n \"_ext\": {\r\n \"Sample\": {\r\n \"firstPetOwnedDate\": \"2020-02-02\",\r\n \"petPreference\": {\r\n \"maximumWeight\": 200,\r\n \"minimumWeight\": 100\r\n },\r\n \"pets\": [\r\n {\r\n \"petName\": \"Rex\",\r\n \"isFixed\": true\r\n }\r\n ]\r\n }\r\n }\r\n}",
"raw": "{\r\n \"staffUniqueId\": \"{{supplied:staffUniqueId}}\",\r\n \"firstName\": \"John\",\r\n \"lastSurname\": \"Doe\",\r\n \"_ext\": {\r\n \"sample\": {\r\n \"firstPetOwnedDate\": \"2020-02-02\",\r\n \"petPreference\": {\r\n \"maximumWeight\": 200,\r\n \"minimumWeight\": 100\r\n },\r\n \"pets\": [\r\n {\r\n \"petName\": \"Rex\",\r\n \"isFixed\": true\r\n }\r\n ]\r\n }\r\n }\r\n}",
"options": {
"raw": {
"language": "json"
Expand Down Expand Up @@ -6450,7 +6450,7 @@
"",
"pm.test(\"Should not have only updated the included extension elements\", () => {",
" pm.expect(responseItem._ext).to.deep.equal({",
" \"Sample\": {",
" \"sample\": {",
" \"firstPetOwnedDate\": \"2000-01-01\",",
" \"pets\": [",
" {",
Expand Down Expand Up @@ -6533,7 +6533,7 @@
"header": [],
"body": {
"mode": "raw",
"raw": "{\r\n \"staffUniqueId\": \"{{supplied:staffUniqueId}}\",\r\n \"firstName\": \"John\",\r\n \"lastSurname\": \"Doe\",\r\n \"_ext\": {\r\n \"Sample\": {\r\n \"firstPetOwnedDate\": \"2000-01-01\",\r\n \"pets\": [\r\n {\r\n \"petName\": \"Rex\",\r\n \"isFixed\": false\r\n }\r\n ],\r\n \"petPreference\": {\r\n \"minimumWeight\": 20,\r\n \"maximumWeight\": 35\r\n }\r\n }\r\n }\r\n}",
"raw": "{\r\n \"staffUniqueId\": \"{{supplied:staffUniqueId}}\",\r\n \"firstName\": \"John\",\r\n \"lastSurname\": \"Doe\",\r\n \"_ext\": {\r\n \"sample\": {\r\n \"firstPetOwnedDate\": \"2000-01-01\",\r\n \"pets\": [\r\n {\r\n \"petName\": \"Rex\",\r\n \"isFixed\": false\r\n }\r\n ],\r\n \"petPreference\": {\r\n \"minimumWeight\": 20,\r\n \"maximumWeight\": 35\r\n }\r\n }\r\n }\r\n}",
"options": {
"raw": {
"language": "json"
Expand Down Expand Up @@ -6593,7 +6593,7 @@
],
"body": {
"mode": "raw",
"raw": "{\r\n \"staffUniqueId\": \"{{supplied:staffUniqueId}}\",\r\n \"firstName\": \"John\",\r\n \"lastSurname\": \"Doe\",\r\n \"_ext\": {\r\n \"Sample\": {\r\n \"firstPetOwnedDate\": \"2020-02-02\",\r\n \"petPreference\": {\r\n \"maximumWeight\": 200,\r\n \"minimumWeight\": 100\r\n },\r\n \"pets\": [\r\n {\r\n \"petName\": \"Rex\",\r\n \"isFixed\": true\r\n }\r\n ]\r\n }\r\n }\r\n}",
"raw": "{\r\n \"staffUniqueId\": \"{{supplied:staffUniqueId}}\",\r\n \"firstName\": \"John\",\r\n \"lastSurname\": \"Doe\",\r\n \"_ext\": {\r\n \"sample\": {\r\n \"firstPetOwnedDate\": \"2020-02-02\",\r\n \"petPreference\": {\r\n \"maximumWeight\": 200,\r\n \"minimumWeight\": 100\r\n },\r\n \"pets\": [\r\n {\r\n \"petName\": \"Rex\",\r\n \"isFixed\": true\r\n }\r\n ]\r\n }\r\n }\r\n}",
"options": {
"raw": {
"language": "json"
Expand Down Expand Up @@ -6632,7 +6632,7 @@
"",
"pm.test(\"Should not have only updated the included extension elements\", () => {",
" pm.expect(responseItem._ext).to.deep.equal({",
" \"Sample\": {",
" \"sample\": {",
" \"firstPetOwnedDate\": \"2000-01-01\",",
" \"pets\": [",
" {",
Expand Down

0 comments on commit 020baf0

Please sign in to comment.