From 47bda6bb719714d9a2db8f650617c737820c9edc Mon Sep 17 00:00:00 2001 From: shambel-amare Date: Fri, 21 Jun 2024 23:38:50 +0300 Subject: [PATCH] added simple WithCustomSchemaApplier method to attach CustomeSchemaApplier interface anywhere --- api.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/api.go b/api.go index ae64f1a..43883ba 100644 --- a/api.go +++ b/api.go @@ -344,6 +344,14 @@ type Model struct { s func(s *openapi3.Schema) } +// WithCustomSchemaApplier sets the custom schema applier. +// +// Note: this overrides any existing custom schema applier on the type. +func (m Model) WithCustomSchemaApplier(fn func(s *openapi3.Schema)) Model { + m.s = fn + return m +} + func (m Model) ApplyCustomSchema(s *openapi3.Schema) { if m.s == nil { return