Bug Report Checklist
Description
The generator prefixes the basePath variable in class ApiClient with "http://localhost" when servers[0].url == '/api-xyz'
resulting in a basePath == 'http://localhost/api-xyz'
The expected basePath is '/api-xyz'
openapi-generator version
7.2.0
OpenAPI declaration file content or url
openapi: "3.0.3"
info:
title: "test api"
version: v1
servers:
- url: "/api-xyz"
paths:
"/account/v1/json/login":
post:
responses:
'201':
description: Created
requestBody:
description: ""
content:
"application/json":
schema:
type: object
properties:
emailAddress:
type: string
password:
type: string
Related issues/PRs
#10056
Suggest a fix
The regex used in
|
return Pattern.matches("^(\\/[\\w\\d]+)+", firstServer.getUrl()); |
doesnt allow special characters in relative paths.
Suggestion: ^(\/[\w\d_-]+)+
(will allow "-" and "_" in relative paths)
Bug Report Checklist
Description
The generator prefixes the basePath variable in class ApiClient with "http://localhost" when servers[0].url == '/api-xyz'
resulting in a basePath == 'http://localhost/api-xyz'
The expected basePath is '/api-xyz'
openapi-generator version
7.2.0
OpenAPI declaration file content or url
Related issues/PRs
#10056
Suggest a fix
The regex used in
openapi-generator/modules/openapi-generator/src/main/java/org/openapitools/codegen/utils/URLPathUtils.java
Line 238 in e69fb86
Suggestion: ^(\/[\w\d_-]+)+
(will allow "-" and "_" in relative paths)