-
-
Notifications
You must be signed in to change notification settings - Fork 6.9k
[BUG] ERROR! Not handling <code> as Body Parameter at the moment #2580
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
👍 Thanks for opening this issue! The team will review the labels and make any necessary changes. |
Thanks for reporting the issue and offering help to fix it. Can you share the full spec via gist.github.com so that we can more easily reproduce the issue? |
Sure thing, here's the yaml files and output. issue-2580.yaml: openapi: 3.0.2
info:
version: v1
title: Test API
tags:
- name: Test
description: TODO
paths:
/v1/foo:
$ref: './issue-2580-part2.yaml#/paths/~1foo' issue-2580-part2.yaml: openapi: 3.0.2
info:
version: v1
title: Test API
tags:
- name: Test
description: TODO
paths:
/foo:
post:
tags:
- Test
summary: Random endpoint
operationId: foo
parameters:
- $ref: '#/components/parameters/XUserIdHeader'
responses:
'200':
description: Service is running properly
components:
parameters:
XUserIdHeader:
in: header
name: X-User-Id
description: Moov User ID header, required in all requests
example: e3cdf999
schema:
type: string
required: true Output:
Note: Running the generator against |
Is there any advice for how I should go about fixing this? I can try to work through the commented out code, but it seems pretty old. Thanks - cc @wing328 |
If I move the openapi: 3.0.2
info:
version: v1
title: Test API
servers:
- url: https://api.moov.io
description: Production server
tags:
- name: Test
description: TODO
paths:
/v1/foo:
$ref: './issue-2580-part2.yaml#/paths/~1foo' openapi: 3.0.2
info:
version: v1
title: Test API
tags:
- name: Test
description: TODO
paths:
/foo:
post:
tags:
- Test
summary: Random endpoint
operationId: foo
parameters:
- name: XUserIdHeader
in: header
name: X-User-Id
description: Moov User ID header, required in all requests
schema:
type: string
example: e3cdf999
required: true
responses:
'200':
description: Service is running properly |
Experience the same issue. Results are messy generated code with method parameter named Is this because of providing multiple parameters for the same path with multiple Confusing bug.. |
This is the error log, it shows up on a few paths (
|
FWIW, the error is repetitive for certain parameters throughout the log, I suppose for every time it is referred. |
An example path that has this issue would be:
And the
|
I had an error with same output like provided by adamdecaf and others, but only because of a typo in $ref path to parameter. I used only one file with components/parameters defined there in. So correct references get lost somewhere due to inclusion of other files, I guess. Maybe it helps some how. |
I have the same error with a much smaller swagger: '2.0'
info:
description: Description
title: Title
paths:
/:
get:
parameters:
- $ref: '#/parameters/Language'
responses:
200:
description: Description
schema:
type: file
parameters:
Language:
$ref: '#/definitions/LanguageEnum'
definitions:
LanguageEnum:
type: string
enum:
- de-DE
- en-US
Simple:
type: object
properties:
language:
$ref: '#/definitions/LanguageEnum' running
The command I use to generate:
|
I had the same issue and am running exactly the same command as @danielbartsch I validated my schema against https://editor.swagger.io/ and fixed errors it had shown (was missing Fix those and you'll be fine.
|
I faced similar issue when generating jira cloud api client. Generated code is broken, with Details:
|
Same for typescript-axios client. editYoutubeId(companyId: string, UNKNOWN_PARAM_NAME: , options?: any): AxiosPromise<IAPICompany> {
return localVarFp.editYoutubeId(companyId, UNKNOWN_PARAM_NAME, options).then((request) => request(axios, basePath));
}, |
FWIW, you can also reproduce this with the |
Saved my day, thank you ! |
Ran into the same error. In my case, I had invalid syntax in one of my objects
Where the required false is invalid syntax. |
How do we stand regarding this issue, is this an open bug? I'm currently facing the reported issue. Where by having referenced header parameters results into a:
Currently using |
Just to confirm, this is still an issue... |
Same problem, using |
I had the same issue, it is caused by $ref containing '{' and '}' character I opened an issue on swagger-parser repository swagger-api/swagger-parser#2033 As a workaround, you can try to replace these by %7B and %7D which will be well interpreted by URI |
Description
I get the following error when trying to generate a Go client:
This comes about when my
root.yaml
file contains apaths
sub-object with a$ref
to an external OpenAPI spec file for a path like:openapi-generator version
4.0.0-beta2
Steps to reproduce
Suggest a fix
Looking at the relevant source code this path is simply commented out (and has been for quite some time), so I assume there's a refactor needed?
I'm willing to offer a patch which fixes this, but I'm unsure of the history or what all would need to be refactored. Any advice? I'll contribute a reproducible local test as part of the PR.
The text was updated successfully, but these errors were encountered: