Bug Report Checklist
Description
If a spec declares a schema named Request, the generated scala-sttp4 client does not compile.
Every generated API imports its models explicitly and then wildcard-imports sttp:
import org.openapitools.client.model.Request
import sttp.client4._
In Scala an explicit import has higher precedence than a wildcard import, regardless of order, so Request resolves to the model. The operation's return type is emitted unqualified as Request[...], which then fails:
error: org.openapitools.client.model.Request does not take type parameters
def predict(request: Request): Request[Either[ResponseException[String], Response]] =
^
Request is a common schema name for RPC-style APIs, so this is easy to hit.
The scala-sttp (sttp3) generator emits the qualified form sttp.client3.Request[..., Any] and is unaffected.
openapi-generator version
7.25.0-SNAPSHOT (current master).
OpenAPI declaration file content or url
openapi: 3.0.0
info:
title: sttp4 model named Request
version: 1.0.0
paths:
/predict:
post:
operationId: predict
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/Request'
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/Response'
components:
schemas:
Request:
type: object
required: [userId]
properties:
userId: {type: string}
Response:
type: object
properties:
score: {type: number}
Generation Details
java -jar openapi-generator-cli.jar generate -g scala-sttp4 -i spec.yaml -o out
Steps to reproduce
- Generate with the command above.
sbt compile in the output directory.
- Compilation fails with
Request does not take type parameters.
Suggest a fix
Qualify the return type in api.mustache as sttp.client4.Request[...], matching what scala-sttp already does.
Bug Report Checklist
Description
If a spec declares a schema named
Request, the generatedscala-sttp4client does not compile.Every generated API imports its models explicitly and then wildcard-imports sttp:
In Scala an explicit import has higher precedence than a wildcard import, regardless of order, so
Requestresolves to the model. The operation's return type is emitted unqualified asRequest[...], which then fails:Requestis a common schema name for RPC-style APIs, so this is easy to hit.The
scala-sttp(sttp3) generator emits the qualified formsttp.client3.Request[..., Any]and is unaffected.openapi-generator version
7.25.0-SNAPSHOT (current master).
OpenAPI declaration file content or url
Generation Details
Steps to reproduce
sbt compilein the output directory.Request does not take type parameters.Suggest a fix
Qualify the return type in
api.mustacheassttp.client4.Request[...], matching whatscala-sttpalready does.