swagger-api / swagger-api/swagger-codegen
[typescript-axios] query property renamed to _query
Open
Nobody has claimed this yet.
- Dominant language
- Mustache
- Stars
- 17.8k
- Forks
- 6k
- PR merge metrics
- No merged PRs in 30d
Description
Description
We use swagger-codegen and have a property query, but in the Typescript export it is renamed to _query. With previous versions it worked.
Swagger-codegen version
3.0.55, seems to be a regression
Swagger declaration file content or url
openapi: 3.0.0
info:
title: Test Schema Bugreport
version: 1.19.1
paths:
/api/test:
post:
summary: Send a event
requestBody:
required: true
content:
application/json:
schema:
type: 'array'
items:
oneOf:
- $ref: '#/components/schemas/BasicEvent'
responses:
'200':
description: The request was successful
components:
schemas:
BasicEvent:
type: object
required:
description: |
A basic description of an event.
properties:
query:
title: Query
type: string
format: ^([^=&]+=[^=&]*)(&([^=&]+=[^=&]*)?)*$
description: A query-formatted and url encoded string to provide attributes. Multiple values for one parameter should be separated with a encoded comma (e.g. "a%2Cb" for the values a and b).
example: '?foo=bar&xyz=12%263&csv=a%2Cb'
Command line used for generation
swagger-codegen generate -i schema.yaml -l typescript-axios -o out
Steps to reproduce
- Run swagger-codegen
- inspect result,
_query?should bequery?:
/* tslint:disable */
/* eslint-disable */
/**
* Test Schema Bugreport
* No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
*
* OpenAPI spec version: 1.19.1
*
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually.
*/
/**
* A basic description of an event.
*
* @export
* @interface BasicEvent
*/
export interface BasicEvent {
/**
* A query-formatted and url encoded string to provide attributes. Multiple values for one parameter should be separated with a encoded comma (e.g. \"a%2Cb\" for the values a and b).
*
* @type {string}
* @memberof BasicEvent
* @example ?foo=bar&xyz=12%263&csv=a%2Cb
*/
_query?: string;
}
Related issues/PRs
Suggest a fix/enhancement
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by running the documented swagger-codegen command with the provided OpenAPI schema.yaml and inspect the generated TypeScript output. Trace the typescript-axios generation path to determine why the BasicEvent property becomes _query; done means the generated interface preserves the property name query.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- openapi, typescript
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100