Last active
August 29, 2015 14:09
-
-
Save wking/9c069f482f11b566880c to your computer and use it in GitHub Desktop.
external $ref in a Swagger spec's model properties
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": "Example $ref" | |
}, | |
"host": "example.com", | |
"basePath": "/api", | |
"schemes": [ "http" ], | |
"paths": { | |
"/user": { | |
"get": { | |
"tags": [ "User Operations" ], | |
"summary": "finds users in the system", | |
"responses": { | |
"200": { | |
"description": "user response", | |
"schema": { | |
"type": "array", | |
"items": { | |
"$ref": "#/definitions/User" | |
} | |
} | |
}, | |
"default": { | |
"description": "unexpected error", | |
"schema": { | |
"$ref": "#/definitions/Error" | |
} | |
} | |
} | |
} | |
} | |
}, | |
"definitions": { | |
"User": { | |
"required": [ | |
"id", | |
"name" | |
], | |
"properties": { | |
"id": { | |
"type": "integer", | |
"format": "int64" | |
}, | |
"name": { | |
"type": "string" | |
}, | |
"address": { | |
"$ref": "http://json-schema.org/address" | |
} | |
} | |
}, | |
"Error": { | |
"required": [ | |
"code", | |
"message" | |
], | |
"properties": { | |
"code": { | |
"type": "integer", | |
"format": "int32" | |
}, | |
"message": { | |
"type": "string" | |
} | |
} | |
} | |
} | |
} |
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": "Example $ref" | |
}, | |
"host": "example.com", | |
"basePath": "/api", | |
"schemes": [ "http" ], | |
"paths": { | |
"/user": { | |
"get": { | |
"tags": [ "User Operations" ], | |
"summary": "finds users in the system", | |
"responses": { | |
"200": { | |
"description": "user response", | |
"schema": { | |
"type": "array", | |
"items": { | |
"$ref": "#/definitions/User" | |
} | |
} | |
}, | |
"default": { | |
"description": "unexpected error", | |
"schema": { | |
"$ref": "#/definitions/Error" | |
} | |
} | |
} | |
} | |
} | |
}, | |
"definitions": { | |
"User": { | |
"required": [ | |
"id", | |
"name" | |
], | |
"properties": { | |
"id": { | |
"type": "integer", | |
"format": "int64" | |
}, | |
"name": { | |
"type": "string" | |
}, | |
"address": { | |
"$ref": "#/definitions/Address" | |
} | |
} | |
}, | |
"Address": { | |
"description": "an address following the convention of http://microformats.org/wiki/hcard", | |
"type": "object", | |
"properties": { | |
"post-office-box": { | |
"type": "string" | |
}, | |
"extended-address": { | |
"type": "string" | |
}, | |
"street-address": { | |
"type": "string" | |
}, | |
"locality":{ | |
"type": "string" | |
}, | |
"region": { | |
"type": "string" | |
}, | |
"postal-code": { | |
"type": "string" | |
}, | |
"country-name": { | |
"type": "string" | |
} | |
}, | |
"required": [ | |
"locality", | |
"region", | |
"country-name" | |
] | |
}, | |
"Error": { | |
"required": [ | |
"code", | |
"message" | |
], | |
"properties": { | |
"code": { | |
"type": "integer", | |
"format": "int32" | |
}, | |
"message": { | |
"type": "string" | |
} | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment