Not able to identify the missed path variables
See original GitHub issueHi,
It’s showing a valid JSON though the path variables are missed to declare. We can find the error, if we keep the same JSON in editor.swagger.io.
Please find the below sample JSON:
{
"swagger": "2.0",
"info": {
"description": "Pets Reference Data",
"version": "1.0",
"title": "Pets Reference Data"
},
"host": "localhost:8080",
"basePath": "/api/pets/referencedata/v1.0",
"tags": [
{
"name": "Pets Reference Data Operations",
"description": "Pets Reference Data Controller"
}
],
"paths": {
"/{tenantId}/categories/{categoryCode}": {
"get": {
"tags": [
"Dynamic Codces Operations"
],
"summary": "Reference Data Service",
"description": "Retrieves the ReferenceData for a given tenant id, category and sub category with language code as english",
"operationId": "Reference Data Service_2",
"produces": [
"*/*"
],
"parameters": [
{
"name": "categoryCode",
"in": "path",
"description": "categoryCode",
"required": true,
"type": "string"
},
{
"name": "subCategoryCode",
"in": "query",
"description": "subCategoryCode",
"required": false,
"type": "string"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/petsDataResponse"
}
},
"401": {
"description": "Unauthorized"
},
"403": {
"description": "Forbidden"
},
"404": {
"description": "Not Found"
}
}
}
}
},
"definitions": {
"Domain": {
"type": "object",
"properties": {
"b2X": {
"type": "string"
},
"documentation": {
"type": "string"
},
"key": {
"type": "string"
},
"memberValue": {
"type": "string"
},
"name": {
"type": "string"
},
"verbalization": {
"type": "string"
}
},
"title": "Domain"
},
"Error": {
"type": "object",
"properties": {
"errorCode": {
"type": "string"
},
"errorDescription": {
"type": "string"
}
},
"title": "Error"
},
"petsDataResponse": {
"type": "object",
"properties": {
"messageElements": {
"$ref": "#/definitions/messageElements"
},
"tenant": {
"$ref": "#/definitions/tenant"
},
"codeReferences": {
"type": "array",
"description": "List of Pet Code References based on input.",
"items": {
"$ref": "#/definitions/PetsReferenecData"
}
}
},
"title": "petsDataResponse",
"description": "A data transfer object to send a response."
},
"messageElements": {
"type": "object",
"properties": {
"businessCorrelationId": {
"type": "string"
},
"errorList": {
"type": "array",
"items": {
"$ref": "#/definitions/Error"
}
},
"messageStatus": {
"type": "string"
}
},
"title": "messageElements",
"description": "A data transfer object, that holds transaction result codes and descriptions."
},
"tenant": {
"type": "object",
"properties": {
"tenantId": {
"type": "number"
},
"tenantName": {
"type": "string"
},
"timezone": {
"type": "string"
}
},
"title": "tenant",
"description": "Holds Tenant's information."
},
"PetsReferenecData": {
"type": "object",
"properties": {
"category": {
"type": "string"
},
"languageCode": {
"type": "string"
},
"subCategory": {
"type": "string"
},
"value": {
"type": "string"
}
},
"title": "PetsReferenecData"
}
}
}
To become a valid swagger json, we need to have the below in parameters list.
{
"name": "tenantId",
"in": "path",
"description": "tenantId",
"required": true,
"type": "string"
}
Swagger editor will report the below issue.
But, this library not able to identify this issue.
Issue Analytics
- State:
- Created 5 years ago
- Comments:6 (4 by maintainers)
Top Results From Across the Web
How to restore the Path environment variable I deleted?
Navigate to C:\Windows\system32\ and find cmd.exe. Right-click on cmd.exe and click Open. This will bring up a command prompt with the ...
Read more >Environment variables missing and can't open advanced ...
First, I am unable to install any new programs. ... The system could not find the environment option that was entered." Foiled again....
Read more >Path Environment Variables - Recognition Trouble - Community
Hi all, I'm having trouble getting the path environment variables that I specified in the "Path Variables" tab to be recognized.
Read more >How to recover deleted environment variables? - Stack Overflow
Go to "My Computer" properties -> "Advanced system settings" -> click on "Advanced" tab -> click on "Environment Variables" button -> Edit "PATH ......
Read more >Working with Environment Variables in Python - Twilio
environ dictionary. If a .env file is not found in the current directory, then the parent directory is searched for it. The search...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Hi, @gracekarina @parameshjava @ymohdriz Unfortunately PRs for this issue do not take into account parameters references defined with
$ref
.io.swagger.v3.parser.OpenAPIV3Parser#readLocation
this method first callsresult = readWithInfo(url,auth);
where your patch happens. The patch analyses parameters and sees only$ref
, so new warning appears. Then resolver works and all references become resolved, and the OpenAPI entity becomes valid, but the warning is kept.Probably the analysis should happen after the resolver works.
I think that this issue should be reopened or another one should be created. What’s better?
@fujigon followed up with issue #976.