Skip to content

Commit

Permalink
feat: adding an example definition that has a circular $ref
Browse files Browse the repository at this point in the history
  • Loading branch information
erunion committed May 5, 2022
1 parent 2ff6ec4 commit d29a629
Show file tree
Hide file tree
Showing 2 changed files with 103 additions and 0 deletions.
62 changes: 62 additions & 0 deletions 3.0/json/circular.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
{
"openapi": "3.0.1",
"info": {
"title": "API definition with a circular $ref",
"version": "1.0.0"
},
"servers": [
{
"url": "https://httpbin.org"
}
],
"paths": {
"/anything": {
"get": {
"responses": {
"200": {
"description": "OK"
},
"404": {
"description": "Not found",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorMessage"
}
}
}
}
}
}
}
},
"components": {
"schemas": {
"ErrorMessage": {
"type": "object",
"additionalProperties": false,
"properties": {
"statusCode": {
"type": "integer",
"format": "int32"
},
"error": {
"type": "string",
"nullable": true
},
"inner": {
"$ref": "#/components/schemas/ErrorMessage"
},
"canBeRetried": {
"type": "string",
"enum": ["Unknown", "Yes", "No"]
},
"detailedErrorCode": {
"type": "integer",
"format": "int32"
}
}
}
}
}
}
41 changes: 41 additions & 0 deletions 3.0/yaml/circular.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
openapi: 3.0.1
info:
title: API definition with a circular $ref
version: 1.0.0
servers:
- url: https://httpbin.org
paths:
'/anything':
get:
responses:
'200':
description: OK
'404':
description: Not found
content:
application/json:
schema:
'$ref': '#/components/schemas/ErrorMessage'
components:
schemas:
ErrorMessage:
type: object
additionalProperties: false
properties:
statusCode:
type: integer
format: int32
error:
type: string
nullable: true
inner:
'$ref': '#/components/schemas/ErrorMessage'
canBeRetried:
type: string
enum:
- Unknown
- 'Yes'
- 'No'
detailedErrorCode:
type: integer
format: int32

0 comments on commit d29a629

Please sign in to comment.