-
-
Notifications
You must be signed in to change notification settings - Fork 387
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
Error: Duplicate schema names detected #1733
Comments
The same issue here |
@SamyZog Could you provide the schema specification so I can try to replicate this? |
@AllieJonsson This happens for me if i have a field name defined twice in both |
If index files are not needed, a temporary workaround is to disable orval/packages/core/src/writers/schemas.ts Lines 130 to 156 in b3592ac
|
That workaround works if the two colliding properties are of the same type, but if they are different, e.g. calling_code:
type: number
enum: [1, 2, 3]
callingCode:
type: string
enum: ['+33', '+420', '+33'] the generated models will be interface Pet {
calling_code: PetCallingCode;
callingCode: PetCallingCode;
}
...
export type PetCallingCode = (typeof PetCallingCode)[keyof typeof PetCallingCode];
export const PetCallingCode = {
'+33': '+33',
'+420': '+420',
} as const; which is wrong. What is the reason to have properties with the same (when Pascal-cased) name in the model? If only one of them is used, it is probably advisable to either remove them from the schema or filter them out in the |
Perhaps this issue was fixed in #1958? so i'll close this. |
Just encountered this problem on @7.7.0 |
@soartec-lab that only fixed the error message 😅 |
Same issue with Orval 7.7.0 (and v6 too). The issue occurs only if export type POSTprofilesBody = {
first_name?: string;
last_name?: string;
email?: string;
};
export type POSTprofilesBody = {
'*'?: POSTprofilesBody;
}; I need to manually delete the second one to get it working. |
I found out it comes from a request that have a requestBody:
required: false
content:
application/json:
schema:
type: object
properties:
'*':
type: object
description: ''
example: []
properties:
email:
type: string
description: ''
example: [email protected]
name:
type: string
description: ''
example: vega It looks like this in the swagger ui This kind of layout is generated by Laravel when a bulk request is possible. I'm not sure whether this use case should be supported by Orval or if I should change some config in the export of my Laravel API. |
I fixed it on my side by patching the OpenAPI specification file. With the example from my previous comment, it would look like this after the patch is applied : requestBody:
required: false
content:
application/json:
schema:
type: object
description: ''
example: []
properties:
email:
type: string
description: ''
example: [email protected]
name:
type: string
description: ''
example: vega |
Trying to generate swagger client from openapi 3.0.3
Orval v7.3.0 (also tried v7.2.0)
When generating i get an error
The schema is valid, I have ran it through the swagger editor and all is clean.
this is my config
The text was updated successfully, but these errors were encountered: