Closed Lucas-C closed 7 years ago
Oops sorry, I have not noticed your issue. Will investigate
@Lucas-C can you copy your json file so I can add a test case ?
I won't be able to right now, only in January. But OK, I will paste it here.
{
"swagger": "2.0",
"info": {
"description": "Api Documentation",
"version": "1.0",
"title": "Api Documentation",
"termsOfService": "urn:tos",
"contact": {},
"license": {
"name": "Apache 2.0",
"url": "http://www.apache.org/licenses/LICENSE-2.0"
}
},
"host": "www.myservice.com",
"basePath": "/nf-catalog",
"tags": [
{
"name": "healthcheck-controller",
"description": "Healthcheck Controller"
},
{
"name": "admin-version-controller",
"description": "Admin Version Controller"
},
{
"name": "offers-controller",
"description": "Offers Controller"
}
],
"paths": {
"/api/merchandising/offers/search": {
"get": {
"tags": [
"offers-controller"
],
"summary": "Search offers",
"operationId": "searchOffersUsingGET",
"consumes": [
"application/json"
],
"produces": [
"*/*"
],
"parameters": [
{
"name": "X-Forwarded-Host",
"in": "header",
"description": "Internal use",
"required": false,
"type": "string"
},
{
"name": "source",
"in": "query",
"description": "A client ID (must be constant)",
"required": true,
"type": "string"
},
{
"name": "correlation_id",
"in": "query",
"description": "ID provided trough the same \"Unit of Work\"",
"required": false,
"type": "string"
},
{
"name": "from_index",
"in": "query",
"description": "Start the search from this results page index",
"required": false,
"type": "integer",
"default": 0,
"format": "int32"
},
{
"name": "size",
"in": "query",
"description": "Max results returned",
"required": false,
"type": "integer",
"default": 10,
"format": "int32"
},
{
"name": "tag_include",
"in": "query",
"description": "Mandatory tags, included in the search. Multiple values and wilcards are accepted. e.g. \"language|*\"",
"required": false,
"type": "array",
"items": {
"type": "string"
},
"collectionFormat": "multi"
},
{
"name": "tag_exclude",
"in": "query",
"description": "Forbidden tags, excluded from the search. Multiple values and wilcards are accepted. e.g. \"language|*\"",
"required": false,
"type": "array",
"items": {
"type": "string"
},
"collectionFormat": "multi"
},
{
"name": "tag_with_boost",
"in": "query",
"description": "Tags with boost, used to sort results. Multiple values accepted. your_tag$boost_value. e.g. \"source|article$5\"",
"required": false,
"type": "array",
"items": {
"type": "string"
},
"collectionFormat": "multi"
},
{
"name": "label_date",
"in": "query",
"description": "Date attribute to boost, to control the results sort logic. e.g. \"update_date$2\"",
"required": false,
"type": "string"
},
{
"name": "marketing_weight",
"in": "query",
"description": "Boost on the field marketing_value which represents the quality price ratio or any marketing indicator to promote a product.",
"required": false,
"type": "integer",
"default": 0,
"format": "int32"
},
{
"name": "city",
"in": "query",
"description": "City name to target the search on.",
"required": false,
"type": "string"
},
{
"name": "department",
"in": "query",
"description": "Department name to target the search on.",
"required": false,
"type": "string"
},
{
"name": "region",
"in": "query",
"description": "Region name to target the search on.",
"required": false,
"type": "string"
},
{
"name": "country",
"in": "query",
"description": "Country name to target the search on.",
"required": false,
"type": "string"
},
{
"name": "tourist_area",
"in": "query",
"description": "Tourist area name to target the search on.",
"required": false,
"type": "string"
},
{
"name": "location",
"in": "query",
"description": "Location to target the search on: lat;long$boost. The boost is optionnal and will default to 1. e.g. \"44.77794;026848$1\"",
"required": false,
"type": "string"
},
{
"name": "rr_code",
"in": "query",
"description": "Center the search around this ResaRail code (it can be a train station code or a city code). An optionnal boost (default=1) can be applied: station_code$boost e.g. \"FRNTE$1\"",
"required": false,
"type": "string"
},
{
"name": "max_distance",
"in": "query",
"description": "Max distance in km from the location and/or the train station",
"required": false,
"type": "number",
"default": 20,
"format": "double"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/Offer"
}
}
},
"400": {
"description": "Invalid request"
},
"422": {
"description": "ResaRail code unknown"
},
"401": {
"description": "Unauthorized"
},
"403": {
"description": "Forbidden"
},
"404": {
"description": "Not Found"
}
}
}
}
},
"definitions": {
"Locale": {
"type": "object",
"properties": {
"country": {
"type": "string"
},
"displayCountry": {
"type": "string"
},
"displayLanguage": {
"type": "string"
},
"displayName": {
"type": "string"
},
"displayScript": {
"type": "string"
},
"displayVariant": {
"type": "string"
},
"extensionKeys": {
"type": "array",
"items": {
"$ref": "#/definitions/Character"
}
},
"iso3Country": {
"type": "string"
},
"iso3Language": {
"type": "string"
},
"language": {
"type": "string"
},
"script": {
"type": "string"
},
"unicodeLocaleAttributes": {
"type": "array",
"items": {
"type": "string"
}
},
"unicodeLocaleKeys": {
"type": "array",
"items": {
"type": "string"
}
},
"variant": {
"type": "string"
}
}
},
"Character": {
"type": "object",
"properties": {}
},
"Healthcheck": {
"type": "object",
"properties": {
"connectors": {
"type": "array",
"items": {
"$ref": "#/definitions/PartnerHealth"
}
},
"healthCheckDownFlag": {
"type": "boolean"
},
"status": {
"type": "string",
"enum": [
[
"100",
"101",
"102",
"103",
"200",
"201",
"202",
"203",
"204",
"205",
"206",
"207",
"208",
"226",
"300",
"301",
"302",
"303",
"304",
"305",
"307",
"308",
"400",
"401",
"402",
"403",
"404",
"405",
"406",
"407",
"408",
"409",
"410",
"411",
"412",
"413",
"414",
"415",
"416",
"417",
"418",
"419",
"420",
"421",
"422",
"423",
"424",
"426",
"428",
"429",
"431",
"451",
"500",
"501",
"502",
"503",
"504",
"505",
"506",
"507",
"508",
"509",
"510",
"511"
]
]
},
"version": {
"type": "string"
}
}
},
"URI": {
"type": "object",
"properties": {
"absolute": {
"type": "boolean"
},
"authority": {
"type": "string"
},
"fragment": {
"type": "string"
},
"host": {
"type": "string"
},
"opaque": {
"type": "boolean"
},
"path": {
"type": "string"
},
"port": {
"type": "integer",
"format": "int32"
},
"query": {
"type": "string"
},
"rawAuthority": {
"type": "string"
},
"rawFragment": {
"type": "string"
},
"rawPath": {
"type": "string"
},
"rawQuery": {
"type": "string"
},
"rawSchemeSpecificPart": {
"type": "string"
},
"rawUserInfo": {
"type": "string"
},
"scheme": {
"type": "string"
},
"schemeSpecificPart": {
"type": "string"
},
"userInfo": {
"type": "string"
}
}
},
"Response": {
"type": "object",
"properties": {}
},
"Offer": {
"type": "object",
"additionalProperties": {
"type": "object"
},
"properties": {}
},
"StatusType": {
"type": "object",
"properties": {
"family": {
"type": "string",
"enum": [
"INFORMATIONAL",
"SUCCESSFUL",
"REDIRECTION",
"CLIENT_ERROR",
"SERVER_ERROR",
"OTHER"
]
},
"reasonPhrase": {
"type": "string"
},
"statusCode": {
"type": "integer",
"format": "int32"
}
}
},
"MediaType": {
"type": "object",
"properties": {
"parameters": {
"type": "object",
"additionalProperties": {
"type": "string"
}
},
"subtype": {
"type": "string"
},
"type": {
"type": "string"
},
"wildcardSubtype": {
"type": "boolean"
},
"wildcardType": {
"type": "boolean"
}
}
},
"EntityTag": {
"type": "object",
"properties": {
"value": {
"type": "string"
},
"weak": {
"type": "boolean"
}
}
},
"PartnerHealth": {
"type": "object",
"properties": {
"message": {
"type": "string"
},
"name": {
"type": "string"
},
"status": {
"type": "string",
"enum": [
"OK",
"KO",
"WARNING"
]
},
"url": {
"type": "string"
}
}
},
"UriBuilder": {
"type": "object",
"properties": {}
},
"Link": {
"type": "object",
"properties": {
"params": {
"type": "object",
"additionalProperties": {
"type": "string"
}
},
"rel": {
"type": "string"
},
"rels": {
"type": "array",
"items": {
"type": "string"
}
},
"title": {
"type": "string"
},
"type": {
"type": "string"
},
"uri": {
"$ref": "#/definitions/URI"
},
"uriBuilder": {
"$ref": "#/definitions/UriBuilder"
}
}
},
"NewCookie": {
"type": "object",
"properties": {
"comment": {
"type": "string"
},
"domain": {
"type": "string"
},
"expiry": {
"type": "string",
"format": "date-time"
},
"httpOnly": {
"type": "boolean"
},
"maxAge": {
"type": "integer",
"format": "int32"
},
"name": {
"type": "string"
},
"path": {
"type": "string"
},
"secure": {
"type": "boolean"
},
"value": {
"type": "string"
},
"version": {
"type": "integer",
"format": "int32"
}
}
}
},
"x-smoke-test": {
"scenario": [
{
"/api/merchandising/offers/search": {
"response": {
"status": 200,
"headers": {
"Content-Type": "application/json"
}
}
}
}
]
}
}
Thanks @Lucas-C the problem is now fixed in master. Notice that your smoke test was using the endpoitn URL instead of the operationID.
I fixed it: https://github.com/tarekziade/smwogger/blob/master/smwogger/tests/lucas.json#L595
I will use that json file in the tests to avoid regression, unless you'd rather not see that file on github let me know I'll obfuscate it
No, no problem. Thanks for the fix, I'm going to test it asap
I now get the following error, with the same JSON:
$ smwogger -v csc-api-for-smwogger.json
Scanning spec... OK
This is project 'Api Documentation'
Api Documentation
Version 1.0
Running Scenario
Traceback (most recent call last):
File "/home/lucas_cimon/.local/share/virtualenvs/smwogger/bin/smwogger", line 11, in <module>
load_entry_point('smwogger', 'console_scripts', 'smwogger')()
File "/opt/smwogger/smwogger/main.py", line 60, in main
for index, (oid, options) in enumerate(runner.scenario()):
File "/opt/smwogger/smwogger/ops.py", line 62, in scenario
options.update(ops[opid])
KeyError: '/api/merchandising/offers/search'
Should I open another ticket ?
@Lucas-C as I pointed in my comment, you should not use "/api/merchandising/offers/search" in x-smoke-test, but the corresponding operationid, see https://github.com/tarekziade/smwogger/blob/master/smwogger/tests/lucas.json#L595
Ok, sorry. I did not properly understood your comment. It's making sense now, thanks
No problem! If you get any other issue, please add a new issue. Thanks a lot for your feedback/
Hi.
Here is the error I got: