[BUG][RUST] Reqwest - encoding of spaces in path parameters
Los mantenedores suelen responder en 1 día
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 68/100
Línea de trabajo
El error está en la función auxiliar urlencode de api_mod.mustache, que las plantillas de Rust reqwest y reqwest-trait usan para los parámetros de ruta. Genera un cliente a partir de la especificación del issue y comprueba que un espacio sale como +; luego lee esa función auxiliar. Está terminado cuando un espacio en un parámetro de ruta se codifica como %20, un + literal sigue codificándose como %2B y las salidas de reqwest y reqwest-trait cambian ambas.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Bug Report Checklist
- Have you provided a full/minimal spec to reproduce the issue?
- Have you validated the input using an OpenAPI validator?
- Have you tested with the latest master to confirm the issue still exists?
- Have you searched for related issues/PRs?
- What's the actual output vs expected output?
- [Optional] Sponsorship to speed up the bug fix or feature request (example)
Description
When using reqwest, path parameters with spaces are incorrectly encoded with a + instead of %20. For example, Glen Wright becomes Glen+Wright, when it should be Glen%20Wright.
openapi-generator version
Reproduced with latest at time of writing: 1fdc3307942fcf853990cda8701d71c7e0753157.
OpenAPI declaration file content or url
openapi: 3.0.3
info:
title: Reqwest - path parameter space encoding
version: "1.0.0"
paths:
/api/{spacedParam}:
parameters:
- in: path
name: spacedParam
schema:
type: string
required: true
description: A path parameter with a space.
get:
operationId: getValue
responses:
'200':
description: A returned value.
content:
application/json:
schema:
$ref: '#/components/schemas/returnedValue'
example:
spacedParam: A path parameter with a + instead of a space.
components:
schemas:
returnedValue:
type: object
required:
- spacedParam
properties:
spacedParam:
type: string
Generation Details
Generate client with -i spec.yaml -g rust -o output.
Steps to reproduce
- Generate client as above.
- Call
api.get_value(&config, "Spaced Param"); - Observe that the path parameter is encoded as
Spaced+Param.
Related issues/PRs
#11242. is the same issue, but for Java.
Suggest a fix
Update the urlencode function in api_mod.mustache for reqwest and reqwest-trait to replace + with %20. This will not impact actual instances of + as they are encoded properly as %2B.
- Lenguaje dominante
- Java
- Estrellas
- 26.8k
- Forks
- 7.7k
- Merge medio
- 1 d 15 h
- PR fusionados (30 d)
- 146
Preparar el entorno
Inicia el contenedor de desarrollo del proyecto en tu navegador, con tu propia cuenta de GitHub.
- Incluye un Dockerfile o un archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de OpenAPITools/openapi-generator
-
[BUG] ExampleGenerator returns the string "{}" (or null) for `type: object` schemas without `properties`Posiblemente ocupada Un pull request vinculado a esta issue está abierto o ya se fusionó. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
OpenAPITools/openapi-generator#25237 ·
Los mantenedores suelen responder en 1 día
-
[BUG] OpenApiEvaluator reports "default value not in enum" for numerically equal values with different scale (e.g. 1.5 and 1.50)Posiblemente ocupada @mohitduhan19 la tomó hace 2 días. AbiertoIssue: Bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
OpenAPITools/openapi-generator#25233 ·
Los mantenedores suelen responder en 1 día
-
[BUG] OpenApiEvaluator emits "Unused model" warnings even when recommendations are disabledPosiblemente ocupada @mohitduhan19 la tomó hace 2 días. AbiertoIssue: Bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
OpenAPITools/openapi-generator#25232 ·
Los mantenedores suelen responder en 1 día
-
[BUG][KOTLIN] multiplatform/jvm-ktor: `DELETE` without `requestBody` sends `"Content-Type: application/json"` with an empty bodyPosiblemente ocupada @mohitduhan19 la tomó hace 2 días. AbiertoIssue: Bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
OpenAPITools/openapi-generator#25223 ·
Los mantenedores suelen responder en 1 día
-
Issue: Bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
OpenAPITools/openapi-generator#25218 ·
Los mantenedores suelen responder en 1 día
Todos los issues de OpenAPITools/openapi-generator
Issues similares
-
approved bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
checkstyle/checkstyle#21981 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
[lake/iceberg] Reserved write-mode properties can be set and reset through their `iceberg.` keyPosiblemente ocupada @aphenix-r7 la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 Menos de una hora Aptitud para principiantes 72/100
Los mantenedores suelen responder en 1 día
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
MCModderAnchor/TACZ#758 ·
-
agent-java community triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
elastic/apm-agent-java#4594 ·
Los mantenedores suelen responder en 1 día