swaggest / jsonschema-go

JSON Schema mapping for Go
https://pkg.go.dev/github.com/swaggest/jsonschema-go
MIT License
102 stars 13 forks source link

should InterceptType be called after options applied? #81

Open Rainshaw opened 1 year ago

Rainshaw commented 1 year ago

https://github.com/swaggest/jsonschema-go/blob/d4b7536630ed226438fc6fc2b3226a3f1a0ee285/reflect.go#L229-L244

the rc instance does not set InterceptProperty filed, so the L236 just set rc.InterceptProperty = checkSchemaSetup.

When the options applied, the InterceptProperty would be rewrite.

vearutop commented 1 year ago

That depends on how rc.InterceptType is handled. If jsonschema.InterceptType function is used, original interceptor will be preserved and new one would be added to the chain. But it is also possible to replace rc.InterceptType and discard all prev configuration, that's up to a developer.

Though, this is not so relevant now, as exported rc.InterceptType has got deprecated in favor of unexported rc.interceptSchema and jsonschema.InterceptSchema config option.