You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a use-case where I dynamically want to build JSON schema's from Go based on information from the database. I thought I would be able to do this with this library, but when implementing it I found out that the JSONSchema() and JSONSchemaExtend() interfaces do not give you access to the actual data of the struct. Any chance support for this could be added?
The main reason is because of the following 2 locations:
I think it could be relatively simple to store the original value (perhaps make it optional on the reflector?) and make it available in JSONSchema()/JSONSchemaExtend().
I have a use-case where I dynamically want to build JSON schema's from Go based on information from the database. I thought I would be able to do this with this library, but when implementing it I found out that the
JSONSchema()
andJSONSchemaExtend()
interfaces do not give you access to the actual data of the struct. Any chance support for this could be added?The main reason is because of the following 2 locations:
https://github.com/invopop/jsonschema/blob/main/reflect.go#L164 (directly drops the actual value)
https://github.com/invopop/jsonschema/blob/main/reflect.go#L360 (makes a new instance of the struct)
I think it could be relatively simple to store the original value (perhaps make it optional on the reflector?) and make it available in
JSONSchema()
/JSONSchemaExtend()
.Example code:
Current output:
Expected output:
The text was updated successfully, but these errors were encountered: