Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

3.1.1: use specific custom languages uri and uritemplate #4110

Merged
merged 2 commits into from
Sep 26, 2024
Merged
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
24 changes: 12 additions & 12 deletions versions/3.1.1.md
Original file line number Diff line number Diff line change
Expand Up @@ -1720,7 +1720,7 @@ With this example, consider an `id` of `f81d4fae-7dec-11d0-a765-00a0c91e6bf6` an

Assuming the most compact representation of the JSON value (with unnecessary whitespace removed), we would expect to see the following request body, where space characters have been replaced with `+` and `+`, `"`, `{`, and `}` have been percent-encoded to `%2B`, `%22`, `%7B`, and `%7D`, respectively:

```urlencoded
```uri
id=f81d4fae-7dec-11d0-a765-00a0c91e6bf6&address=%7B%22streetAddress%22:%22123+Example+Dr.%22,%22city%22:%22Somewhere%22,%22state%22:%22CA%22,%22zip%22:%2299999%2B1234%22%7D
```

Expand All @@ -1729,7 +1729,7 @@ If it were treated as `application/json`, then the serialized value would be a J

Here is the `id` parameter (without `address`) serialized as `application/json` instead of `text/plain`, and then encoded per RFC1866:

```urlencoded
```uri
id=%22f81d4fae-7dec-11d0-a765-00a0c91e6bf6%22
```

Expand Down Expand Up @@ -1759,7 +1759,7 @@ requestBody:
Given a name of `example` and a solid red 2x2-pixel PNG for `icon`, this
would produce a request body of:

```urlencoded
```uri
name=example&icon=iVBORw0KGgoAAAANSUhEUgAAAAIAAAACCAIAAAD91JpzAAAABGdBTUEAALGPC_xhBQAAADhlWElmTU0AKgAAAAgAAYdpAAQAAAABAAAAGgAAAAAAAqACAAQAAAABAAAAAqADAAQAAAABAAAAAgAAAADO0J6QAAAAEElEQVQIHWP8zwACTGCSAQANHQEDqtPptQAAAABJRU5ErkJggg%3D%3D
```

Expand Down Expand Up @@ -4213,13 +4213,13 @@ parameters:

This translates to the following URI Template:

```urlencoded
```uritemplate
{?formulas*,words}
```

when expanded with the data given earlier, we get:

```urlencoded
```uri
?a=x%2By&b=x%2Fy&c=x%5Ey&words=math,is,fun
```

Expand Down Expand Up @@ -4253,7 +4253,7 @@ So we need to restructure the data to fit a manually constructed URI Template th

Here is one such template, using a made-up convention of `words.0` for the first entry in the words value, `words.1` for the second, and `words.2` for the third:

```urlencoded
```uritemplate
?a={+a}&b={+b}&c={+c}&words={words.0} {words.1} {words.2}
```

Expand All @@ -4279,7 +4279,7 @@ words.2: fun

Expanding our manually assembled template with our restructured data yields the following query string:

```urlencoded
```uri
?a=x%2By&b=x/y&c=x%5Ey&words=math%20is%20fun
```

Expand All @@ -4298,7 +4298,7 @@ words:

Using this data with our original RFC6570-friendly URI Template, `{?formulas*,words}`, produces the following:

```urlencoded
```uri
?words=hello,world
```

Expand All @@ -4313,13 +4313,13 @@ words.1: world

Manually constructed URI Template:

```urlencoded
```uritemplate
?words={words.0} {words.1}
```

Result:

```urlencoded
```uri
?words=hello%20world
```

Expand All @@ -4342,13 +4342,13 @@ Instead, we have to pre-percent-encode the name (which is a six-octet UTF-8 sequ
"%E2%9D%A4%EF%B8%8F": love!
```

```urlencoded
```uritemplate
{?%E2%9D%A4%EF%B8%8F}
```

This will expand to the result:

```urlencoded
```uri
?%E2%9D%A4%EF%B8%8F=love%21
```

Expand Down