swagger-api / swagger-api/swagger-codegen
[golang] `"type": "object"` gets converted to `*interface{}` instead of `interface{}`
Nobody has claimed this yet.
- Dominant language
- Mustache
- Stars
- 17.8k
- Forks
- 6k
- PR merge metrics
- No merged PRs in 30d
Description
Description
Definition property "type": "object" gets converted to *interface{} which returns an error when set to a struct or pointer pointer.
Swagger-codegen version
2.3.1
Swagger declaration file content or url
Command line used for generation
https://github.com/grokify/go-ringcentral/tree/28498505dba03a0d355a88e37d7c9ad1a338255b/codegen
java -jar swagger-codegen-cli.jar generate -c swagger_ringcentral_config.json -i swagger_ringcentral.json -l go -o .
Steps to reproduce
body := ringcentral.ScimUserPatch{
Operations: []ringcentral.PatchOperationInfo{
{
Op: "add",
Value: ringcentral.UserInfo{
Addresses: []ringcentral.AddressInfo{
{
Type_: "work",
StreetAddress: "100 Main Street",
Locality: "South Park",
Region: "CO",
PostalCode: "80440",
Country: "US",
},
},
},
},
},
Schemas: []string{"urn:ietf:params:scim:api:messages:2.0:PatchOp"},
}
Related issues/PRs
https://github.com/grokify/go-ringcentral/issues/10
Suggest a fix/enhancement
Set to interface{} instead of *interface{}
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the supplied Swagger declaration and the Java generation command using swagger-codegen 2.3.1, then inspect the Go generation path that maps an object property to a Go type. Reproduce the generated *interface{} with the linked RingCentral example and verify the output is interface{} while preserving valid handling for structs and pointers.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- backend-api-design, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100