-
-
Notifications
You must be signed in to change notification settings - Fork 443
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
Getting Found unresolved ref
errors during parse swagger 2.0 contract
#187
Comments
Could you print out |
|
Seems refs do not get properly rewritten when converting from v2 to v3: components:
schemas:
model.ProductSearchAttributeRequest:
properties:
values:
"$ref": "#/definitions/model.ProductSearchAttributeValueRequest"
... Note how the Something fishy seems to be happening around kin-openapi/openapi2conv/openapi2_conv.go Line 243 in fd25549
Note that this function is not converting allOf oneOf anyOf and not keys either. I'll gladly review any PR sent my way :) |
Still getting same components:
schemas:
model.ProductSearchAttributeValueRequest:
...
model.ProductSearchAttributeRequest:
properties:
values:
"$ref": "#/components/schemas/model.ProductSearchAttributeValueRequest"
... Input JSON: {
"swagger": "2.0",
"info": {
"description": "Test Golang Application",
"version": "1.0",
"title": "Test",
"contact": {
"name": "Test",
"email": "[email protected]"
}
},
"host": "",
"basePath": "/test",
"definitions": {
"model.ProductSearchAttributeValueRequest": {
"type": "object",
"properties": {
"text": {
"type": "string"
}
},
"title": "model.ProductSearchAttributeValueRequest"
},
"model.ProductSearchAttributeRequest": {
"type": "object",
"properties": {
"type": {
"type": "string"
},
"values": {
"$ref": "#/components/schemas/model.ProductSearchAttributeValueRequest"
}
},
"title": "model.ProductSearchAttributeRequest"
}
}
} |
I just tried to test this project with our swagger 2.0 json file. During implementation, i couldn't find a life-saver v2 to v3 converter func or auto converter something like:
I found this simple implementation:
Anyway, the main question is that actually why i am getting
Found unresolved ref errors
.openapi3filter
couldn't recognize our$ref
model i think. Simplifiedjson
is here:main
func:Output:
panic: Validating Swagger failed: Found unresolved ref: '#/definitions/model.ProductSearchAttributeValueRequest'
So,
#/definitions/model.ProductSearchAttributeValueRequest
is defined underdefinitions
as we see. That simplified json is auto-generated file from Swag. I don't know why it throws an error, i think it shouldn't. Should it?The text was updated successfully, but these errors were encountered: