这是indexloc提供的服务,不要输入任何密码
Skip to content

Path parameter incorrectly serialized as /servers/id,<id> instead of /servers/<id> on paramsStructure flat #2984

@fiftyy

Description

@fiftyy

Description

Hi, I encountered an issue when calling (with paramsStructure flat) a generated GET method.
The request path is incorrectly serialized as:
/servers/id,1335279038599663729

But it should be:
/servers/1335279038599663729

This looks like the {id} placeholder is not replaced properly and the value is appended with a comma.

Let me know if you need any further details or if I can provide additional logs or config.

Reproducible example or configuration

import { defineConfig } from '@hey-api/openapi-ts';

export default defineConfig({
	input: './scripts/openapi-spec.json',
	output: { path: './src/api/client', importFileExtension: '.js' },
	plugins: [
		'@hey-api/schemas',
		{
			name: '@hey-api/typescript',
			topType: "any",
			enums: {
				case: 'preserve',
				enabled: true,
				mode: 'typescript'
			}
		},
		{
			name: '@hey-api/sdk',
			asClass: true,
			responseStyle: 'data',
			paramsStructure: 'flat',
			classNameBuilder: (name) => `${name}Service`
		}
	]
});

OpenAPI specification (optional)

    "/servers/{id}": {
      "get": {
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "schema": {
              "type": "string"
            },
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Ok",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/IServer"
                }
              }
            }
          }
        },
        "tags": [
          "Servers"
        ],
        "security": [],
        "operationId": "GetServer"
      },

System information (optional)

@hey-api/openapi-ts: 0.87.5

Metadata

Metadata

Assignees

Labels

bug 🔥Something isn't workingclientClient package related

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions