Skip to content

Commit

Permalink
chore(dotnet): don't generate setters on interfaces (#6293)
Browse files Browse the repository at this point in the history
  • Loading branch information
kblok committed Apr 30, 2021
1 parent d9015b9 commit bb84539
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions utils/doclint/generateDotnetApi.js
Original file line number Diff line number Diff line change
Expand Up @@ -288,15 +288,19 @@ function renderMember(member, parent, out) {
let propertyOrigin = member.name;
if (member.type.expression === '[string]|[float]')
propertyOrigin = `${member.name}String`;
output(`[JsonPropertyName("${propertyOrigin}")]`)
if(!member.clazz)
output(`[JsonPropertyName("${propertyOrigin}")]`)
if (parent && member && member.name === 'children') { // this is a special hack for Accessibility
console.warn(`children property found in ${parent.name}, assuming array.`);
type = `IEnumerable<${parent.name}>`;
}

if(!type.endsWith('?') && !member.required && nullableTypes.includes(type))
type = `${type}?`;
output(`public ${type} ${name} { get; set; }`);
if(member.clazz)
output(`public ${type} ${name} { get; }`);
else
output(`public ${type} ${name} { get; set; }`);
} else {
throw new Error(`Problem rendering a member: ${type} - ${name} (${member.kind})`);
}
Expand Down

0 comments on commit bb84539

Please sign in to comment.