Azure / Azure/autorest

[openapi to tsp] Fix `accept` header logic

Open
#4,941 2 comments 0 reactions 0 assignees View on GitHub
openapi-to-tsp
Dominant language
TypeSpec
Stars
4.8k
Forks
736
Avg merge
2d 14h
Merged PRs (30d)
1

Description

Given the following swagger definition:
```
"produces": [
"application/vnd.microsoft.appconfig.kv+json",
"application/problem+json"
],
```

The converter outputs the following typespec code where all of the supported content types are bundled into 1 string:
```
accept: "application/vnd.microsoft.appconfig.kv+json, application/problem+json";
```

The correct code should represent each content type individually:
```
accept: "application/vnd.microsoft.appconfig.kv+json" | "application/problem+json";
```

cc @joheredi

Contributor guide

Open the contributing guide

Research direction

Start with the OpenAPI-to-TypeSpec converter logic that handles the Swagger `produces` field and maps it to the `accept` header. Verify the generated TypeSpec for multiple content types, and consider the work complete when each supported type is emitted as a separate union member rather than one comma-separated string.

Written by the indexing model from the issue text.

Assessment

Tech stack
openapi
Domain
api, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.