Python 烧瓶嵌套rest api摆动器不工作
错误隐藏解析程序错误位于 definitions.Person.properties.address.$ref无法解析引用 因为:无法解析指针:/NestedModel在中不存在 文件Python 烧瓶嵌套rest api摆动器不工作,python,flask,Python,Flask,错误隐藏解析程序错误位于 definitions.Person.properties.address.$ref无法解析引用 因为:无法解析指针:/NestedModel在中不存在 文件 最后,我能够用下面的代码解决这个问题 nested_fields=api.schema_model('NestedModel',{'name':fields.String}) person=address=api.schema\u模型('person'{ “必需”:[“地址”], “属性”:{ “姓名”:{ “
最后,我能够用下面的代码解决这个问题
nested_fields=api.schema_model('NestedModel',{'name':fields.String})
person=address=api.schema\u模型('person'{
“必需”:[“地址”],
“属性”:{
“姓名”:{
“类型”:“字符串”
},
“年龄”:{
'type':'integer'
},
“生日”:{
'类型':'字符串',
“格式”:“日期时间”
},
“地址”:{
“属性”:{
“论点”:{
“类型”:“数组”,
“项目”:{
}
}
},
“类型”:“对象”
}
},
“类型”:“对象”
})
您的错误与代码不符。代码:/definitions/Address
,错误:/NestedModel
。
address = api.schema_model('Address', {
'properties': {
'road': {
'type': 'string'
},
},
'type': 'object' })
person = address = api.schema_model('Person', {
'required': ['address'],
'properties': {
'name': {
'type': 'string'
},
'age': {
'type': 'integer'
},
'birthdate': {
'type': 'string',
'format': 'date-time'
},
'address': {
'$ref': '#/definitions/Address',
}
},
'type': 'object' })