diff --git a/pkg/builder/openapi.go b/pkg/builder/openapi.go index 98be932cb..db2ca2688 100644 --- a/pkg/builder/openapi.go +++ b/pkg/builder/openapi.go @@ -286,6 +286,7 @@ func (o *openAPI) buildOperations(route common.Route, inPathCommonParamsMap map[ Description: route.Description(), Consumes: route.Consumes(), Produces: route.Produces(), + Deprecated: route.Deprecated(), Schemes: o.config.ProtocolList, Responses: &spec.Responses{ ResponsesProps: spec.ResponsesProps{ diff --git a/pkg/builder3/openapi.go b/pkg/builder3/openapi.go index a0c00f07f..5e142a4b1 100644 --- a/pkg/builder3/openapi.go +++ b/pkg/builder3/openapi.go @@ -77,6 +77,7 @@ func (o *openAPI) buildOperations(route common.Route, inPathCommonParamsMap map[ ret := &spec3.Operation{ OperationProps: spec3.OperationProps{ Description: route.Description(), + Deprecated: route.Deprecated(), Responses: &spec3.Responses{ ResponsesProps: spec3.ResponsesProps{ StatusCodeResponses: make(map[int]*spec3.Response), diff --git a/pkg/common/interfaces.go b/pkg/common/interfaces.go index 059fc551b..1767a950c 100644 --- a/pkg/common/interfaces.go +++ b/pkg/common/interfaces.go @@ -36,6 +36,8 @@ type Route interface { // StatusCodeResponses defines a mapping of HTTP Status Codes to the specific response(s). // Multiple responses with the same HTTP Status Code are acceptable. StatusCodeResponses() []StatusCodeResponse + // Deprecated marks a route as deprecated + Deprecated() bool } // StatusCodeResponse is an explicit response type with an HTTP Status Code. diff --git a/pkg/common/restfuladapter/route_adapter.go b/pkg/common/restfuladapter/route_adapter.go index c7ba3a564..362f35bfb 100644 --- a/pkg/common/restfuladapter/route_adapter.go +++ b/pkg/common/restfuladapter/route_adapter.go @@ -66,3 +66,7 @@ func (r *RouteAdapter) RequestPayloadSample() interface{} { func (r *RouteAdapter) ResponsePayloadSample() interface{} { return r.Route.WriteSample } + +func (r *RouteAdapter) Deprecated() bool { + return r.Route.Deprecated +}