Skip to content
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

[golang] "type": "object" gets converted to *interface{} instead of interface{} #7474

Open
grokify opened this issue Jan 23, 2018 · 3 comments

Comments

@grokify
Copy link

grokify commented Jan 23, 2018

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

https://github.com/grokify/go-ringcentral/blob/28498505dba03a0d355a88e37d7c9ad1a338255b/codegen/swagger_ringcentral_spec.json

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

grokify/go-ringcentral-client#10

Suggest a fix/enhancement

Set to interface{} instead of *interface{}

@grokify grokify changed the title [golang] [golang] "type": "object" gets converted to *interface{} instead of interface{} Jan 23, 2018
@moshegood
Copy link
Contributor

Bump. This is still an issue.

You should pretty much never use *interface{} in go, as the regular interface{} is already nil-able.

@HugoMario
Copy link
Contributor

hey @moshegood, thanks for bumping this. What is the best approach for this? i could help applying changes.

@moshegood
Copy link
Contributor

moshegood commented Mar 7, 2021

Hi @HugoMario. I've got a fix to this in a PR here: #10932

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants