Skip to content

Commit

Permalink
Add nullable-list test (#591)
Browse files Browse the repository at this point in the history
  • Loading branch information
mcgallan authored Jun 13, 2024
1 parent 2fb006d commit 83c129b
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/witty-vans-deliver.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@azure-tools/cadl-ranch-specs": patch
---

Add nullable list of int/string test cases for type/property/nullable
40 changes: 40 additions & 0 deletions packages/cadl-ranch-specs/cadl-ranch-summary.md
Original file line number Diff line number Diff line change
Expand Up @@ -5343,6 +5343,46 @@ Expected request body:
{ "requiredProperty": "foo", "nullableProperty": null }
```

### Type_Property_Nullable_CollectionsString_getNonNull

- Endpoint: `get /type/property/nullable/collections/string/non-null`

Expected response body:

```json
{ "requiredProperty": "foo", "nullableProperty": ["hello", "world"] }
```

### Type_Property_Nullable_CollectionsString_getNull

- Endpoint: `get /type/property/nullable/collections/string/null`

Expected response body:

```json
{ "requiredProperty": "foo", "nullableProperty": null }
```

### Type_Property_Nullable_CollectionsString_patchNonNull

- Endpoint: `patch /type/property/nullable/collections/string/non-null`

Expected request body:

```json
{ "requiredProperty": "foo", "nullableProperty": ["hello", "world"] }
```

### Type_Property_Nullable_CollectionsString_patchNull

- Endpoint: `patch /type/property/nullable/collections/string/null`

Expected request body:

```json
{ "requiredProperty": "foo", "nullableProperty": null }
```

### Type_Property_Nullable_Datetime_getNonNull

- Endpoint: `get /type/property/nullable/datetime/non-null`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,3 +147,10 @@ model CollectionsModelProperty is ModelTemplate<InnerModel[]>;
@operationGroup
interface CollectionsModel
extends OperationsTemplate<CollectionsModelProperty, "[{'property': 'hello'}, {'property': 'world'}]"> {}

// Model with nullable collection string property
@doc("Model with collection string properties")
model CollectionsStringProperty is ModelTemplate<string[]>;
@route("/collections/string")
@operationGroup
interface CollectionsString extends OperationsTemplate<CollectionsStringProperty, "['hello', 'world']"> {}
Original file line number Diff line number Diff line change
Expand Up @@ -88,3 +88,9 @@ Scenarios.Type_Property_Nullable_CollectionsModel_getNonNull = passOnSuccess(col
Scenarios.Type_Property_Nullable_CollectionsModel_getNull = passOnSuccess(collectionsModelMock.getNull);
Scenarios.Type_Property_Nullable_CollectionsModel_patchNonNull = passOnSuccess(collectionsModelMock.patchNonNull);
Scenarios.Type_Property_Nullable_CollectionsModel_patchNull = passOnSuccess(collectionsModelMock.patchNull);

const collectionsStringMock = createMockApis("collections/string", ["hello", "world"]);
Scenarios.Type_Property_Nullable_CollectionsString_getNonNull = passOnSuccess(collectionsStringMock.getNonNull);
Scenarios.Type_Property_Nullable_CollectionsString_getNull = passOnSuccess(collectionsStringMock.getNull);
Scenarios.Type_Property_Nullable_CollectionsString_patchNonNull = passOnSuccess(collectionsStringMock.patchNonNull);
Scenarios.Type_Property_Nullable_CollectionsString_patchNull = passOnSuccess(collectionsStringMock.patchNull);

0 comments on commit 83c129b

Please sign in to comment.