Skip to content

Import - Deprecated not imported for operations #10900

Description

@baywet

Clear and concise description of the problem

In #4453 we've implemented importing deprecated for models and properties.
However, we forgot the operations themselves, importing

openapi: 3.0.0
info:
  title: Widget Service
  version: 0.0.0
tags:
  - name: Widgets
paths:
  /widgets:
    get:
      operationId: Widgets_list
      description: List widgets
      parameters: []
      responses:
        '200':
          description: The request has succeeded.
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Widget'
        default:
          description: An unexpected error response.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      tags:
        - Widgets
      deprecated: true
components:
  schemas:
    Error:
      type: object
      required:
        - code
        - message
      properties:
        code:
          type: integer
          format: int32
        message:
          type: string
    Widget:
      type: object
      required:
        - id
        - weight
        - color
      properties:
        id:
          type: string
          readOnly: true
        weight:
          type: integer
          format: int32
        color:
          type: string
          enum:
            - red
            - blue

Is going to result in

import "@typespec/http";

using Http;
@service(#{ title: "Widget Service" })
namespace DemoService;

model Widget {
  @visibility(Lifecycle.Read)
  id: string;

  weight: int32;
  color: "red" | "blue";
}

@error
model Error {
  code: int32;
  message: string;
}

@route("/widgets")
@tag("Widgets")
interface Widgets {
  /** List widgets */
  @get list(): Widget[] | Error;
}

Note that the list operation is missing `#deprecated "deprecated".

Checklist

  • Follow our Code of Conduct
  • Read the docs.
  • Check that there isn't already an issue that request the same feature to avoid creating a duplicate.

Metadata

Metadata

Assignees

Labels

featureNew feature or requestopenapi3:converterIssues for @typespec/openapi3 openapi to typespec converter

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions