Created
April 15, 2016 15:27
-
-
Save JamesMessinger/e867ccd425e730634ee71f43c462a34f to your computer and use it in GitHub Desktop.
This example demonstrates a URL-encoded JSON Pointer in a Swagger 2.0 API definition
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
swagger: "2.0" | |
info: | |
version: 1.0.0 | |
title: Blog | |
paths: | |
"/blogs/{id}/posts": | |
parameters: | |
- name: "id" | |
in: "path" | |
type: "integer" | |
required: true | |
post: | |
summary: Add a new post to a blog | |
responses: | |
201: | |
description: Created | |
schema: | |
title: BlogPost | |
type: object | |
properties: | |
id: | |
type: integer | |
title: | |
type: string | |
author: | |
type: string | |
get: | |
summary: Get a list of posts for a blog | |
parameters: | |
- name: "id" | |
in: "path" | |
type: "integer" | |
required: true | |
responses: | |
200: | |
description: Success | |
schema: | |
type: array | |
items: | |
# This line works in Swagger Editor, | |
# but the "{" and "}" characters are technically invalid, | |
# according to RFC 6901, sections 5 & 6 - https://tools.ietf.org/html/rfc6901#section-5 | |
# $ref: "#/paths/~1blogs~1{id}~1posts/post/responses/201/schema" | |
# This line is valid, according to RFC 6901 | |
# (the "{" and "}" characters have been encoded) | |
# But, it doesn't work in Swagger Editor | |
$ref: "#/paths/~1blogs~1%7Bid%7D~1posts/post/responses/201/schema" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment