You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
An OpenAPI Query Parameter with the name _ (or any _ within the parameter name) fails to generate the corresponding property name under services.gen.ts (Fetch client). Any instance of _ is being stripped from the resulting value (leading, trailing, or otherwise) in the translation of the snake_case OpenAPI parameter key to the camelCase property name, but if the parameter name is only _ the generated ts is broken.
Noting: If the parameter was _ the query parameter generated under services.gen.ts is:
query: {
_: data.,
},
instead of
query: {
_: data._,
},
Also noting: Using _ as a name or character parameter in OpenAPI queries does not break the OpenAPI specification.
To Reproduce
Steps to reproduce the behavior:
Call the following openapi yaml using
yarn openapi-rq -i ./openapi.yaml
OpenAPI spec file
openapi: 3.1.0
info:
title: Test API
description: API for Test
version: development
security:
- test_auth:
- default
paths:
/reachable:
head:
summary: Reachable?
description: Does nothing and returns No Content
operationId: reachable
security: []
parameters:
- name: _
in: query
description: Optional parameter for avoiding caching
schema: {}
responses:
'204':
description: Success
Expected behavior
A clear and concise description of what you expected to happen.
Expected output
export class DefaultService {
/**
* Reachable?
* Does nothing and returns No Content
* @param data The data for the request.
* @param data._ Optional parameter for avoiding caching
* @returns void Success
* @throws ApiError
*/
public static reachable(
data: ReachableData = {},
): CancelablePromise<ReachableResponse> {
return __request(OpenAPI, {
method: "HEAD",
url: "/reachable",
query: {
_: data._,
},
});
}
}
Instead got output
export class DefaultService {
/**
* Reachable?
* Does nothing and returns No Content
* @param data The data for the request.
* @param data. Optional parameter for avoiding caching
* @returns void Success
* @throws ApiError
*/
public static reachable(data: ReachableData = {}): CancelablePromise<ReachableResponse> {
return __request(OpenAPI, {
method: 'HEAD',
url: '/reachable',
query: {
_: data.
}
});
}
}
Screenshots
If applicable, add screenshots or logs to help explain your problem.
OS: Linuxmint
Version
Description: Linux Mint 21.3
Release: 21.3
Codename: virginia
The text was updated successfully, but these errors were encountered:
Beauchaj
changed the title
Underscores stripped from parameter names in services.gen.ts
OpenAPI parameter name of only an underscore results in missing parameter name in services.gen.ts
Jun 25, 2024
Describe the bug
An OpenAPI Query Parameter with the name
_
(or any_
within the parameter name) fails to generate the corresponding property name underservices.gen.ts
(Fetch
client). Any instance of_
is being stripped from the resulting value (leading, trailing, or otherwise) in the translation of thesnake_case
OpenAPI parameter key to thecamelCase
property name, but if the parameter name is only_
the generated ts is broken.Noting: If the parameter was
_
the query parameter generated underservices.gen.ts
is:instead of
Also noting: Using
_
as a name or character parameter in OpenAPI queries does not break the OpenAPI specification.To Reproduce
Steps to reproduce the behavior:
Call the following openapi yaml using
yarn openapi-rq -i ./openapi.yaml
OpenAPI spec file
Expected behavior
A clear and concise description of what you expected to happen.
Expected output
Instead got output
Screenshots
If applicable, add screenshots or logs to help explain your problem.
Description: Linux Mint 21.3
Release: 21.3
Codename: virginia
Relevant package versions:
The text was updated successfully, but these errors were encountered: