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

type of enum is nil #277

Open
georgesfarah opened this issue Apr 23, 2024 · 1 comment
Open

type of enum is nil #277

georgesfarah opened this issue Apr 23, 2024 · 1 comment

Comments

@georgesfarah
Copy link

georgesfarah commented Apr 23, 2024

Can't get types of enums, it's nil. Currently I'm using this workaround to get the types:

for pair := orderedmap.First(schema.Properties); pair != nil; pair = pair.Next() {
 	Type := ""
	if pair.Value().Schema().Type != nil {
		Type = pair.Value().Schema().Type[0]
	} else if pair.Value().Schema().Enum != nil {
		valueType := reflect.TypeOf(pair.Value().Schema().Enum[0].Value)
		Type = valueType.String()
	}
}
@daveshanley
Copy link
Member

Can you provide a sample specification snippet please?

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

No branches or pull requests

2 participants