Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: @info decorator failed to exclude unallow keys, it only allow fixed fields and start with "x-". #3887

Closed
4 tasks done
Tracked by #3836
skywing918 opened this issue Jul 18, 2024 · 2 comments · Fixed by #4505
Closed
4 tasks done
Tracked by #3836
Labels
bug Something isn't working emitter:openapi3 Issues for @typespec/openapi3 emitter triaged:core
Milestone

Comments

@skywing918
Copy link
Member

skywing918 commented Jul 18, 2024

Describe the bug

@info decorator failed to exclude unallow keys, it only allow fixed fields and start with "x-".

##TSP

import "@typespec/openapi";
import "@typespec/openapi3";

using TypeSpec.OpenAPI;

@info({
  unallowKey: {},
})
@service({
  title: "My service",
})
namespace PetStore;


Actual Specification

openapi: 3.0.0
info:
  title: My service
  unallowKey: {}
  version: 0.0.0
tags: []
paths: {}
components: {}

Expected Specification

image

openapi: 3.0.0
info:
  title: My service
  version: 0.0.0
tags: []
paths: {}
components: {}

Reproduction

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

Checklist

@skywing918 skywing918 added the bug Something isn't working label Jul 18, 2024
@timotheeguerin
Copy link
Member

This was something we didn't do exactly by design but changing it would be breaking. We have also considered removing the restriction of @extension to allow any keys to provide support for any things that we don't have a dedicated decorator for.

@wanlwanl
Copy link
Member

For OAS3 emitter, at least we can improve it by outputing warning log when compiling tsp

@markcowl markcowl added the emitter:openapi3 Issues for @typespec/openapi3 emitter label Jul 22, 2024
@markcowl markcowl added this to the Backlog milestone Jul 22, 2024
github-merge-queue bot pushed a commit that referenced this issue Sep 30, 2024
Fix #3887

---------

Co-authored-by: Kyle Zhang <[email protected]>
Co-authored-by: Timothee Guerin <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working emitter:openapi3 Issues for @typespec/openapi3 emitter triaged:core
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants