Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
changeKind: fix
packages:
- "@azure-tools/typespec-java"
---

Expose the `required-fields-as-ctor-args` emitter option in `tspconfig.yaml`. It controls whether required model properties are generated as constructor arguments. The default remains `true`.

```yaml
options:
"@azure-tools/typespec-java":
required-fields-as-ctor-args: false
```
2 changes: 1 addition & 1 deletion packages/typespec-java/core-commit.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{ "sha": "43ff00415eb571c0c9e2d1274f621a61886e4a9b" }
{ "sha": "ec09e28b3d2990734d1b54ebad85411adb148d12" }
7 changes: 7 additions & 0 deletions packages/typespec-java/src/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,13 @@ export const EmitterOptionsSchema: JSONSchemaType<EmitterOptions> = {
nullable: true,
default: true,
},
// "required-fields-as-ctor-args": {
// type: "boolean",
// description:
// "When set to `true`, required properties of the model are generated as constructor arguments; otherwise, they are generated as setter methods. Default value is `true`. This option is for backward-compatibility.",
// nullable: true,
// default: true,
// },

// customization
...UnbrandedSdkEmitterOptions["generate-protocol-methods"],
Expand Down
Loading