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

View file

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

View file

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

View file

@ -47,7 +47,9 @@
["/plus/:z"
{:get {:summary "plus"
: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?}}
:openapi {:operationId "spec-plus"
:deprecated true
@ -78,7 +80,8 @@
["/plus/*z"
{:get {:summary "plus"
: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?]]}
:openapi {:responses {400 {:description "kosh"
:content {"application/json" {:schema {:type "string"}}}}}}
@ -107,7 +110,8 @@
["/plus/*z"
{:get {:summary "plus"
: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}}
:openapi {:responses {400 {:content {"application/json" {:schema {:type "string"}}}
:description "kosh"}}}
@ -163,6 +167,8 @@
:format "int64"}}
{:in "query"
:name "y"
:description "this is deprecated"
:deprecated true
:required true
:schema {:type "integer"
:format "int64"}}
@ -212,6 +218,8 @@
{:in "query"
:name :y
:required true
:description "this is deprecated"
:deprecated true
:schema {:type "integer"}}
{:in "path"
:name :z
@ -256,6 +264,8 @@
{:in "query"
:name "y"
:required true
:description "this is deprecated"
:deprecated true
:schema {:type "integer"
:format "int32"}}
{:in "path"