-
-
Notifications
You must be signed in to change notification settings - Fork 560
Closed
Labels
PRs welcomePRs are welcome to solve this issue!PRs are welcome to solve this issue!bugSomething isn't workingSomething isn't workinggood first issueStraightforward problem, solvable for first-time contributors without deep knowledge of the projectStraightforward problem, solvable for first-time contributors without deep knowledge of the projectopenapi-tsRelevant to the openapi-typescript libraryRelevant to the openapi-typescript library
Description
Description
when use header and cookie, and use same name(param1), header always return never
error error
header?: never;
Expected result
header: {
/** @description param1 */
param1: string;
};
Name | Version |
---|---|
openapi-typescript |
7.2.0 |
Node.js | 18 |
OS + version | Windows 10 |
Reproduction
How can this be reproduced / when did the error occur?
use openapi-v3.json
schema data
{
"openapi": "3.1.0",
"info": {
"title": "@liangskyli/routing-controllers-openapi",
"license": {
"name": "This file is auto generated by @liangskyli/routing-controllers-openapi, do not edit!"
},
"version": "0.7.2"
},
"tags": [
{
"name": "Test1",
"description": ""
}
],
"paths": {
"/root/v1/getQueryParamWithQueryParams/{path1}/{path2}": {
"get": {
"tags": ["Test1"],
"responses": {
"200": {
"description": "Success",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"code": {
"type": "number",
"description": "接口返回code码字段"
},
"data": {
"$ref": "#/components/schemas/Response1.63007440"
},
"msg": {
"type": "string",
"description": "接口返回信息字段"
}
},
"required": ["code", "data"]
}
}
}
}
},
"parameters": [
{
"name": "param1",
"in": "header",
"required": true,
"schema": {
"type": "string"
},
"description": "param1"
},
{
"name": "param1",
"in": "cookie",
"required": true,
"schema": {
"type": "string"
},
"description": "param1"
}
]
}
}
},
"components": {
"schemas": {
"IParam2.eb9fbc4a": {
"type": "object",
"properties": {
"param1": {
"description": "param1",
"type": "string"
}
},
"required": ["param1"]
},
"Response1.63007440": {
"type": "object",
"properties": {
"activityBases2": {
"type": "string"
}
},
"required": ["activityBases2"]
}
}
}
}
const result = await openapiTS(schema, {});
const resultString = `${astToString(result)}`;
** error result**
export interface paths {
'/root/v1/getQueryParamWithQueryParams/{path1}/{path2}': {
parameters: {
query?: never;
header?: never;
path?: never;
cookie?: never;
};
get: {
parameters: {
query?: never;
header?: never;
path?: never;
cookie: {
/** @description param1 */
param1: string;
};
};
requestBody?: never;
responses: {
/** @description Success */
200: {
headers: {
[name: string]: unknown;
};
content: {
'application/json': {
/** @description 接口返回code码字段 */
code: number;
data: components['schemas']['Response1.63007440'];
/** @description 接口返回信息字段 */
msg?: string;
};
};
};
};
};
put?: never;
post?: never;
delete?: never;
options?: never;
head?: never;
patch?: never;
trace?: never;
};
}
export type webhooks = Record<string, never>;
export interface components {
schemas: {
'IParam2.eb9fbc4a': {
/** @description param1 */
param1: string;
};
'Response1.63007440': {
activityBases2: string;
};
};
responses: never;
parameters: never;
requestBodies: never;
headers: never;
pathItems: never;
}
export type $defs = Record<string, never>;
export type operations = Record<string, never>;
Expected result
export interface paths {
'/root/v1/getQueryParamWithQueryParams/{path1}/{path2}': {
parameters: {
query?: never;
header?: never;
path?: never;
cookie?: never;
};
get: {
parameters: {
query?: never;
header: {
/** @description param1 */
param1: string;
};
path?: never;
cookie: {
/** @description param1 */
param1: string;
};
};
requestBody?: never;
responses: {
/** @description Success */
200: {
headers: {
[name: string]: unknown;
};
content: {
'application/json': {
/** @description 接口返回code码字段 */
code: number;
data: components['schemas']['Response1.63007440'];
/** @description 接口返回信息字段 */
msg?: string;
};
};
};
};
};
put?: never;
post?: never;
delete?: never;
options?: never;
head?: never;
patch?: never;
trace?: never;
};
}
export type webhooks = Record<string, never>;
export interface components {
schemas: {
'IParam2.eb9fbc4a': {
/** @description param1 */
param1: string;
};
'Response1.63007440': {
activityBases2: string;
};
};
responses: never;
parameters: never;
requestBodies: never;
headers: never;
pathItems: never;
}
export type $defs = Record<string, never>;
export type operations = Record<string, never>;
(in case it’s not obvious)
Checklist
- My OpenAPI schema passes the Redocly validator (
npx @redocly/cli@latest lint
) - I’m willing to open a PR (see CONTRIBUTING.md)
Metadata
Metadata
Assignees
Labels
PRs welcomePRs are welcome to solve this issue!PRs are welcome to solve this issue!bugSomething isn't workingSomething isn't workinggood first issueStraightforward problem, solvable for first-time contributors without deep knowledge of the projectStraightforward problem, solvable for first-time contributors without deep knowledge of the projectopenapi-tsRelevant to the openapi-typescript libraryRelevant to the openapi-typescript library