Skip to content

Commit 5296013

Browse files
authored
Enrich the datatype references output with content type data (#16417)
1 parent ce8e258 commit 5296013

File tree

4 files changed

+56
-14
lines changed

4 files changed

+56
-14
lines changed

src/Umbraco.Cms.Api.Management/Factories/DataTypeReferencePresentationFactory.cs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,13 @@ public IEnumerable<DataTypeReferenceResponseModel> CreateDataTypeReferenceViewMo
4747
IEnumerable<string> propertyAliases = propertyAliasesByGuid[contentType.Key];
4848
yield return new DataTypeReferenceResponseModel
4949
{
50-
Id = contentType.Key,
51-
Type = usagesByEntityType.Key,
50+
ContentType = new DataTypeContentTypeReferenceModel
51+
{
52+
Id = contentType.Key,
53+
Name = contentType.Name,
54+
Icon = contentType.Icon,
55+
Type = usagesByEntityType.Key,
56+
},
5257
Properties = contentType
5358
.PropertyTypes
5459
.Where(propertyType => propertyAliases.InvariantContains(propertyType.Alias))

src/Umbraco.Cms.Api.Management/OpenApi.json

Lines changed: 36 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -35399,6 +35399,34 @@
3539935399
],
3540035400
"type": "string"
3540135401
},
35402+
"DataTypeContentTypeReferenceModel": {
35403+
"required": [
35404+
"icon",
35405+
"id",
35406+
"name",
35407+
"type"
35408+
],
35409+
"type": "object",
35410+
"properties": {
35411+
"id": {
35412+
"type": "string",
35413+
"format": "uuid"
35414+
},
35415+
"type": {
35416+
"type": "string",
35417+
"nullable": true
35418+
},
35419+
"name": {
35420+
"type": "string",
35421+
"nullable": true
35422+
},
35423+
"icon": {
35424+
"type": "string",
35425+
"nullable": true
35426+
}
35427+
},
35428+
"additionalProperties": false
35429+
},
3540235430
"DataTypeItemResponseModel": {
3540335431
"required": [
3540435432
"id",
@@ -35457,18 +35485,17 @@
3545735485
},
3545835486
"DataTypeReferenceResponseModel": {
3545935487
"required": [
35460-
"id",
35461-
"properties",
35462-
"type"
35488+
"contentType",
35489+
"properties"
3546335490
],
3546435491
"type": "object",
3546535492
"properties": {
35466-
"id": {
35467-
"type": "string",
35468-
"format": "uuid"
35469-
},
35470-
"type": {
35471-
"type": "string"
35493+
"contentType": {
35494+
"oneOf": [
35495+
{
35496+
"$ref": "#/components/schemas/DataTypeContentTypeReferenceModel"
35497+
}
35498+
]
3547235499
},
3547335500
"properties": {
3547435501
"type": "array",
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
namespace Umbraco.Cms.Api.Management.ViewModels.DataType;
2+
3+
public class DataTypeContentTypeReferenceModel
4+
{
5+
public required Guid Id { get; set; }
6+
7+
public required string? Type { get; set; }
8+
9+
public required string? Name { get; set; }
10+
11+
public required string? Icon { get; set; }
12+
}

src/Umbraco.Cms.Api.Management/ViewModels/DataType/DataTypeReferenceResponseModel.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,7 @@
22

33
public class DataTypeReferenceResponseModel
44
{
5-
public required Guid Id { get; init; }
6-
7-
public required string Type { get; init; }
5+
public required DataTypeContentTypeReferenceModel ContentType { get; init; }
86

97
public required IEnumerable<DataTypePropertyReferenceViewModel> Properties { get; init; }
108
}

0 commit comments

Comments
 (0)