Skip to content

[Bug]: OpenAPI spec using the Read model for the requestBody of an Update operation #7175

@abes-xpv

Description

@abes-xpv

Describe the bug

Given a model A with read-only properties, I would expect the openapi emitter to emit a dedicated AUpdate type to use for the requestBody of an op decorated with @parameterVisibility(Lifecycle.Update) but in some cases it will use the A model as-is.

The correct types are emitted if one of the model properties is decorated with @visibility(Lifecycle.Update) (i.e. a visibility that includes Update and excludes Read)

At face value this appears to be similar to #6917 but the issues are not exactly the same:

Reproduction

https://typespec.io/playground/?c=bW9kZWwgQSB7CiAgQHZpc2liaWxpdHkoTGlmZWN5Y2xlLlJlYWQpxB5kb2MoInJlYWRPbmx5RmllbGQgc2hvdWxkIG5vdCBhcHBlYXIgaW4gdGhlIHNjaGVtYSBmb3LFD2B1cGRhdGVgIHJlcXVlc3RCb2R5IsRVzU86IHN0cmluZzsKCiAgLy8gRW5hYmxlxUFsaW5lIGJlbG93IHRvxFdjxhhjcmVhdGlvbiBvZiBhIGRlZGljYXRlZCBgQVXHcuUA4cZQ9gDgxinkAI1zb21lT3RoZXLlAI4%2F6gCPfQoKQHBhcmFtZXRlclbcRW9wIOYA6yguLi5BKTogQTsK&e=%40typespec%2Fopenapi3&options=%7B%7D&version=1.0.0-rc.0

Checklist

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingneeds-areaneeds-infoMark an issue that needs reply from the author or it will be closed automatically

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions