Swagger Resolver 错误,无法解析参考:
Swagger Resolver error, Could not resolve reference:
我正在建立一个新的 asp.net 核心 3.1 项目,以 FHIR 格式公开一个 RESTful API,这是一种扩展 JSON.
我想用 SwaggerUI 制作一个简单的 UI。这就是我遇到的问题,显示错误。
启动 SwaggerUI 时没有错误。展开单个可用 POST 请求时,会出现以下错误:
完整列表:
Resolver error at paths./Bundle/$analyze.post.requestBody.content.text/json.schema.properties.parameter.items.properties.children.items.properties.children.items.$ref
Could not resolve reference:
Resolver error at paths./Bundle/$analyze.post.requestBody.content.text/json.schema.properties.parameter.items.properties.extension.items.properties.extension.items.$ref
Could not resolve reference:
Resolver error at paths./Bundle/$analyze.post.requestBody.content.text/json.schema.properties.idElement.properties.extension.items.properties.extension.items.$ref
Could not resolve reference:
Resolver error at paths./Bundle/$analyze.post.requestBody.content.text/json.schema.properties.idElement.properties.children.items.properties.children.items.$ref
Could not resolve reference:
Resolver error at paths./Bundle/$analyze.post.requestBody.content.text/json.schema.properties.meta.properties.children.items.properties.children.items.$ref
Could not resolve reference:
Resolver error at paths./Bundle/$analyze.post.requestBody.content.text/json.schema.properties.meta.properties.extension.items.properties.extension.items.$ref
Could not resolve reference:
Resolver error at paths./Bundle/$analyze.post.requestBody.content.text/json.schema.properties.implicitRulesElement.properties.extension.items.properties.extension.items.$ref
Could not resolve reference:
Resolver error at paths./Bundle/$analyze.post.requestBody.content.text/json.schema.properties.implicitRulesElement.properties.children.items.properties.children.items.$ref
Could not resolve reference:
Resolver error at paths./Bundle/$analyze.post.requestBody.content.text/json.schema.properties.languageElement.properties.extension.items.properties.extension.items.$ref
Could not resolve reference:
Resolver error at paths./Bundle/$analyze.post.requestBody.content.text/json.schema.properties.languageElement.properties.children.items.properties.children.items.$ref
Could not resolve reference:
Resolver error at paths./Bundle/$analyze.post.responses.200.content.text/plain.schema.properties.children.items.properties.children.items.$ref
Could not resolve reference:
Resolver error at paths./Bundle/$analyze.post.responses.200.content.application/json.schema.properties.identifier.properties.assigner.properties.identifier.$ref
Could not resolve reference:
Resolver error at paths./Bundle/$analyze.post.responses.200.content.application/json.schema.properties.identifier.properties.children.items.properties.children.items.$ref
Could not resolve reference:
Resolver error at paths./Bundle/$analyze.post.responses.200.content.application/json.schema.properties.identifier.properties.extension.items.properties.extension.items.$ref
Could not resolve reference:
Resolver error at paths./Bundle/$analyze.post.responses.200.content.application/json.schema.properties.typeElement.properties.extension.items.properties.extension.items.$ref
Could not resolve reference:
Resolver error at paths./Bundle/$analyze.post.responses.200.content.application/json.schema.properties.typeElement.properties.children.items.properties.children.items.$ref
Could not resolve reference:
Resolver error at paths./Bundle/$analyze.post.responses.200.content.application/json.schema.properties.timestampElement.properties.extension.items.properties.extension.items.$ref
Could not resolve reference:
Resolver error at paths./Bundle/$analyze.post.responses.200.content.application/json.schema.properties.timestampElement.properties.children.items.properties.children.items.$ref
Could not resolve reference:
Resolver error at paths./Bundle/$analyze.post.responses.200.content.application/json.schema.properties.totalElement.properties.extension.items.properties.extension.items.$ref
Could not resolve reference:
Resolver error at paths./Bundle/$analyze.post.responses.200.content.application/json.schema.properties.totalElement.properties.children.items.properties.children.items.$ref
Could not resolve reference:
Resolver error at paths./Bundle/$analyze.post.responses.200.content.application/json.schema.properties.link.items.properties.children.items.properties.children.items.$ref
Could not resolve reference:
Resolver error at paths./Bundle/$analyze.post.responses.200.content.application/json.schema.properties.link.items.properties.modifierExtension.items.properties.extension.items.$ref
Could not resolve reference:
Resolver error at paths./Bundle/$analyze.post.responses.200.content.application/json.schema.properties.link.items.properties.extension.items.properties.extension.items.$ref
Could not resolve reference:
Resolver error at paths./Bundle/$analyze.post.responses.200.content.application/json.schema.properties.entry.items.properties.children.items.properties.children.items.$ref
Could not resolve reference:
Resolver error at paths./Bundle/$analyze.post.responses.200.content.application/json.schema.properties.entry.items.properties.modifierExtension.items.properties.extension.items.$ref
Could not resolve reference:
Resolver error at paths./Bundle/$analyze.post.responses.200.content.application/json.schema.properties.entry.items.properties.extension.items.properties.extension.items.$ref
Could not resolve reference:
Resolver error at paths./Bundle/$analyze.post.responses.200.content.application/json.schema.properties.signature.properties.who.properties.identifier.$ref
Could not resolve reference:
Resolver error at paths./Bundle/$analyze.post.responses.200.content.application/json.schema.properties.signature.properties.onBehalfOf.properties.identifier.$ref
Could not resolve reference:
Resolver error at paths./Bundle/$analyze.post.responses.200.content.application/json.schema.properties.signature.properties.children.items.properties.children.items.$ref
Could not resolve reference:
Resolver error at paths./Bundle/$analyze.post.responses.200.content.application/json.schema.properties.signature.properties.extension.items.properties.extension.items.$ref
Could not resolve reference:
Resolver error at paths./Bundle/$analyze.post.requestBody.content.application/json.schema.properties.parameter.items.properties.nameElement.properties.extension.items.properties.children.items.properties.children.items.$ref
Could not resolve reference:
Resolver error at paths./Bundle/$analyze.post.requestBody.content.application/json.schema.properties.parameter.items.properties.nameElement.properties.extension.items.properties.extension.items.$ref
Could not resolve reference:
Resolver error at paths./Bundle/$analyze.post.requestBody.content.application/json.schema.properties.parameter.items.properties.nameElement.properties.children.items.properties.children.items.$ref
Could not resolve reference:
Resolver error at paths./Bundle/$analyze.post.requestBody.content.application/json.schema.properties.parameter.items.properties.value.properties.children.items.properties.children.items.$ref
Could not resolve reference:
Resolver error at paths./Bundle/$analyze.post.requestBody.content.application/json.schema.properties.parameter.items.properties.value.properties.extension.items.properties.extension.items.$ref
Could not resolve reference:
Resolver error at paths./Bundle/$analyze.post.requestBody.content.application/json.schema.properties.parameter.items.properties.resource.properties.children.items.properties.children.items.$ref
Could not resolve reference:
Resolver error at paths./Bundle/$analyze.post.requestBody.content.application/json.schema.properties.parameter.items.properties.resource.properties.idElement.properties.extension.items.properties.extension.items.$ref
Could not resolve reference:
Resolver error at paths./Bundle/$analyze.post.requestBody.content.application/json.schema.properties.parameter.items.properties.part.items.$ref
Could not resolve reference:
Resolver error at paths./Bundle/$analyze.post.requestBody.content.application/json.schema.properties.parameter.items.properties.modifierExtension.items.properties.children.items.properties.children.items.$ref
Could not resolve reference:
Resolver error at paths./Bundle/$analyze.post.requestBody.content.application/json.schema.properties.children.items.properties.children.items.$ref
Could not resolve reference:
Resolver error at paths./Bundle/$analyze.post.requestBody.content.application/json.schema.properties.meta.properties.profileElement.items.properties.extension.items.properties.extension.items.$ref
Could not resolve reference:
Resolver error at paths./Bundle/$analyze.post.requestBody.content.application/json.schema.properties.meta.properties.profileElement.items.properties.children.items.properties.children.items.$ref
Could not resolve reference:
Resolver error at paths./Bundle/$analyze.post.requestBody.content.application/json.schema.properties.meta.properties.security.items.properties.children.items.properties.children.items.$ref
Could not resolve reference:
Resolver error at paths./Bundle/$analyze.post.requestBody.content.application/json.schema.properties.meta.properties.security.items.properties.extension.items.properties.extension.items.$ref
Could not resolve reference:
Resolver error at paths./Bundle/$analyze.post.requestBody.content.text/json.schema.properties.parameter.items.properties.modifierExtension.items.properties.extension.items.$ref
Could not resolve reference:
Resolver error at paths./Bundle/$analyze.post.requestBody.content.text/json.schema.properties.meta.properties.security.items.properties.userSelectedElement.properties.extension.items.properties.extension.items.$ref
Could not resolve reference:
Resolver error at paths./Bundle/$analyze.post.requestBody.content.text/json.schema.properties.meta.properties.security.items.properties.userSelectedElement.properties.children.items.properties.children.items.$ref
Could not resolve reference:
Resolver error at paths./Bundle/$analyze.post.responses.200.content.text/plain.schema.properties.identifier.properties.useElement.properties.extension.items.properties.extension.items.$ref
Could not resolve reference:
Resolver error at paths./Bundle/$analyze.post.responses.200.content.text/plain.schema.properties.identifier.properties.useElement.properties.children.items.properties.children.items.$ref
Could not resolve reference:
Resolver error at paths./Bundle/$analyze.post.responses.200.content.text/plain.schema.properties.identifier.properties.type.properties.children.items.properties.children.items.$ref
Could not resolve reference:
Resolver error at paths./Bundle/$analyze.post.responses.200.content.text/plain.schema.properties.identifier.properties.type.properties.extension.items.properties.extension.items.$ref
Could not resolve reference:
Resolver error at paths./Bundle/$analyze.post.responses.200.content.text/plain.schema.properties.identifier.properties.period.properties.children.items.properties.children.items.$ref
Could not resolve reference:
Resolver error at paths./Bundle/$analyze.post.responses.200.content.text/plain.schema.properties.identifier.properties.period.properties.extension.items.properties.extension.items.$ref
Could not resolve reference:
Resolver error at paths./Bundle/$analyze.post.responses.200.content.text/plain.schema.properties.identifier.properties.assigner.properties.identifier.$ref
Could not resolve reference:
Resolver error at paths./Bundle/$analyze.post.responses.200.content.text/plain.schema.properties.identifier.properties.assigner.properties.children.items.properties.children.items.$ref
Could not resolve reference:
Resolver error at paths./Bundle/$analyze.post.responses.200.content.text/plain.schema.properties.identifier.properties.assigner.properties.extension.items.properties.extension.items.$ref
Could not resolve reference:
Resolver error at paths./Bundle/$analyze.post.responses.200.content.text/plain.schema.properties.entry.items.properties.search.properties.children.items.properties.children.items.$ref
Could not resolve reference:
Resolver error at paths./Bundle/$analyze.post.responses.200.content.text/plain.schema.properties.entry.items.properties.search.properties.modifierExtension.items.properties.extension.items.$ref
Could not resolve reference:
Resolver error at paths./Bundle/$analyze.post.responses.200.content.text/plain.schema.properties.entry.items.properties.search.properties.extension.items.properties.extension.items.$ref
Could not resolve reference:
Resolver error at paths./Bundle/$analyze.post.responses.200.content.text/plain.schema.properties.entry.items.properties.request.properties.children.items.properties.children.items.$ref
Could not resolve reference:
Resolver error at paths./Bundle/$analyze.post.responses.200.content.text/plain.schema.properties.entry.items.properties.request.properties.modifierExtension.items.properties.extension.items.$ref
Could not resolve reference:
Resolver error at paths./Bundle/$analyze.post.responses.200.content.text/plain.schema.properties.entry.items.properties.request.properties.extension.items.properties.extension.items.$ref
Could not resolve reference:
Resolver error at paths./Bundle/$analyze.post.responses.200.content.text/plain.schema.properties.entry.items.properties.response.properties.children.items.properties.children.items.$ref
Could not resolve reference:
Resolver error at paths./Bundle/$analyze.post.responses.200.content.text/plain.schema.properties.entry.items.properties.response.properties.modifierExtension.items.properties.extension.items.$ref
Could not resolve reference:
Resolver error at paths./Bundle/$analyze.post.responses.200.content.text/plain.schema.properties.entry.items.properties.response.properties.extension.items.properties.extension.items.$ref
Could not resolve reference:
Resolver error at paths./Bundle/$analyze.post.responses.200.content.text/plain.schema.properties.signature.properties.dataElement.properties.extension.items.properties.extension.items.$ref
Could not resolve reference:
Resolver error at paths./Bundle/$analyze.post.responses.200.content.text/plain.schema.properties.signature.properties.dataElement.properties.children.items.properties.children.items.$ref
Could not resolve reference:
Resolver error at paths./Bundle/$analyze.post.responses.200.content.application/json.schema.properties.identifier.properties.period.properties.startElement.properties.extension.items.properties.extension.items.$ref
Could not resolve reference:
Resolver error at paths./Bundle/$analyze.post.responses.200.content.application/json.schema.properties.identifier.properties.period.properties.startElement.properties.children.items.properties.children.items.$ref
Could not resolve reference:
Resolver error at paths./Bundle/$analyze.post.responses.200.content.application/json.schema.properties.entry.items.properties.search.properties.modeElement.properties.extension.items.properties.extension.items.$ref
Could not resolve reference:
Resolver error at paths./Bundle/$analyze.post.responses.200.content.application/json.schema.properties.entry.items.properties.search.properties.modeElement.properties.children.items.properties.children.items.$ref
Could not resolve reference:
Resolver error at paths./Bundle/$analyze.post.responses.200.content.application/json.schema.properties.entry.items.properties.search.properties.scoreElement.properties.extension.items.properties.extension.items.$ref
Could not resolve reference:
Resolver error at paths./Bundle/$analyze.post.responses.200.content.application/json.schema.properties.entry.items.properties.search.properties.scoreElement.properties.children.items.properties.children.items.$ref
Could not resolve reference:
Resolver error at paths./Bundle/$analyze.post.responses.200.content.application/json.schema.properties.entry.items.properties.request.properties.methodElement.properties.extension.items.properties.extension.items.$ref
Could not resolve reference:
Resolver error at paths./Bundle/$analyze.post.responses.200.content.application/json.schema.properties.entry.items.properties.request.properties.methodElement.properties.children.items.properties.children.items.$ref
Could not resolve reference:
控制器方法:
[HttpPost("$analyze")]
public async Task<ActionResult<Bundle>> Analyze([FromBody]Parameters parameters)
{
[...]
return Ok();
}
输入(Parameters
)和输出(Bundle
)参数是Hl7.Fhir.R4(nuget, source)
中包含的对象
正在使用以下软件包:
swagger.json(已截断,因为太长无法发布):
{
"openapi": "3.0.1",
"info": {
"title": "Analyzer",
"version": "v1"
},
"paths": {
"/Bundle/$analyze": {
"post": {
"tags": [
"Bundle"
],
"parameters": [],
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Parameters"
}
},
"text/json": {
"schema": {
"$ref": "#/components/schemas/Parameters"
}
},
"application/*+json": {
"schema": {
"$ref": "#/components/schemas/Parameters"
}
}
}
},
"responses": {
"200": {
"description": "Success",
"content": {
"text/plain": {
"schema": {
"$ref": "#/components/schemas/Bundle"
}
},
"application/json": {
"schema": {
"$ref": "#/components/schemas/Bundle"
}
},
"text/json": {
"schema": {
"$ref": "#/components/schemas/Bundle"
}
}
}
}
}
}
}
},
"components": {
"schemas": {
"ResourceType": {
"enum": [
"Account",
"ActivityDefinition",
"AdverseEvent",
"AllergyIntolerance",
"Appointment",
"AppointmentResponse",
"AuditEvent",
"Basic",
"Binary",
"BiologicallyDerivedProduct",
"BodyStructure",
"Bundle",
"CapabilityStatement",
"CarePlan",
"CareTeam",
"CatalogEntry",
"ChargeItem",
"ChargeItemDefinition",
"Claim",
"ClaimResponse",
"ClinicalImpression",
"CodeSystem",
"Communication",
"CommunicationRequest",
"CompartmentDefinition",
"Composition",
"ConceptMap",
"Condition",
"Consent",
"Contract",
"Coverage",
"CoverageEligibilityRequest",
"CoverageEligibilityResponse",
"DetectedIssue",
"Device",
"DeviceDefinition",
"DeviceMetric",
"DeviceRequest",
"DeviceUseStatement",
"DiagnosticReport",
"DocumentManifest",
"DocumentReference",
"DomainResource",
"EffectEvidenceSynthesis",
"Encounter",
[...]
],
"type": "string"
},
"ElementValue": {
"type": "object"
},
"Base": {
"type": "object",
"properties": {
"typeName": {
"type": "string",
"nullable": true,
"readOnly": true
},
"children": {
"type": "array",
"items": {
"$ref": "#/components/schemas/Base"
},
"nullable": true,
"readOnly": true
},
"namedChildren": {
"type": "array",
"items": {
"$ref": "#/components/schemas/ElementValue"
},
"nullable": true,
"readOnly": true
},
"userData": {
"type": "object",
"additionalProperties": {
"type": "object"
},
"nullable": true,
"readOnly": true,
"deprecated": true
}
}
},
"Element": {
"type": "object",
"properties": {
"typeName": {
"type": "string",
"nullable": true,
"readOnly": true
},
"children": {
"type": "array",
"items": {
"$ref": "#/components/schemas/Base"
},
"nullable": true,
"readOnly": true
},
"namedChildren": {
"type": "array",
"items": {
"$ref": "#/components/schemas/ElementValue"
},
"nullable": true,
"readOnly": true
},
"elementId": {
"type": "string",
"nullable": true
},
"extension": {
"type": "array",
"items": {
"$ref": "#/components/schemas/Extension"
},
"nullable": true
},
"userData": {
"type": "object",
"additionalProperties": {
"type": "object"
},
"nullable": true,
"readOnly": true,
"deprecated": true
}
}
},
"Extension": {
"type": "object",
"properties": {
"typeName": {
"type": "string",
"nullable": true,
"readOnly": true
},
"url": {
"type": "string",
"nullable": true
},
"value": {
"$ref": "#/components/schemas/Element"
},
"children": {
"type": "array",
"items": {
"$ref": "#/components/schemas/Base"
},
"nullable": true,
"readOnly": true
},
"namedChildren": {
"type": "array",
"items": {
"$ref": "#/components/schemas/ElementValue"
},
"nullable": true,
"readOnly": true
},
"elementId": {
"type": "string",
"nullable": true
},
"extension": {
"type": "array",
"items": {
"$ref": "#/components/schemas/Extension"
},
"nullable": true
},
"userData": {
"type": "object",
"additionalProperties": {
"type": "object"
},
"nullable": true,
"readOnly": true,
"deprecated": true
}
}
},
[...]
测试功能时,一切正常。
SwaggerUI 试图告诉我什么,我该如何解决这些错误?任何提示将不胜感激
此问题已通过最新的 swashbuckle 版本自行解决
UseInlineDefinitionsForEnums
的调用帮助消除了类似 Resolver error at paths...Could not resolve reference:...
我的情况。
错误是:
Errors
Hide
Resolver error at paths./api/v1/Account/IsTenantAvailable.post.responses.200.content.text/plain.schema.properties.state.$ref
Could not resolve reference: Could not resolve pointer: /components/schemas/TenantAvailabilityState does not exist in document
Resolver error at paths./api/v1/Account/IsTenantAvailable.post.responses.200.content.application/json.schema.properties.state.$ref
Could not resolve reference: Could not resolve pointer: /components/schemas/TenantAvailabilityState does not exist in document
Resolver error at paths./api/v1/Account/IsTenantAvailable.post.responses.200.content.text/json.schema.properties.state.$ref
Could not resolve reference: Could not resolve pointer: /components/schemas/TenantAvailabilityState does not exist in document
引入的调用是:
using Microsoft.Extensions.DependencyInjection;
public class Startup
{
// ...
public IServiceProvider ConfigureServices(IServiceCollection services)
{
// ...
services.AddSwaggerGen(options =>
{
// ...
// calling SwaggerGenOptionsExtensions.UseInlineDefinitionsForEnums(Swashbuckle.AspNetCore.SwaggerGen.SwaggerGenOptions) instead of some UseReferencedDefinitionsForEnums
options.UseInlineDefinitionsForEnums(); // options.UseReferencedDefinitionsForEnums();
// ...
}
// ...
}
}
插入调用而不是注释掉 UseReferencedDefinitionsForEnums
的调用。由于在我的解决方案中将 aspnetcore
升级为 3.1
而被注释掉了。与 3.1 一起使用的版本不再包含此方法,也没有说明应该调用什么。
很明显,这两个调用都与枚举有关。但我不知道它们到底是什么以及为什么这样做,它们是否出于相同的目的以及它们是否有任何不良副作用。但它只是在我的许多端点上按下“试试看”时消除屏幕截图中的这个红色盘子的情况下起作用。
我在版本5.6.3
of Swashbuckle.AspNetCore
. Upgrading to the latest 6.1.1
上遇到的问题没有任何帮助。
我正在建立一个新的 asp.net 核心 3.1 项目,以 FHIR 格式公开一个 RESTful API,这是一种扩展 JSON.
我想用 SwaggerUI 制作一个简单的 UI。这就是我遇到的问题,显示错误。
启动 SwaggerUI 时没有错误。展开单个可用 POST 请求时,会出现以下错误:
完整列表:
Resolver error at paths./Bundle/$analyze.post.requestBody.content.text/json.schema.properties.parameter.items.properties.children.items.properties.children.items.$ref
Could not resolve reference:
Resolver error at paths./Bundle/$analyze.post.requestBody.content.text/json.schema.properties.parameter.items.properties.extension.items.properties.extension.items.$ref
Could not resolve reference:
Resolver error at paths./Bundle/$analyze.post.requestBody.content.text/json.schema.properties.idElement.properties.extension.items.properties.extension.items.$ref
Could not resolve reference:
Resolver error at paths./Bundle/$analyze.post.requestBody.content.text/json.schema.properties.idElement.properties.children.items.properties.children.items.$ref
Could not resolve reference:
Resolver error at paths./Bundle/$analyze.post.requestBody.content.text/json.schema.properties.meta.properties.children.items.properties.children.items.$ref
Could not resolve reference:
Resolver error at paths./Bundle/$analyze.post.requestBody.content.text/json.schema.properties.meta.properties.extension.items.properties.extension.items.$ref
Could not resolve reference:
Resolver error at paths./Bundle/$analyze.post.requestBody.content.text/json.schema.properties.implicitRulesElement.properties.extension.items.properties.extension.items.$ref
Could not resolve reference:
Resolver error at paths./Bundle/$analyze.post.requestBody.content.text/json.schema.properties.implicitRulesElement.properties.children.items.properties.children.items.$ref
Could not resolve reference:
Resolver error at paths./Bundle/$analyze.post.requestBody.content.text/json.schema.properties.languageElement.properties.extension.items.properties.extension.items.$ref
Could not resolve reference:
Resolver error at paths./Bundle/$analyze.post.requestBody.content.text/json.schema.properties.languageElement.properties.children.items.properties.children.items.$ref
Could not resolve reference:
Resolver error at paths./Bundle/$analyze.post.responses.200.content.text/plain.schema.properties.children.items.properties.children.items.$ref
Could not resolve reference:
Resolver error at paths./Bundle/$analyze.post.responses.200.content.application/json.schema.properties.identifier.properties.assigner.properties.identifier.$ref
Could not resolve reference:
Resolver error at paths./Bundle/$analyze.post.responses.200.content.application/json.schema.properties.identifier.properties.children.items.properties.children.items.$ref
Could not resolve reference:
Resolver error at paths./Bundle/$analyze.post.responses.200.content.application/json.schema.properties.identifier.properties.extension.items.properties.extension.items.$ref
Could not resolve reference:
Resolver error at paths./Bundle/$analyze.post.responses.200.content.application/json.schema.properties.typeElement.properties.extension.items.properties.extension.items.$ref
Could not resolve reference:
Resolver error at paths./Bundle/$analyze.post.responses.200.content.application/json.schema.properties.typeElement.properties.children.items.properties.children.items.$ref
Could not resolve reference:
Resolver error at paths./Bundle/$analyze.post.responses.200.content.application/json.schema.properties.timestampElement.properties.extension.items.properties.extension.items.$ref
Could not resolve reference:
Resolver error at paths./Bundle/$analyze.post.responses.200.content.application/json.schema.properties.timestampElement.properties.children.items.properties.children.items.$ref
Could not resolve reference:
Resolver error at paths./Bundle/$analyze.post.responses.200.content.application/json.schema.properties.totalElement.properties.extension.items.properties.extension.items.$ref
Could not resolve reference:
Resolver error at paths./Bundle/$analyze.post.responses.200.content.application/json.schema.properties.totalElement.properties.children.items.properties.children.items.$ref
Could not resolve reference:
Resolver error at paths./Bundle/$analyze.post.responses.200.content.application/json.schema.properties.link.items.properties.children.items.properties.children.items.$ref
Could not resolve reference:
Resolver error at paths./Bundle/$analyze.post.responses.200.content.application/json.schema.properties.link.items.properties.modifierExtension.items.properties.extension.items.$ref
Could not resolve reference:
Resolver error at paths./Bundle/$analyze.post.responses.200.content.application/json.schema.properties.link.items.properties.extension.items.properties.extension.items.$ref
Could not resolve reference:
Resolver error at paths./Bundle/$analyze.post.responses.200.content.application/json.schema.properties.entry.items.properties.children.items.properties.children.items.$ref
Could not resolve reference:
Resolver error at paths./Bundle/$analyze.post.responses.200.content.application/json.schema.properties.entry.items.properties.modifierExtension.items.properties.extension.items.$ref
Could not resolve reference:
Resolver error at paths./Bundle/$analyze.post.responses.200.content.application/json.schema.properties.entry.items.properties.extension.items.properties.extension.items.$ref
Could not resolve reference:
Resolver error at paths./Bundle/$analyze.post.responses.200.content.application/json.schema.properties.signature.properties.who.properties.identifier.$ref
Could not resolve reference:
Resolver error at paths./Bundle/$analyze.post.responses.200.content.application/json.schema.properties.signature.properties.onBehalfOf.properties.identifier.$ref
Could not resolve reference:
Resolver error at paths./Bundle/$analyze.post.responses.200.content.application/json.schema.properties.signature.properties.children.items.properties.children.items.$ref
Could not resolve reference:
Resolver error at paths./Bundle/$analyze.post.responses.200.content.application/json.schema.properties.signature.properties.extension.items.properties.extension.items.$ref
Could not resolve reference:
Resolver error at paths./Bundle/$analyze.post.requestBody.content.application/json.schema.properties.parameter.items.properties.nameElement.properties.extension.items.properties.children.items.properties.children.items.$ref
Could not resolve reference:
Resolver error at paths./Bundle/$analyze.post.requestBody.content.application/json.schema.properties.parameter.items.properties.nameElement.properties.extension.items.properties.extension.items.$ref
Could not resolve reference:
Resolver error at paths./Bundle/$analyze.post.requestBody.content.application/json.schema.properties.parameter.items.properties.nameElement.properties.children.items.properties.children.items.$ref
Could not resolve reference:
Resolver error at paths./Bundle/$analyze.post.requestBody.content.application/json.schema.properties.parameter.items.properties.value.properties.children.items.properties.children.items.$ref
Could not resolve reference:
Resolver error at paths./Bundle/$analyze.post.requestBody.content.application/json.schema.properties.parameter.items.properties.value.properties.extension.items.properties.extension.items.$ref
Could not resolve reference:
Resolver error at paths./Bundle/$analyze.post.requestBody.content.application/json.schema.properties.parameter.items.properties.resource.properties.children.items.properties.children.items.$ref
Could not resolve reference:
Resolver error at paths./Bundle/$analyze.post.requestBody.content.application/json.schema.properties.parameter.items.properties.resource.properties.idElement.properties.extension.items.properties.extension.items.$ref
Could not resolve reference:
Resolver error at paths./Bundle/$analyze.post.requestBody.content.application/json.schema.properties.parameter.items.properties.part.items.$ref
Could not resolve reference:
Resolver error at paths./Bundle/$analyze.post.requestBody.content.application/json.schema.properties.parameter.items.properties.modifierExtension.items.properties.children.items.properties.children.items.$ref
Could not resolve reference:
Resolver error at paths./Bundle/$analyze.post.requestBody.content.application/json.schema.properties.children.items.properties.children.items.$ref
Could not resolve reference:
Resolver error at paths./Bundle/$analyze.post.requestBody.content.application/json.schema.properties.meta.properties.profileElement.items.properties.extension.items.properties.extension.items.$ref
Could not resolve reference:
Resolver error at paths./Bundle/$analyze.post.requestBody.content.application/json.schema.properties.meta.properties.profileElement.items.properties.children.items.properties.children.items.$ref
Could not resolve reference:
Resolver error at paths./Bundle/$analyze.post.requestBody.content.application/json.schema.properties.meta.properties.security.items.properties.children.items.properties.children.items.$ref
Could not resolve reference:
Resolver error at paths./Bundle/$analyze.post.requestBody.content.application/json.schema.properties.meta.properties.security.items.properties.extension.items.properties.extension.items.$ref
Could not resolve reference:
Resolver error at paths./Bundle/$analyze.post.requestBody.content.text/json.schema.properties.parameter.items.properties.modifierExtension.items.properties.extension.items.$ref
Could not resolve reference:
Resolver error at paths./Bundle/$analyze.post.requestBody.content.text/json.schema.properties.meta.properties.security.items.properties.userSelectedElement.properties.extension.items.properties.extension.items.$ref
Could not resolve reference:
Resolver error at paths./Bundle/$analyze.post.requestBody.content.text/json.schema.properties.meta.properties.security.items.properties.userSelectedElement.properties.children.items.properties.children.items.$ref
Could not resolve reference:
Resolver error at paths./Bundle/$analyze.post.responses.200.content.text/plain.schema.properties.identifier.properties.useElement.properties.extension.items.properties.extension.items.$ref
Could not resolve reference:
Resolver error at paths./Bundle/$analyze.post.responses.200.content.text/plain.schema.properties.identifier.properties.useElement.properties.children.items.properties.children.items.$ref
Could not resolve reference:
Resolver error at paths./Bundle/$analyze.post.responses.200.content.text/plain.schema.properties.identifier.properties.type.properties.children.items.properties.children.items.$ref
Could not resolve reference:
Resolver error at paths./Bundle/$analyze.post.responses.200.content.text/plain.schema.properties.identifier.properties.type.properties.extension.items.properties.extension.items.$ref
Could not resolve reference:
Resolver error at paths./Bundle/$analyze.post.responses.200.content.text/plain.schema.properties.identifier.properties.period.properties.children.items.properties.children.items.$ref
Could not resolve reference:
Resolver error at paths./Bundle/$analyze.post.responses.200.content.text/plain.schema.properties.identifier.properties.period.properties.extension.items.properties.extension.items.$ref
Could not resolve reference:
Resolver error at paths./Bundle/$analyze.post.responses.200.content.text/plain.schema.properties.identifier.properties.assigner.properties.identifier.$ref
Could not resolve reference:
Resolver error at paths./Bundle/$analyze.post.responses.200.content.text/plain.schema.properties.identifier.properties.assigner.properties.children.items.properties.children.items.$ref
Could not resolve reference:
Resolver error at paths./Bundle/$analyze.post.responses.200.content.text/plain.schema.properties.identifier.properties.assigner.properties.extension.items.properties.extension.items.$ref
Could not resolve reference:
Resolver error at paths./Bundle/$analyze.post.responses.200.content.text/plain.schema.properties.entry.items.properties.search.properties.children.items.properties.children.items.$ref
Could not resolve reference:
Resolver error at paths./Bundle/$analyze.post.responses.200.content.text/plain.schema.properties.entry.items.properties.search.properties.modifierExtension.items.properties.extension.items.$ref
Could not resolve reference:
Resolver error at paths./Bundle/$analyze.post.responses.200.content.text/plain.schema.properties.entry.items.properties.search.properties.extension.items.properties.extension.items.$ref
Could not resolve reference:
Resolver error at paths./Bundle/$analyze.post.responses.200.content.text/plain.schema.properties.entry.items.properties.request.properties.children.items.properties.children.items.$ref
Could not resolve reference:
Resolver error at paths./Bundle/$analyze.post.responses.200.content.text/plain.schema.properties.entry.items.properties.request.properties.modifierExtension.items.properties.extension.items.$ref
Could not resolve reference:
Resolver error at paths./Bundle/$analyze.post.responses.200.content.text/plain.schema.properties.entry.items.properties.request.properties.extension.items.properties.extension.items.$ref
Could not resolve reference:
Resolver error at paths./Bundle/$analyze.post.responses.200.content.text/plain.schema.properties.entry.items.properties.response.properties.children.items.properties.children.items.$ref
Could not resolve reference:
Resolver error at paths./Bundle/$analyze.post.responses.200.content.text/plain.schema.properties.entry.items.properties.response.properties.modifierExtension.items.properties.extension.items.$ref
Could not resolve reference:
Resolver error at paths./Bundle/$analyze.post.responses.200.content.text/plain.schema.properties.entry.items.properties.response.properties.extension.items.properties.extension.items.$ref
Could not resolve reference:
Resolver error at paths./Bundle/$analyze.post.responses.200.content.text/plain.schema.properties.signature.properties.dataElement.properties.extension.items.properties.extension.items.$ref
Could not resolve reference:
Resolver error at paths./Bundle/$analyze.post.responses.200.content.text/plain.schema.properties.signature.properties.dataElement.properties.children.items.properties.children.items.$ref
Could not resolve reference:
Resolver error at paths./Bundle/$analyze.post.responses.200.content.application/json.schema.properties.identifier.properties.period.properties.startElement.properties.extension.items.properties.extension.items.$ref
Could not resolve reference:
Resolver error at paths./Bundle/$analyze.post.responses.200.content.application/json.schema.properties.identifier.properties.period.properties.startElement.properties.children.items.properties.children.items.$ref
Could not resolve reference:
Resolver error at paths./Bundle/$analyze.post.responses.200.content.application/json.schema.properties.entry.items.properties.search.properties.modeElement.properties.extension.items.properties.extension.items.$ref
Could not resolve reference:
Resolver error at paths./Bundle/$analyze.post.responses.200.content.application/json.schema.properties.entry.items.properties.search.properties.modeElement.properties.children.items.properties.children.items.$ref
Could not resolve reference:
Resolver error at paths./Bundle/$analyze.post.responses.200.content.application/json.schema.properties.entry.items.properties.search.properties.scoreElement.properties.extension.items.properties.extension.items.$ref
Could not resolve reference:
Resolver error at paths./Bundle/$analyze.post.responses.200.content.application/json.schema.properties.entry.items.properties.search.properties.scoreElement.properties.children.items.properties.children.items.$ref
Could not resolve reference:
Resolver error at paths./Bundle/$analyze.post.responses.200.content.application/json.schema.properties.entry.items.properties.request.properties.methodElement.properties.extension.items.properties.extension.items.$ref
Could not resolve reference:
Resolver error at paths./Bundle/$analyze.post.responses.200.content.application/json.schema.properties.entry.items.properties.request.properties.methodElement.properties.children.items.properties.children.items.$ref
Could not resolve reference:
控制器方法:
[HttpPost("$analyze")]
public async Task<ActionResult<Bundle>> Analyze([FromBody]Parameters parameters)
{
[...]
return Ok();
}
输入(Parameters
)和输出(Bundle
)参数是Hl7.Fhir.R4(nuget, source)
正在使用以下软件包:
swagger.json(已截断,因为太长无法发布):
{
"openapi": "3.0.1",
"info": {
"title": "Analyzer",
"version": "v1"
},
"paths": {
"/Bundle/$analyze": {
"post": {
"tags": [
"Bundle"
],
"parameters": [],
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Parameters"
}
},
"text/json": {
"schema": {
"$ref": "#/components/schemas/Parameters"
}
},
"application/*+json": {
"schema": {
"$ref": "#/components/schemas/Parameters"
}
}
}
},
"responses": {
"200": {
"description": "Success",
"content": {
"text/plain": {
"schema": {
"$ref": "#/components/schemas/Bundle"
}
},
"application/json": {
"schema": {
"$ref": "#/components/schemas/Bundle"
}
},
"text/json": {
"schema": {
"$ref": "#/components/schemas/Bundle"
}
}
}
}
}
}
}
},
"components": {
"schemas": {
"ResourceType": {
"enum": [
"Account",
"ActivityDefinition",
"AdverseEvent",
"AllergyIntolerance",
"Appointment",
"AppointmentResponse",
"AuditEvent",
"Basic",
"Binary",
"BiologicallyDerivedProduct",
"BodyStructure",
"Bundle",
"CapabilityStatement",
"CarePlan",
"CareTeam",
"CatalogEntry",
"ChargeItem",
"ChargeItemDefinition",
"Claim",
"ClaimResponse",
"ClinicalImpression",
"CodeSystem",
"Communication",
"CommunicationRequest",
"CompartmentDefinition",
"Composition",
"ConceptMap",
"Condition",
"Consent",
"Contract",
"Coverage",
"CoverageEligibilityRequest",
"CoverageEligibilityResponse",
"DetectedIssue",
"Device",
"DeviceDefinition",
"DeviceMetric",
"DeviceRequest",
"DeviceUseStatement",
"DiagnosticReport",
"DocumentManifest",
"DocumentReference",
"DomainResource",
"EffectEvidenceSynthesis",
"Encounter",
[...]
],
"type": "string"
},
"ElementValue": {
"type": "object"
},
"Base": {
"type": "object",
"properties": {
"typeName": {
"type": "string",
"nullable": true,
"readOnly": true
},
"children": {
"type": "array",
"items": {
"$ref": "#/components/schemas/Base"
},
"nullable": true,
"readOnly": true
},
"namedChildren": {
"type": "array",
"items": {
"$ref": "#/components/schemas/ElementValue"
},
"nullable": true,
"readOnly": true
},
"userData": {
"type": "object",
"additionalProperties": {
"type": "object"
},
"nullable": true,
"readOnly": true,
"deprecated": true
}
}
},
"Element": {
"type": "object",
"properties": {
"typeName": {
"type": "string",
"nullable": true,
"readOnly": true
},
"children": {
"type": "array",
"items": {
"$ref": "#/components/schemas/Base"
},
"nullable": true,
"readOnly": true
},
"namedChildren": {
"type": "array",
"items": {
"$ref": "#/components/schemas/ElementValue"
},
"nullable": true,
"readOnly": true
},
"elementId": {
"type": "string",
"nullable": true
},
"extension": {
"type": "array",
"items": {
"$ref": "#/components/schemas/Extension"
},
"nullable": true
},
"userData": {
"type": "object",
"additionalProperties": {
"type": "object"
},
"nullable": true,
"readOnly": true,
"deprecated": true
}
}
},
"Extension": {
"type": "object",
"properties": {
"typeName": {
"type": "string",
"nullable": true,
"readOnly": true
},
"url": {
"type": "string",
"nullable": true
},
"value": {
"$ref": "#/components/schemas/Element"
},
"children": {
"type": "array",
"items": {
"$ref": "#/components/schemas/Base"
},
"nullable": true,
"readOnly": true
},
"namedChildren": {
"type": "array",
"items": {
"$ref": "#/components/schemas/ElementValue"
},
"nullable": true,
"readOnly": true
},
"elementId": {
"type": "string",
"nullable": true
},
"extension": {
"type": "array",
"items": {
"$ref": "#/components/schemas/Extension"
},
"nullable": true
},
"userData": {
"type": "object",
"additionalProperties": {
"type": "object"
},
"nullable": true,
"readOnly": true,
"deprecated": true
}
}
},
[...]
测试功能时,一切正常。
SwaggerUI 试图告诉我什么,我该如何解决这些错误?任何提示将不胜感激
此问题已通过最新的 swashbuckle 版本自行解决
UseInlineDefinitionsForEnums
的调用帮助消除了类似 Resolver error at paths...Could not resolve reference:...
我的情况。
错误是:
Errors
Hide
Resolver error at paths./api/v1/Account/IsTenantAvailable.post.responses.200.content.text/plain.schema.properties.state.$ref
Could not resolve reference: Could not resolve pointer: /components/schemas/TenantAvailabilityState does not exist in document
Resolver error at paths./api/v1/Account/IsTenantAvailable.post.responses.200.content.application/json.schema.properties.state.$ref
Could not resolve reference: Could not resolve pointer: /components/schemas/TenantAvailabilityState does not exist in document
Resolver error at paths./api/v1/Account/IsTenantAvailable.post.responses.200.content.text/json.schema.properties.state.$ref
Could not resolve reference: Could not resolve pointer: /components/schemas/TenantAvailabilityState does not exist in document
引入的调用是:
using Microsoft.Extensions.DependencyInjection;
public class Startup
{
// ...
public IServiceProvider ConfigureServices(IServiceCollection services)
{
// ...
services.AddSwaggerGen(options =>
{
// ...
// calling SwaggerGenOptionsExtensions.UseInlineDefinitionsForEnums(Swashbuckle.AspNetCore.SwaggerGen.SwaggerGenOptions) instead of some UseReferencedDefinitionsForEnums
options.UseInlineDefinitionsForEnums(); // options.UseReferencedDefinitionsForEnums();
// ...
}
// ...
}
}
插入调用而不是注释掉 UseReferencedDefinitionsForEnums
的调用。由于在我的解决方案中将 aspnetcore
升级为 3.1
而被注释掉了。与 3.1 一起使用的版本不再包含此方法,也没有说明应该调用什么。
很明显,这两个调用都与枚举有关。但我不知道它们到底是什么以及为什么这样做,它们是否出于相同的目的以及它们是否有任何不良副作用。但它只是在我的许多端点上按下“试试看”时消除屏幕截图中的这个红色盘子的情况下起作用。
我在版本5.6.3
of Swashbuckle.AspNetCore
. Upgrading to the latest 6.1.1
上遇到的问题没有任何帮助。