Skip to content
Merged
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
5 changes: 5 additions & 0 deletions packages/typespec-powershell/src/utils/modelUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -936,6 +936,7 @@ function getSchemaForModel(
};
}
for (const [propName, prop] of model.properties) {
const clientName = getClientNameOverride(dpgContext, prop, "powershell");
const encodedName = resolveEncodedName(program, prop, "application/json");
const restApiName = getWireName(dpgContext, prop);
const name = encodedName ?? restApiName ?? propName;
Expand Down Expand Up @@ -968,6 +969,10 @@ function getSchemaForModel(
}
// ToDo: need to confirm there is no duplicated properties.
const property = new Property(name, getDoc(program, prop) || propSchema.language.default.description || "", propSchema || new ObjectSchema(name, ""));
if (clientName) {
// Use the client name as the property name if it is specified
property.language.default.name = clientName;
}
if (!prop.optional) {
property.required = true;
}
Expand Down
Loading