microsoft / microsoft/typespec

Is it allowed to have more than one operations to have the same request visibility?

Open
#3,033 1 comment 0 reactions 0 assignees View on GitHub
bug triaged:core
Dominant language
Java
Stars
5.9k
Forks
394
Avg merge
1d 23h
Merged PRs (30d)
104

Description

TypeSpec http library has provides a @parameterVisibility to handle cases like patch was actually meaning create and update, instead of just update, but I am just curious if a put operation would co-exist with a creatable and updatable patch.
```
@put op putModel(@body input: VisibilityModel): VisibilityModel;
@parameterVisibility("create", "update")
@patch op patchModel(@body input: VisibilityModel): VisibilityModel;
```

Currently, it will report an error of duplicate type name in openapi3 emitter [playground link](https://cadlplayground.z22.web.core.windows.net/?c=aW1wb3J0ICJAdHlwZXNwZWMvaHR0cCI7Cgp1c2luZyBUeXBlU3BlYy5IdHRwOwoKbW9kZWwgVmlzaWJpbGl0eU3FEHsKICBAdskVKExpZmVjeWNsZS5SZWFkKQogIHJlYWRQcm9wOiBzdHJpbmc7CtkzQ3JlYXRlxDVjxQrMN1tdOwp9CgpAcHV0IG9wIHB1dOUAgShAYm9keSBpbnB1dDrwAJ4p0RI7CkBwYXJhbWV0ZXLKG%2FEAgywgyhJVcGTlAJVAcGF0Y2goI3sgaW1wbGljaXRPcHRpb25hxEI6IHRydWUgfSkK5ACcxCn%2FAJ73AJ4%3D&e=%40typespec%2Fopenapi3&options=%7B%7D)
```
error
@typespec/openapi/duplicate-type-name
Duplicate type name: 'VisibilityModelCreateOrUpdate'. Check @friendlyName decorators and overlap with types in TypeSpec or service namespace.
```
which I don't think it's truely duplicated here in this case?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.