Duplicate typename issue while generating types from paypal openAPI spec
Hi,
I am trying to integrate the paypal with my ecommerce solution. I am trying to generate client code , types from PayPal OpenAPI spec given in https://github.com/paypal/paypal-rest-api-specifications.
The particular open API i am using is , checkout_orders_v2 attached here. checkout_orders_v2.json
When i try to generate types as shown below i get error
hvk@LAPTOP-GH4L4EUD:/mnt/c/Users/paypal-integration$ oapi-codegen -generate types -o types.go -package main checkout_orders_v2.json
error generating code: error generating type definitions: error generating code for type definitions: duplicate typename 'AuthorizationStatus' detected, can't auto-rename, please use x-go-name to specify your own name for one of them
got the same error for a different (YAML based) spec and using v2.1.0 of the generator to generate models and client.
The spec: https://raw.githubusercontent.com/apideck-libraries/openapi-specs/main/hris.yml
error generating code: error generating type definitions: error generating code for type definitions: duplicate typename 'EmployeeId' detected, can't auto-rename, please use x-go-name to specify your own name for one of them
i checked that there is only one schemadefinition
after some debugging, I think the issue is related to this test:
func TypeDefinitionsEquivalent(t1, t2 TypeDefinition) bool {
if t1.TypeName != t2.TypeName {
return false
}
return reflect.DeepEqual(t1.Schema.OAPISchema, t2.Schema.OAPISchema)
}
I suspect the DeepEqual is considering too many fields
hmm, after change the code a bit, I found that (in my case) they are different. Continuing debugging...