swagger-api / swagger-api/swagger-ui
Swagger UI Could not resolve reference: Could not resolve pointer: After upgrading to SwashBuckle 6.3.0 with latest Swagger UI
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 29k
- Forks
- 9.3k
- Avg merge
- 2d 23h
- Merged PRs (30d)
- 25
Description
I am experiencing an issue with the Swagger UI after upgrading from Swashbuckle 6.2.3 to 6.3.0.
After some investigation, the issue appears to be with Swagger UI and not the swagger.json document generated by Swashbuckle, hence my posting here.
When navigating to the Swagger UI, and expanding one of my methods, the "Example Value | Schema" section simply displays
"string"
At the top of the Swagger UI a message appears:
Resolver error at paths./request/requestsingledevicefromsite.post.requestBody.content.application/json.schema.$ref
Could not resolve reference: Could not resolve pointer: /components/schemas/Advanced.Cloud.Live.DomainModel.FireSystemDigitalTwin.Sychronisation.OutboundRequest.CQRS.RequestStatusOfSingleDeviceAtSite+Command does not exist in document
I browsed the generated swagger.json document, and looked for the "Advanced.Cloud.Live.DomainModel.FireSystemDigitalTwin.Sychronisation.OutboundRequest.CQRS.RequestStatusOfSingleDeviceAtSite+Command" reference.
I find it within the "paths" object, and see that the "$ref" property is pointing to the "Advanced.Cloud.Live.DomainModel.FireSystemDigitalTwin.Sychronisation.OutboundRequest.CQRS.RequestStatusOfSingleDeviceAtSite+Command" object.
"/request/requestsingledevicefromsite": {
"post": {
"tags": [
"FireSystemRequest"
],
"operationId": "RequestSingleDeviceFromSite",
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Advanced.Cloud.Live.DomainModel.FireSystemDigitalTwin.Sychronisation.OutboundRequest.CQRS.RequestStatusOfSingleDeviceAtSite+Command"
}
}
}
},
"responses": {
"201": {
"description": "Created"
},
"401": {
"description": "Unauthorized",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
}
}
}
},
"400": {
"description": "Bad Request",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
}
}
}
},
"403": {
"description": "Forbidden"
}
}
}
},
Further down the swagger.json document, the reference is located, within the "components" / "schemas" section:
"Advanced.Cloud.Live.DomainModel.FireSystemDigitalTwin.Sychronisation.OutboundRequest.CQRS.RequestStatusOfSingleDeviceAtSite+Command": {
"type": "object",
"properties": {
"SiteId": {
"type": "string",
"format": "uuid"
},
"NodeId": {
"type": "integer",
"format": "int32"
},
"Loop": {
"type": "integer",
"format": "int32"
},
"Address": {
"type": "integer",
"format": "int32"
},
"SubAddress": {
"type": "integer",
"format": "int32"
}
},
"additionalProperties": false
},
I downloaded the swagger.json generated by both the v6.2.3 and v6.3.0 Swashbuckle, performing a text diff on the 2 files. They are almost identical, apart from the HTTP 201 responses having a description of "Success" in the v6.2.3 document and "Created" in the v6.3.0 document.
I believe Swashbuckle recently upgraded from Swagger UI 4.1.3 to 4.5.0
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the resolver error in Swagger UI 4.5.0 with the supplied swagger.json and compare it with the 4.1.3 behavior and Swashbuckle 6.2.3 output. Trace how the requestBody schema $ref is resolved in the Swagger UI code; done means the referenced Command schema renders instead of showing the resolver error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, openapi
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100