microsoft / typespec

https://typespec.io/
MIT License
4.49k stars 213 forks source link

[Bug]: Update emitter to set extensions at Server object #3939

Closed skywing918 closed 3 months ago

skywing918 commented 3 months ago

Describe the bug

{The problematic object} failed to {describe the problem}.

TSP

import "@typespec/http";
import "@typespec/openapi";

using TypeSpec.Http;
using OpenAPI;

@service
@extension("x-custom", "foo")
@server("https://test.contoso.com", "test domain")
namespace Extensions;

Actual Specification

openapi: 3.0.0
info:
  title: (title)
  version: 0.0.0
tags: []
paths: {}
components: {}
servers:
  - url: https://test.contoso.com
    description: test domain
    variables: {}

Expected Specification

https://spec.openapis.org/oas/v3.0.0#server-object image

openapi: 3.0.0
info:
  title: (title)
  version: 0.0.0
tags: []
paths: {}
components: {}
servers:
  - url: https://test.contoso.com
    description: test domain
    x-custom: foo
    variables: {}

Reproduction

  1. git clone https://github.com/skywing918/typespec-workaround.git
  2. tsp compile extension-server.tsp
  3. Open /tsp-output/@typespec/openapi3 to get the result

Checklist

timotheeguerin commented 3 months ago

Dup of https://github.com/microsoft/typespec/issues/3925