From be48da5ce74c067be2dfbef240d2594828beb7b0 Mon Sep 17 00:00:00 2001 From: Oleksandr Redko Date: Tue, 26 Nov 2024 20:08:31 +0200 Subject: [PATCH] openapi3: fix deprecation comments (#1034) --- .github/docs/openapi3.txt | 11 +++++++---- openapi3/schema_formats.go | 2 ++ 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/.github/docs/openapi3.txt b/.github/docs/openapi3.txt index a1631dff..4729e0c3 100644 --- a/.github/docs/openapi3.txt +++ b/.github/docs/openapi3.txt @@ -128,13 +128,16 @@ func DefineNumberFormatValidator(name string, validator NumberFormatValidator) number format. func DefineStringFormat(name string, pattern string) - DefineStringFormat defines a regexp pattern for a given string - format Deprecated: Use openapi3.DefineStringFormatValidator(name, + DefineStringFormat defines a regexp pattern for a given string format + + Deprecated: Use openapi3.DefineStringFormatValidator(name, NewRegexpFormatValidator(pattern)) instead. func DefineStringFormatCallback(name string, callback func(string) error) - DefineStringFormatCallback defines a callback function for a given - string format Deprecated: Use openapi3.DefineStringFormatValidator(name, + DefineStringFormatCallback defines a callback function for a given string + format + + Deprecated: Use openapi3.DefineStringFormatValidator(name, NewCallbackValidator(fn)) instead. func DefineStringFormatValidator(name string, validator StringFormatValidator) diff --git a/openapi3/schema_formats.go b/openapi3/schema_formats.go index 023c2669..1b76707f 100644 --- a/openapi3/schema_formats.go +++ b/openapi3/schema_formats.go @@ -131,12 +131,14 @@ func DefineIntegerFormatValidator(name string, validator IntegerFormatValidator) } // DefineStringFormat defines a regexp pattern for a given string format +// // Deprecated: Use openapi3.DefineStringFormatValidator(name, NewRegexpFormatValidator(pattern)) instead. func DefineStringFormat(name string, pattern string) { DefineStringFormatValidator(name, NewRegexpFormatValidator(pattern)) } // DefineStringFormatCallback defines a callback function for a given string format +// // Deprecated: Use openapi3.DefineStringFormatValidator(name, NewCallbackValidator(fn)) instead. func DefineStringFormatCallback(name string, callback func(string) error) { DefineStringFormatValidator(name, NewCallbackValidator(callback))