Merge pull request #714 from mokshasoft/openapi3-parameter-deprecation

Place the openapi deprecation tag directly under parameters
This commit is contained in:
Joel Kaasinen 2025-04-25 15:13:26 +03:00 committed by GitHub
commit 9797725ae8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 22 additions and 5 deletions

View file

@ -139,6 +139,7 @@ Malli:
[:x [:x
{:title "X parameter" {:title "X parameter"
:description "Description for X parameter" :description "Description for X parameter"
:json-schema/deprecated true
:json-schema/default 42} :json-schema/default 42}
int?] int?]
[:y int?]]}}}] [:y int?]]}}}]
@ -151,6 +152,7 @@ Schema:
{:post {:post
{:parameters {:parameters
{:body {:x (schema-tools.core/schema s/Num {:description "Description for X parameter" {:body {:x (schema-tools.core/schema s/Num {:description "Description for X parameter"
:openapi/deprecated true
:openapi/example 13 :openapi/example 13
:openapi/default 42}) :openapi/default 42})
:y int?}}}}] :y int?}}}}]
@ -165,6 +167,7 @@ Spec:
{:body (spec-tools.data-spec/spec ::foo {:body (spec-tools.data-spec/spec ::foo
{:x (schema-tools.core/spec {:spec int? {:x (schema-tools.core/spec {:spec int?
:description "Description for X parameter" :description "Description for X parameter"
:openapi/deprecated true
:openapi/example 13 :openapi/example 13
:openapi/default 42}) :openapi/default 42})
:y int?}}}}}] :y int?}}}}}]

View file

@ -97,6 +97,10 @@
:json-schema/default 30 :json-schema/default 30
:json-schema/example 10} :json-schema/example 10}
int?] int?]
[:charset {:title "Which charset to use?"
:optional true
:json-schema/deprecated true}
string?]
[:email {:title "Email address to search for" [:email {:title "Email address to search for"
:json-schema/format "email"} :json-schema/format "email"}
string?]]} string?]]}

View file

@ -110,8 +110,8 @@
(merge {:in (name in) (merge {:in (name in)
:name k :name k
:required (required? k) :required (required? k)
:schema schema} :schema (dissoc schema :description :deprecated)}
(select-keys schema [:description]))) (select-keys schema [:description :deprecated])))
(into []))}) (into []))})
(when body (when body
;; :body uses a single schema to describe every :requestBody ;; :body uses a single schema to describe every :requestBody

View file

@ -47,7 +47,9 @@
["/plus/:z" ["/plus/:z"
{:get {:summary "plus" {:get {:summary "plus"
:tags [:plus :spec] :tags [:plus :spec]
:parameters {:query {:x int?, :y int?} :parameters {:query {:x int?, :y (st/spec {:spec int?
:description "this is deprecated"
:openapi/deprecated true})}
:path {:z int?}} :path {:z int?}}
:openapi {:operationId "spec-plus" :openapi {:operationId "spec-plus"
:deprecated true :deprecated true
@ -78,7 +80,8 @@
["/plus/*z" ["/plus/*z"
{:get {:summary "plus" {:get {:summary "plus"
:tags [:plus :malli] :tags [:plus :malli]
:parameters {:query [:map [:x int?] [:y int?]] :parameters {:query [:map [:x int?] [:y {:json-schema/deprecated true
:description "this is deprecated"} int?]]
:path [:map [:z int?]]} :path [:map [:z int?]]}
:openapi {:responses {400 {:description "kosh" :openapi {:responses {400 {:description "kosh"
:content {"application/json" {:schema {:type "string"}}}}}} :content {"application/json" {:schema {:type "string"}}}}}}
@ -107,7 +110,8 @@
["/plus/*z" ["/plus/*z"
{:get {:summary "plus" {:get {:summary "plus"
:tags [:plus :schema] :tags [:plus :schema]
:parameters {:query {:x s/Int, :y s/Int} :parameters {:query {:x s/Int, :y (schema-tools.core/schema s/Int {:description "this is deprecated"
:openapi/deprecated true})}
:path {:z s/Int}} :path {:z s/Int}}
:openapi {:responses {400 {:content {"application/json" {:schema {:type "string"}}} :openapi {:responses {400 {:content {"application/json" {:schema {:type "string"}}}
:description "kosh"}}} :description "kosh"}}}
@ -163,6 +167,8 @@
:format "int64"}} :format "int64"}}
{:in "query" {:in "query"
:name "y" :name "y"
:description "this is deprecated"
:deprecated true
:required true :required true
:schema {:type "integer" :schema {:type "integer"
:format "int64"}} :format "int64"}}
@ -212,6 +218,8 @@
{:in "query" {:in "query"
:name :y :name :y
:required true :required true
:description "this is deprecated"
:deprecated true
:schema {:type "integer"}} :schema {:type "integer"}}
{:in "path" {:in "path"
:name :z :name :z
@ -256,6 +264,8 @@
{:in "query" {:in "query"
:name "y" :name "y"
:required true :required true
:description "this is deprecated"
:deprecated true
:schema {:type "integer" :schema {:type "integer"
:format "int32"}} :format "int32"}}
{:in "path" {:in "path"