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

bug: jsonschema.Reflector.ReflectFromType misses methods defined on pointer receiver #102

Closed
candiduslynx opened this issue Sep 26, 2023 · 1 comment

Comments

@candiduslynx
Copy link
Contributor

If we have the following type

type S struct {}

func (*S) JSONSchemaExtend(sc *jsonschema.Schema) {}

then the reflection will miss the fact that the type implements the method.

There's a workaround to defint the func having value receiver, but the pointer receiver should also work.

@samlown
Copy link
Contributor

samlown commented Oct 5, 2023

I don't agree with the assumption there. JSON Schema always operates on object instances as opposed to pointers so the code could become messy attempting to solve this. I've updated the README to try and clarify this at least.

@samlown samlown closed this as completed Oct 5, 2023
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

2 participants