Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fail to parse circular reference defined in external file: wrong file path is updated to ref value #308

Closed
xiaoxuqi-ms opened this issue Feb 12, 2023 · 0 comments

Comments

@xiaoxuqi-ms
Copy link

file1.json:
{
"swagger": "2.0",
"paths": {
"/:analyze-text": {
"post": {
"parameters": [
{
"$ref": "common.json#/parameters/ApiVersionParameter"
}
],
"responses": {
"default": {
"description": "Unexpected error",
"schema": {
"$ref": "common.json#/definitions/ErrorResponse"
}
}
}
}
}
},
"definitions": {
"DocumentError": {
"type": "object",
"required": [
"error"
],
"properties": {
"error": {
"type": "object",
"description": "Document Error.",
"$ref": "common.json#/definitions/Error"
}
}
}
}
}

File2.json
{
"swagger": "2.0",
"paths": {},
"definitions": {
"ErrorResponse": {
"type": "object",
"description": "Error response.",
"additionalProperties": false,
"properties": {
"error": {
"description": "The error object.",
"$ref": "#/definitions/Error"
}
},
"required": [
"error"
]
},
"Error": {
"type": "object",
"description": "The error object.",
"additionalProperties": true,
"required": [
"code",
"message"
],
"properties": {
"message": {
"type": "string",
"description": "A human-readable representation of the error."
},
"target": {
"type": "string",
"description": "The target of the error."
},
"details": {
"type": "array",
"description": "An array of details about specific errors that led to this reported error.",
"items": {
"$ref": "#/definitions/Error"
}
}
}
}
},
"parameters": {
"ApiVersionParameter": {
"name": "api-version",
"in": "query",
"required": true,
"type": "string",
"description": "Client API version."
}
}
}
After deference with option circular: ignore
{
swagger: "2.0",

paths: {
"/:analyze-text": {
post: {
summary: "Request text analysis over a collection of documents.",
operationId: "AnalyzeText",
consumes: [
"application/json",
],
produces: [
"application/json",
],
parameters: [
{
name: "api-version",
in: "query",
required: true,
type: "string",
description: "Client API version.",
},
],
responses: {
default: {
schema: {
$ref: "common.json#/definitions/ErrorResponse",
},
},
},
},
},
},
definitions: {
DocumentError: {
type: "object",
required: [
"error",
],
properties: {
error: {
$ref: "#/definitions/Error",//wrong filepath since Error is defined in external file
type: "object",
},
},
},
},
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants