Describe the bug
Corner case follow-up to #441.
When using the OptionalProperties template on a model that includes a @madeRequired decorator, the decorator is preserved in the generated model which causes a compiler error.
Compiling the reproducer below results in:
TypeSpec compiler v1.13.0
× Compiling
Diagnostics were reported during compilation:
main.tsp:12:3 - error @typespec/versioning/made-required-optional: Property 'foo?' marked with @madeRequired but is optional. Should be 'foo'
> 12 | foo: string
| ^^^
Found 1 error.
I think OptionalProperties should omit @madeRequired decorators in the generated model.
Reproduction
import "@typespec/versioning";
@TypeSpec.Versioning.versioned(Reproducer.Versions)
namespace Reproducer;
enum Versions {
demo: "demo"
}
model Required {
@TypeSpec.Versioning.madeRequired(Versions.demo)
foo: string
}
model Optional is OptionalProperties<Required>;
Checklist
Describe the bug
Corner case follow-up to #441.
When using the OptionalProperties template on a model that includes a @madeRequired decorator, the decorator is preserved in the generated model which causes a compiler error.
Compiling the reproducer below results in:
I think
OptionalPropertiesshould omit@madeRequireddecorators in the generated model.Reproduction
Checklist