-
Notifications
You must be signed in to change notification settings - Fork 344
Open
Labels
bugSomething isn't workingSomething isn't workingopenapi3:converterIssues for @typespec/openapi3 openapi to typespec converterIssues for @typespec/openapi3 openapi to typespec convertertriaged:core
Milestone
Description
Describe the bug
This may be a problem with other contexts or OpenAPI versions, but I found this while debugging examples for the 1.10 release notes.
When importing a schema that has $ref with sibling keywords, if one of the sibling keywords is deprecated, we don't emit a deprecation message or a newline, which makes the generated TypeSpec unable to parse.
We need to provide a message for the #deprecated directive and split it onto a new line.
Reproduction
Try to import:
openapi: 3.2.0
info:
title: Minimal import deprecated reproduction
version: 1.0.0
paths:
/test:
get:
parameters:
- name: order
in: query
schema:
$ref: "#/components/schemas/OrderEnum"
default: desc
deprecated: true
responses:
"200":
description: OK
components:
schemas:
OrderEnum:
type: string
enum:
- asc
- descResult (unformatted):
import "@typespec/http";
import "@typespec/openapi";
import "@typespec/openapi3";
using Http;
using OpenAPI;
@service(#{
title: "Minimal import deprecated reproduction"
})
@info(#{version: "1.0.0"})
namespace Minimalimportdeprecatedreproduction;
enum OrderEnum {
"asc",
"desc",
}
@route("/test") @get
// FIXME: Open API operation 'GET /test' is missing an operationId. Generated: 'get_test'
op get_test(#deprecated @query(#{explode: true}) order?: OrderEnum = OrderEnum.desc): OkResponse;Checklist
- Follow our Code of Conduct
- Check that there isn't already an issue that request the same bug to avoid creating a duplicate.
- Check that this is a concrete bug. For Q&A open a GitHub Discussion.
- The provided reproduction is a minimal reproducible example of the bug.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingopenapi3:converterIssues for @typespec/openapi3 openapi to typespec converterIssues for @typespec/openapi3 openapi to typespec convertertriaged:core