Skip to content

Instantly share code, notes, and snippets.

@JamesMessinger
Last active July 31, 2018 09:13
Show Gist options
  • Save JamesMessinger/09dd37c80d3324908ff0 to your computer and use it in GitHub Desktop.
Save JamesMessinger/09dd37c80d3324908ff0 to your computer and use it in GitHub Desktop.
Example of using `allOf` to extend an object in a Swagger API
swagger: "2.0"
info:
version: "1.0.0"
title: minimal
description: News Articles ftw
paths:
/users:
get:
responses:
"200":
description: hello world
definitions:
NewsArticle:
title: NewsArticle
type: object
properties:
id:
type: integer
format: int32
x-mysql-type: int(11)
NewsArticleExt: # tmp
title: NewsArticleExt
type: object
allOf:
- $ref: "#/definitions/NewsArticle"
- properties:
test:
type: string
@erm3nda
Copy link

erm3nda commented Aug 26, 2017

Lol, in your examples the /users path items has no schema defined, so are not calling any of the definitions...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment