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

spec OrderSchemaItems.Less panic on reflect.ValueOf(ii).Int() #153

Closed
limpo1989 opened this issue Dec 14, 2021 · 0 comments
Closed

spec OrderSchemaItems.Less panic on reflect.ValueOf(ii).Int() #153

limpo1989 opened this issue Dec 14, 2021 · 0 comments

Comments

@limpo1989
Copy link

spec/properties.go

Lines 44 to 66 in 6ca6ff8

func (items OrderSchemaItems) Less(i, j int) (ret bool) {
ii, oki := items[i].Extensions.GetString("x-order")
ij, okj := items[j].Extensions.GetString("x-order")
if oki {
if okj {
defer func() {
if err := recover(); err != nil {
defer func() {
if err = recover(); err != nil {
ret = items[i].Name < items[j].Name
}
}()
ret = reflect.ValueOf(ii).String() < reflect.ValueOf(ij).String()
}
}()
return reflect.ValueOf(ii).Int() < reflect.ValueOf(ij).Int()
}
return true
} else if okj {
return false
}
return items[i].Name < items[j].Name
}

Line 59: ii ij is string Value

reflect.ValueOf(ii).Int() panic: reflect: call of Int on string Value

@limpo1989 limpo1989 changed the title spec OrderSchemaItems.Less panic on <code>reflect.ValueOf(ii).Int()</code> spec OrderSchemaItems.Less panic on reflect.ValueOf(ii).Int() Dec 14, 2021
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

1 participant