Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
changeKind: feature
packages:
- "@typespec/http-specs"
---

Add scenario for encode duration with larger units
152 changes: 152 additions & 0 deletions packages/http-specs/spec-summary.md
Original file line number Diff line number Diff line change
Expand Up @@ -538,13 +538,29 @@ Expected header `duration: 35.625`
Test float milliseconds encode for a duration header.
Expected header `duration: 35625`

### Encode_Duration_Header_floatMillisecondsLargerUnit

- Endpoint: `get /encode/duration/header/float-milliseconds-larger-unit`

Test float milliseconds encode for a duration header where the duration is several minutes.
Languages that support duration primitives should use the largest possible unit, e.g. TimeSpan.FromMinutes(3.5) in C#.
Expected header `duration: 210000.0`

### Encode_Duration_Header_floatSeconds

- Endpoint: `get /encode/duration/header/float-seconds`

Test float seconds encode for a duration header.
Expected header `duration: 35.625`

### Encode_Duration_Header_floatSecondsLargerUnit

- Endpoint: `get /encode/duration/header/float-seconds-larger-unit`

Test float seconds encode for a duration header where the duration is several minutes.
Languages that support duration primitives should use the largest possible unit, e.g. TimeSpan.FromMinutes(2.5) in C#.
Expected header `duration: 150.0`

### Encode_Duration_Header_int32Milliseconds

- Endpoint: `get /encode/duration/header/int32-milliseconds`
Expand All @@ -559,13 +575,29 @@ Expected header `duration: 36000`
Test int32 milliseconds encode for a duration array header.
Expected header `duration: [36000,47000]`

### Encode_Duration_Header_int32MillisecondsLargerUnit

- Endpoint: `get /encode/duration/header/int32-milliseconds-larger-unit`

Test int32 milliseconds encode for a duration header where the duration is several minutes.
Languages that support duration primitives should use the largest possible unit, e.g. TimeSpan.FromMinutes(3) in C#.
Expected header `duration: 180000`

### Encode_Duration_Header_int32Seconds

- Endpoint: `get /encode/duration/header/int32-seconds`

Test int32 seconds encode for a duration header.
Expected header `duration: 36`

### Encode_Duration_Header_int32SecondsLargerUnit

- Endpoint: `get /encode/duration/header/int32-seconds-larger-unit`

Test int32 seconds encode for a duration header where the duration is several minutes.
Languages that support duration primitives should use the largest possible unit, e.g. TimeSpan.FromMinutes(2) in C#.
Expected header `duration: 120`

### Encode_Duration_Header_iso8601

- Endpoint: `get /encode/duration/header/iso8601`
Expand Down Expand Up @@ -685,6 +717,28 @@ Expected response body:
}
```

### Encode_Duration_Property_floatMillisecondsLargerUnit

- Endpoint: `get /encode/duration/property/float-milliseconds-larger-unit`

Test operation with request and response model contains a duration property with float milliseconds encode where the duration is several minutes.
Languages that support duration primitives should use the largest possible unit, e.g. TimeSpan.FromMinutes(3.5) in C#.
Expected request body:

```json
{
"value": 210000.0
}
```

Expected response body:

```json
{
"value": 210000.0
}
```

### Encode_Duration_Property_floatSeconds

- Endpoint: `get /encode/duration/property/float-seconds`
Expand Down Expand Up @@ -727,6 +781,28 @@ Expected response body:
}
```

### Encode_Duration_Property_floatSecondsLargerUnit

- Endpoint: `get /encode/duration/property/float-seconds-larger-unit`

Test operation with request and response model contains a duration property with float seconds encode where the duration is several minutes.
Languages that support duration primitives should use the largest possible unit, e.g. TimeSpan.FromMinutes(2.5) in C#.
Expected request body:

```json
{
"value": 150.0
}
```

Expected response body:

```json
{
"value": 150.0
}
```

### Encode_Duration_Property_int32Milliseconds

- Endpoint: `get /encode/duration/property/int32-milliseconds`
Expand All @@ -748,6 +824,28 @@ Expected response body:
}
```

### Encode_Duration_Property_int32MillisecondsLargerUnit

- Endpoint: `get /encode/duration/property/int32-milliseconds-larger-unit`

Test operation with request and response model contains a duration property with int32 milliseconds encode where the duration is several minutes.
Languages that support duration primitives should use the largest possible unit, e.g. TimeSpan.FromMinutes(3) in C#.
Expected request body:

```json
{
"value": 180000
}
```

Expected response body:

```json
{
"value": 180000
}
```

### Encode_Duration_Property_int32Seconds

- Endpoint: `get /encode/duration/property/int32-seconds`
Expand All @@ -769,6 +867,28 @@ Expected response body:
}
```

### Encode_Duration_Property_int32SecondsLargerUnit

- Endpoint: `get /encode/duration/property/int32-seconds-larger-unit`

Test operation with request and response model contains a duration property with int32 seconds encode where the duration is several minutes.
Languages that support duration primitives should use the largest possible unit, e.g. TimeSpan.FromMinutes(2) in C#.
Expected request body:

```json
{
"value": 120
}
```

Expected response body:

```json
{
"value": 120
}
```

### Encode_Duration_Property_iso8601

- Endpoint: `post /encode/duration/property/iso8601`
Expand Down Expand Up @@ -818,13 +938,29 @@ Expected query parameter `input=35.625`
Test float milliseconds encode for a duration parameter.
Expected query parameter `input=35625`

### Encode_Duration_Query_floatMillisecondsLargerUnit

- Endpoint: `get /encode/duration/query/float-milliseconds-larger-unit`

Test float milliseconds encode for a duration parameter where the duration is several minutes.
Languages that support duration primitives should use the largest possible unit, e.g. TimeSpan.FromMinutes(3.5) in C#.
Expected query parameter `input=210000.0`

### Encode_Duration_Query_floatSeconds

- Endpoint: `get /encode/duration/query/float-seconds`

Test float seconds encode for a duration parameter.
Expected query parameter `input=35.625`

### Encode_Duration_Query_floatSecondsLargerUnit

- Endpoint: `get /encode/duration/query/float-seconds-larger-unit`

Test float seconds encode for a duration parameter where the duration is several minutes.
Languages that support duration primitives should use the largest possible unit, e.g. TimeSpan.FromMinutes(2.5) in C#.
Expected query parameter `input=150.0`

### Encode_Duration_Query_int32Milliseconds

- Endpoint: `get /encode/duration/query/int32-milliseconds`
Expand All @@ -839,6 +975,14 @@ Expected query parameter `input=36000`
Test int32 milliseconds encode for a duration array parameter.
Expected query parameter `input=36000,47000`

### Encode_Duration_Query_int32MillisecondsLargerUnit

- Endpoint: `get /encode/duration/query/int32-milliseconds-larger-unit`

Test int32 milliseconds encode for a duration parameter where the duration is several minutes.
Languages that support duration primitives should use the largest possible unit, e.g. TimeSpan.FromMinutes(3) in C#.
Expected query parameter `input=180000`

### Encode_Duration_Query_int32Seconds

- Endpoint: `get /encode/duration/query/int32-seconds`
Expand All @@ -853,6 +997,14 @@ Expected query parameter `input=36`
Test int32 seconds encode for a duration array parameter.
Expected query parameter `input=36,47`

### Encode_Duration_Query_int32SecondsLargerUnit

- Endpoint: `get /encode/duration/query/int32-seconds-larger-unit`

Test int32 seconds encode for a duration parameter where the duration is several minutes.
Languages that support duration primitives should use the largest possible unit, e.g. TimeSpan.FromMinutes(2) in C#.
Expected query parameter `input=120`

### Encode_Duration_Query_iso8601

- Endpoint: `get /encode/duration/query/iso8601`
Expand Down
Loading
Loading