Assert.AreEqual(expectedOpenApiJson.ToJsonString(),generatedOpenApiJson.ToJsonString(),$"Generated API do not respect the contract.");
}
privateconststringExpectedOpenApiContract=
"""
{
"openapi":"3.0.1",
"info":{
"title":"Umbraco Delivery API",
"description":"You can find out more about the Umbraco Delivery API in [the documentation](https://docs.umbraco.com/umbraco-cms/reference/content-delivery-api).",
"description":"Specifies the content items to fetch. Refer to [the documentation](https://docs.umbraco.com/umbraco-cms/reference/content-delivery-api#query-parameters) for more details on this.",
"schema":{
"type":"string"
},
"examples":{
"Select all":{
"value":""
},
"Select all ancestors of a node by id":{
"value":"ancestors:id"
},
"Select all ancestors of a node by path":{
"value":"ancestors:path"
},
"Select all children of a node by id":{
"value":"children:id"
},
"Select all children of a node by path":{
"value":"children:path"
},
"Select all descendants of a node by id":{
"value":"descendants:id"
},
"Select all descendants of a node by path":{
"value":"descendants:path"
}
}
},
{
"name":"filter",
"in":"query",
"description":"Defines how to filter the fetched content items. Refer to [the documentation](https://docs.umbraco.com/umbraco-cms/reference/content-delivery-api#query-parameters) for more details on this.",
"schema":{
"type":"array",
"items":{
"type":"string"
}
},
"examples":{
"Default filter":{
"value":""
},
"Filter by content type (equals)":{
"value":[
"contentType:alias1"
]
},
"Filter by name (contains)":{
"value":[
"name:nodeName"
]
},
"Filter by creation date (less than)":{
"value":[
"createDate<2024-01-01"
]
},
"Filter by update date (greater than or equal)":{
"value":[
"updateDate>:2023-01-01"
]
}
}
},
{
"name":"sort",
"in":"query",
"description":"Defines how to sort the found content items. Refer to [the documentation](https://docs.umbraco.com/umbraco-cms/reference/content-delivery-api#query-parameters) for more details on this.",
"schema":{
"type":"array",
"items":{
"type":"string"
}
},
"examples":{
"Default sort":{
"value":""
},
"Sort by create date":{
"value":[
"createDate:asc",
"createDate:desc"
]
},
"Sort by level":{
"value":[
"level:asc",
"level:desc"
]
},
"Sort by name":{
"value":[
"name:asc",
"name:desc"
]
},
"Sort by sort order":{
"value":[
"sortOrder:asc",
"sortOrder:desc"
]
},
"Sort by update date":{
"value":[
"updateDate:asc",
"updateDate:desc"
]
}
}
},
{
"name":"skip",
"in":"query",
"description":"Specifies the number of found content items to skip. Use this to control pagination of the response.",
"schema":{
"type":"integer",
"format":"int32",
"default":0
}
},
{
"name":"take",
"in":"query",
"description":"Specifies the number of found content items to take. Use this to control pagination of the response.",
"schema":{
"type":"integer",
"format":"int32",
"default":10
}
},
{
"name":"expand",
"in":"query",
"description":"Defines the properties that should be expanded in the response. Refer to [the documentation](https://docs.umbraco.com/umbraco-cms/reference/content-delivery-api#query-parameters) for more details on this.",
"description":"Explicitly defines which properties should be included in the response (by default all properties are included). Refer to [the documentation](https://docs.umbraco.com/umbraco-cms/reference/content-delivery-api#query-parameters) for more details on this.",
"description":"Defines the properties that should be expanded in the response. Refer to [the documentation](https://docs.umbraco.com/umbraco-cms/reference/content-delivery-api#query-parameters) for more details on this.",
"description":"Explicitly defines which properties should be included in the response (by default all properties are included). Refer to [the documentation](https://docs.umbraco.com/umbraco-cms/reference/content-delivery-api#query-parameters) for more details on this.",
"description":"Defines the properties that should be expanded in the response. Refer to [the documentation](https://docs.umbraco.com/umbraco-cms/reference/content-delivery-api#query-parameters) for more details on this.",
"description":"Explicitly defines which properties should be included in the response (by default all properties are included). Refer to [the documentation](https://docs.umbraco.com/umbraco-cms/reference/content-delivery-api#query-parameters) for more details on this.",
"description":"Defines the properties that should be expanded in the response. Refer to [the documentation](https://docs.umbraco.com/umbraco-cms/reference/content-delivery-api#query-parameters) for more details on this.",
"description":"Explicitly defines which properties should be included in the response (by default all properties are included). Refer to [the documentation](https://docs.umbraco.com/umbraco-cms/reference/content-delivery-api#query-parameters) for more details on this.",
"description":"Specifies the media items to fetch. Refer to [the documentation](https://docs.umbraco.com/umbraco-cms/reference/content-delivery-api/media-delivery-api#query-parameters) for more details on this.",
"schema":{
"type":"string"
},
"examples":{
"Select all children at root level":{
"value":"children:/"
},
"Select all children of a media item by id":{
"value":"children:id"
},
"Select all children of a media item by path":{
"value":"children:path"
}
}
},
{
"name":"filter",
"in":"query",
"description":"Defines how to filter the fetched media items. Refer to [the documentation](https://docs.umbraco.com/umbraco-cms/reference/content-delivery-api/media-delivery-api#query-parameters) for more details on this.",
"schema":{
"type":"array",
"items":{
"type":"string"
}
},
"examples":{
"Default filter":{
"value":""
},
"Filter by media type":{
"value":[
"mediaType:alias1"
]
},
"Filter by name":{
"value":[
"name:nodeName"
]
}
}
},
{
"name":"sort",
"in":"query",
"description":"Defines how to sort the found media items. Refer to [the documentation](https://docs.umbraco.com/umbraco-cms/reference/content-delivery-api/media-delivery-api#query-parameters) for more details on this.",
"schema":{
"type":"array",
"items":{
"type":"string"
}
},
"examples":{
"Default sort":{
"value":""
},
"Sort by create date":{
"value":[
"createDate:asc",
"createDate:desc"
]
},
"Sort by name":{
"value":[
"name:asc",
"name:desc"
]
},
"Sort by sort order":{
"value":[
"sortOrder:asc",
"sortOrder:desc"
]
},
"Sort by update date":{
"value":[
"updateDate:asc",
"updateDate:desc"
]
}
}
},
{
"name":"skip",
"in":"query",
"description":"Specifies the number of found media items to skip. Use this to control pagination of the response.",
"schema":{
"type":"integer",
"format":"int32",
"default":0
}
},
{
"name":"take",
"in":"query",
"description":"Specifies the number of found media items to take. Use this to control pagination of the response.",
"schema":{
"type":"integer",
"format":"int32",
"default":10
}
},
{
"name":"expand",
"in":"query",
"description":"Defines the properties that should be expanded in the response. Refer to [the documentation](https://docs.umbraco.com/umbraco-cms/reference/content-delivery-api/media-delivery-api#query-parameters) for more details on this.",
"description":"Explicitly defines which properties should be included in the response (by default all properties are included). Refer to [the documentation](https://docs.umbraco.com/umbraco-cms/reference/content-delivery-api/media-delivery-api#query-parameters) for more details on this.",
"description":"Defines the properties that should be expanded in the response. Refer to [the documentation](https://docs.umbraco.com/umbraco-cms/reference/content-delivery-api/media-delivery-api#query-parameters) for more details on this.",
"description":"Explicitly defines which properties should be included in the response (by default all properties are included). Refer to [the documentation](https://docs.umbraco.com/umbraco-cms/reference/content-delivery-api/media-delivery-api#query-parameters) for more details on this.",
"description":"Defines the properties that should be expanded in the response. Refer to [the documentation](https://docs.umbraco.com/umbraco-cms/reference/content-delivery-api/media-delivery-api#query-parameters) for more details on this.",
"description":"Explicitly defines which properties should be included in the response (by default all properties are included). Refer to [the documentation](https://docs.umbraco.com/umbraco-cms/reference/content-delivery-api/media-delivery-api#query-parameters) for more details on this.",
"description":"Defines the properties that should be expanded in the response. Refer to [the documentation](https://docs.umbraco.com/umbraco-cms/reference/content-delivery-api/media-delivery-api#query-parameters) for more details on this.",
"description":"Explicitly defines which properties should be included in the response (by default all properties are included). Refer to [the documentation](https://docs.umbraco.com/umbraco-cms/reference/content-delivery-api/media-delivery-api#query-parameters) for more details on this.",