Repository: getkin/kin-openapi (go)

Issue:
Missing deprecated field in openapi v2
https://github.com/getkin/kin-openapi/blob/648d6b9a170b6162c79927aeba39bda2fe37386a/openapi2/openapi2.go#L147

For some reason the `deprecated` field is missing for the v2 operation struct.
Is it intentional?

Pull request description:
fix: add deprecated field to openapi2.Operation
fixes #558 

Patch:
diff --git a/openapi2/openapi2.go b/openapi2/openapi2.go
index c504288..dcc5ddb 100644
--- a/openapi2/openapi2.go
+++ b/openapi2/openapi2.go
@@ -148,6 +148,7 @@ type Operation struct {
 	openapi3.ExtensionProps
 	Summary      string                 `json:"summary,omitempty" yaml:"summary,omitempty"`
 	Description  string                 `json:"description,omitempty" yaml:"description,omitempty"`
+	Deprecated   bool                   `json:"deprecated,omitempty" yaml:"deprecated,omitempty"`
 	ExternalDocs *openapi3.ExternalDocs `json:"externalDocs,omitempty" yaml:"externalDocs,omitempty"`
 	Tags         []string               `json:"tags,omitempty" yaml:"tags,omitempty"`
 	OperationID  string                 `json:"operationId,omitempty" yaml:"operationId,omitempty"`
diff --git a/openapi2conv/openapi2_conv.go b/openapi2conv/openapi2_conv.go
index 387a05a..d34dd31 100644
--- a/openapi2conv/openapi2_conv.go
+++ b/openapi2conv/openapi2_conv.go
@@ -155,6 +155,7 @@ func ToV3Operation(doc2 *openapi2.T, components *openapi3.Components, pathItem *
 		OperationID:    operation.OperationID,
 		Summary:        operation.Summary,
 		Description:    operation.Description,
+		Deprecated:     operation.Deprecated,
 		Tags:           operation.Tags,
 		ExtensionProps: operation.ExtensionProps,
 	}
@@ -922,6 +923,7 @@ func FromV3Operation(doc3 *openapi3.T, operation *openapi3.Operation) (*openapi2
 		OperationID:    operation.OperationID,
 		Summary:        operation.Summary,
 		Description:    operation.Description,
+		Deprecated:     operation.Deprecated,
 		Tags:           operation.Tags,
 		ExtensionProps: operation.ExtensionProps,
 	}


Test patch:
diff --git a/openapi2conv/issue558_test.go b/openapi2conv/issue558_test.go
new file mode 100644
index 0000000..78661bf
--- /dev/null
+++ b/openapi2conv/issue558_test.go
@@ -0,0 +1,37 @@
+package openapi2conv
+
+import (
+	"testing"
+
+	"github.com/invopop/yaml"
+	"github.com/stretchr/testify/require"
+)
+
+func TestPR558(t *testing.T) {
+	spec := `
+swagger: '2.0'
+info:
+  version: 1.0.0
+  title: title
+paths:
+  /test:
+    get:
+      deprecated: true
+      parameters:
+      - in: body
+        schema:
+          type: object
+      responses:
+        '200':
+          description: description
+`
+	doc3, err := v2v3YAML([]byte(spec))
+	require.NoError(t, err)
+	require.NotEmpty(t, doc3.Paths["/test"].Get.Deprecated)
+	_, err = yaml.Marshal(doc3)
+	require.NoError(t, err)
+
+	doc2, err := FromV3(doc3)
+	require.NoError(t, err)
+	require.NotEmpty(t, doc2.Paths["/test"].Get.Deprecated)
+}