{"action":"created","issue":{"url":"https://api.github.com/repos/OpenAPITools/openapi-generator/issues/3399","repository_url":"https://api.github.com/repos/OpenAPITools/openapi-generator","labels_url":"https://api.github.com/repos/OpenAPITools/openapi-generator/issues/3399/labels{/name}","comments_url":"https://api.github.com/repos/OpenAPITools/openapi-generator/issues/3399/comments","events_url":"https://api.github.com/repos/OpenAPITools/openapi-generator/issues/3399/events","html_url":"https://github.com/OpenAPITools/openapi-generator/issues/3399","id":470269720,"node_id":"MDU6SXNzdWU0NzAyNjk3MjA=","number":3399,"title":"[BUG] Qt client server URL/host mismatch","user":{"login":"MartinDelille","id":879889,"node_id":"MDQ6VXNlcjg3OTg4OQ==","avatar_url":"https://avatars2.githubusercontent.com/u/879889?v=4","gravatar_id":"","url":"https://api.github.com/users/MartinDelille","html_url":"https://github.com/MartinDelille","followers_url":"https://api.github.com/users/MartinDelille/followers","following_url":"https://api.github.com/users/MartinDelille/following{/other_user}","gists_url":"https://api.github.com/users/MartinDelille/gists{/gist_id}","starred_url":"https://api.github.com/users/MartinDelille/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MartinDelille/subscriptions","organizations_url":"https://api.github.com/users/MartinDelille/orgs","repos_url":"https://api.github.com/users/MartinDelille/repos","events_url":"https://api.github.com/users/MartinDelille/events{/privacy}","received_events_url":"https://api.github.com/users/MartinDelille/received_events","type":"User","site_admin":false},"labels":[{"id":931402765,"node_id":"MDU6TGFiZWw5MzE0MDI3NjU=","url":"https://api.github.com/repos/OpenAPITools/openapi-generator/labels/Client:%20C++","name":"Client: C++","color":"fad8c7","default":false},{"id":931403022,"node_id":"MDU6TGFiZWw5MzE0MDMwMjI=","url":"https://api.github.com/repos/OpenAPITools/openapi-generator/labels/Client:%20QT","name":"Client: QT","color":"fad8c7","default":false},{"id":931403399,"node_id":"MDU6TGFiZWw5MzE0MDMzOTk=","url":"https://api.github.com/repos/OpenAPITools/openapi-generator/labels/Issue:%20Bug","name":"Issue: Bug","color":"e11d21","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2019-07-19T11:07:02Z","updated_at":"2019-07-22T10:00:14Z","closed_at":null,"author_association":"CONTRIBUTOR","body":"#### Bug Report Checklist\r\n\r\n- [x] Have you provided a full/minimal spec to reproduce the issue?\r\n- [x] Have you validated the input using an OpenAPI validator ([example](https://apidevtools.org/swagger-parser/online/))?\r\n- [x] What's the version of OpenAPI Generator used?\r\n- [x] Have you search for related issues/PRs?\r\n- [ ] What's the actual output vs expected output?\r\n- [ ] [Optional] Bounty to sponsor the fix ([example](https://www.bountysource.com/issues/66123212-javascript-client-produces-a-wrong-object-for-a-string-enum-type-that-is-used-with-ref))\r\n\r\nHi,\r\n\r\nAfter a long time working on other subject, I come back to openapi-generator because I seriously consider using it for my project.\r\n\r\n##### Description\r\n\r\nI'm encountering a issue when generating a Qt5 client where there is a URL generation error: the protocol is not added when building the request:\r\n\r\n```cpp\r\nOAIDefaultApi::OAIDefaultApi() : basePath(\"/v1\"),\r\n    host(\"api.myapp.com\"),\r\n    timeout(0){\r\n\r\n}\r\n\r\n...\r\n\r\nvoid\r\nOAIDefaultApi::findContactById(const QString& contact_id) {\r\n    QString fullPath;\r\n    fullPath.append(this->host).append(this->basePath).append(\"/contact/{contactId}\");\r\n    ...\r\n}\r\n```\r\n\r\nThis code generate the following url: `api.myapp.com/v1/contact/{contactId}` instead of `https://api.myapp.com/v1/contact/{contactId}`.\r\n\r\nThere is a easy way to fix it is to call `defaultApi.setHost(\"https://api.myapp.com\")` before `findContactById` but I guess it might broke in the long term.\r\n\r\n##### openapi-generator version\r\n\r\n4.0.3\r\n\r\n##### OpenAPI declaration file content or url\r\n\r\n```yaml\r\nopenapi: 3.0.1\r\nservers:\r\n  - url: 'https://api.myapp.com/v1'\r\ninfo:\r\n  description: This is myapp.com API.\r\n  version: 1.0.0\r\n  title: myapp.com\r\ncomponents:\r\n  schemas:\r\n    Contact:\r\n      type: object\r\n      required:\r\n        - id\r\n        - name\r\n      properties:\r\n        id:\r\n          type: string\r\n        name:\r\n          type: string\r\npaths:\r\n  /contact/{contactId}:\r\n    get:\r\n      operationId: findContactById\r\n      parameters:\r\n        - name: contactId\r\n          in: path\r\n          schema:\r\n            type: string\r\n          required: true\r\n      responses:\r\n        '200':\r\n          description: An contact object\r\n          content:\r\n            application/json:\r\n              schema:\r\n                $ref: '#/components/schemas/Contact'\r\n```\r\n\r\n##### Command line used for generation\r\n\r\n```\r\nopenapi-generator generate -i api.yaml -g cpp-qt5-client\r\n```\r\n\r\n##### Steps to reproduce\r\n\r\nAfter generating the client, try to call the  `OAIDefaultApi::findContactById()` method and see how the URL is badly formed. \r\n\r\n##### Related issues/PRs\r\n\r\nNone\r\n\r\n##### Suggest a fix\r\n\r\nI'll be happy to fix it but I'd like to have some direction how we should handle this case:\r\n- Do we agree that here the host is `api.myapp.com` and not `https://api.myapp.com`?\r\n- How do handle the `https` protocol ?\r\n\r\nPing @ravinikam @stkrwork @etherealjoy"},"comment":{"url":"https://api.github.com/repos/OpenAPITools/openapi-generator/issues/comments/513726674","html_url":"https://github.com/OpenAPITools/openapi-generator/issues/3399#issuecomment-513726674","issue_url":"https://api.github.com/repos/OpenAPITools/openapi-generator/issues/3399","id":513726674,"node_id":"MDEyOklzc3VlQ29tbWVudDUxMzcyNjY3NA==","user":{"login":"MartinDelille","id":879889,"node_id":"MDQ6VXNlcjg3OTg4OQ==","avatar_url":"https://avatars2.githubusercontent.com/u/879889?v=4","gravatar_id":"","url":"https://api.github.com/users/MartinDelille","html_url":"https://github.com/MartinDelille","followers_url":"https://api.github.com/users/MartinDelille/followers","following_url":"https://api.github.com/users/MartinDelille/following{/other_user}","gists_url":"https://api.github.com/users/MartinDelille/gists{/gist_id}","starred_url":"https://api.github.com/users/MartinDelille/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MartinDelille/subscriptions","organizations_url":"https://api.github.com/users/MartinDelille/orgs","repos_url":"https://api.github.com/users/MartinDelille/repos","events_url":"https://api.github.com/users/MartinDelille/events{/privacy}","received_events_url":"https://api.github.com/users/MartinDelille/received_events","type":"User","site_admin":false},"created_at":"2019-07-22T10:00:14Z","updated_at":"2019-07-22T10:00:14Z","author_association":"CONTRIBUTOR","body":"After looking at the template, it seems that the scheme is handled: https://github.com/OpenAPITools/openapi-generator/blob/master/modules/openapi-generator/src/main/resources/cpp-qt5-client/api-body.mustache#L13\r\n\r\nIt looks like it is not parse for OAS 3.0"}}
{"actor":{"display_login":"MartinDelille"}}