-
Notifications
You must be signed in to change notification settings - Fork 4
Circular references in API #21
Copy link
Copy link
Open
Description
Hi,
If domain.User contains properties: parent: $ ref: '# /definitions/domain.User', then I get the output
⢀⠀ 0/2A bug occurred.
Please report an issue on the 'test-openapi-plugin-spec' code repository and paste the following lines:
RangeError: Maximum call stack size exceeded
at Array Iterator.next (<anonymous>)
at Object.entries.map (/usr/local/lib/node_modules/test-openapi/build/src/utils/crawl.js:36:42)
at Array.map (<anonymous>)
at crawlChildren (/usr/local/lib/node_modules/test-openapi/build/src/utils/crawl.js:36:38)
at crawlNode (/usr/local/lib/node_modules/test-openapi/build/src/utils/crawl.js:20:14)
at crawlProperty (/usr/local/lib/node_modules/test-openapi/build/src/utils/crawl.js:47:25)
at Object.entries.map (/usr/local/lib/node_modules/test-openapi/build/src/utils/crawl.js:37:1)
at Array.map (<anonymous>)
at crawlChildren (/usr/local/lib/node_modules/test-openapi/build/src/utils/crawl.js:36:38)
at crawlNode (/usr/local/lib/node_modules/test-openapi/build/src/utils/crawl.js:20:14)
spec.yaml
definitions:
domain.User:
properties:
parent:
$ref: '#/definitions/domain.User'
comments:
type: string
created_at:
type: string
deleted_at:
type: string
email:
type: string
id:
type: integer
is_active:
type: boolean
is_deleted:
type: boolean
number:
type: string
parent_id:
type: integer
parent_title:
type: string
parent_uuid:
type: string
password:
type: string
phone:
type: string
position:
type: string
title:
type: string
updated_at:
type: string
username:
type: string
uuid:
type: string
vendor_id:
type: integer
vendor_title:
type: string
vendor_uuid:
type: string
type: object
webservices.ShowUserResponse:
properties:
_to:
type: string
errors:
items:
type: string
type: array
success:
items:
type: string
type: array
user:
$ref: '#/definitions/domain.User'
warnings:
items:
type: string
type: array
type: object
webservices.ShowUsersResponse:
properties:
_to:
type: string
errors:
items:
type: string
type: array
success:
items:
type: string
type: array
users:
items:
$ref: '#/definitions/domain.User'
type: array
warnings:
items:
type: string
type: array
type: object
info:
contact: {}
description: ""
title: ""
version: ""
paths:
/users:
get:
operationId: show-users
parameters:
- in: query
name: vendor
type: string
- in: query
name: parent
type: string
- in: query
name: created_since
type: string
- in: query
name: created_before
type: string
- enum:
- administrator
- manager
- teacher
- agent
- contractor
- listener
in: query
name: role
type: string
- in: query
name: active_only
type: integer
- in: query
name: without_orders_only
type: integer
- in: query
maxLength: 32
minLength: 3
name: q
type: string
- in: query
name: _page
type: integer
produces:
- application/json; charset=utf-8
responses:
"200":
description: OK
schema:
$ref: '#/definitions/webservices.ShowUsersResponse'
"400":
description: Bad Request
schema:
type: string
"403":
description: Forbidden
schema:
type: string
"404":
description: Not Found
schema:
type: string
"500":
description: Internal Server Error
schema:
type: string
security:
- ApiKeyAuth: []
/users/{user}:
get:
operationId: show-user
parameters:
- in: path
name: user
required: true
type: string
produces:
- application/json; charset=utf-8
responses:
"200":
description: OK
schema:
$ref: '#/definitions/webservices.ShowUserResponse'
"400":
description: Bad Request
schema:
type: string
"403":
description: Forbidden
schema:
type: string
"404":
description: Not Found
schema:
type: string
"500":
description: Internal Server Error
schema:
type: string
security:
- ApiKeyAuth: []
securityDefinitions:
ApiKeyAuth:
in: header
name: X-Auth-token
type: apiKey
swagger: "2.0"
tasks.yaml
- name: getUsers
call:
server: http://localhost
headers.x-auth-token: <token>
headers.accept: application/json
spec:
operation: show-users
definition: spec.yaml
- name: getUser
call:
server: http://localhost
headers.x-auth-token: <token>
headers.accept: application/json
url.user: <userId>
spec:
operation: show-users
definition: spec.yaml
Checking the validity of my API says:
This API is valid, but it cannot be shown because it contains circular references
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels