Fixed several issues related to SDK (#1238)

This commit is contained in:
Xiaogang 2023-09-14 17:08:17 +08:00 коммит произвёл GitHub
Родитель 47a8f17e49
Коммит 6c57875cf0
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
4 изменённых файлов: 11 добавлений и 5 удалений

Просмотреть файл

@ -188,14 +188,14 @@ function setSchemaNames(schemaGroups: Dictionary<Array<Schema>>, azure: boolean,
interfaceName: 'I' + pascalCase(fixLeadingNumber([...deconstruct(schemaName)])),
name: schemaName,
namespace: pascalCase([serviceNamespace, '.', 'Support']),
fullname: choiceSchema.extensions && !choiceSchema.extensions['x-ms-model-as-string'] && choiceSchema.choiceType.type === SchemaType.String ? getPascalIdentifier(schema.language.default.name) : helper.GetCsharpType(choiceSchema.choiceType),
fullname: choiceSchema.extensions && !choiceSchema.extensions['x-ms-model-as-string'] && choiceSchema.choiceType.type === SchemaType.String ? schemaName : helper.GetCsharpType(choiceSchema.choiceType),
enum: {
...schema.language.default.enum,
name: getPascalIdentifier(schema.language.default.name),
name: schemaName,
values: choiceSchema.choices.map(each => {
return {
...each,
name: getPascalIdentifier(each.language.default.name),
name: each.language.default.name,
description: each.language.default.description
};
})

Просмотреть файл

@ -11,6 +11,7 @@
/// <%=parameter.language.default.description%>
/// </param>
<% });}-%>
<% if(!method.language.default.pageable?.nextPageOperation) {-%>
<% (method.requests[0].parameters || []).filter(p=>p.protocol.http.in == 'body' && !project.helper.IsConstantEnumParameter(p)).forEach(function(parameter){-%>
<%if(parameter.extensions && parameter.extensions['x-ms-client-flatten'] ) {-%>
<%project.helper.GetAllPublicVirtualProperties(parameter.schema.language.default.virtualProperties).filter(p => !project.helper.IsConstantEnumProperty(p)).forEach(function(vp) {-%>
@ -24,6 +25,7 @@
/// </param>
<%}-%>
<% });-%>
<% } -%>
<% if(method.language.default.pageable?.nextPageOperation) {-%>
/// <param name='nextPageLink'>
/// The NextLink from the previous successful call to List operation.

Просмотреть файл

@ -11,6 +11,7 @@
/// <%=parameter.language.default.description%>
/// </param>
<% });}-%>
<% if(!method.language.default.pageable?.nextPageOperation) {-%>
<% (method.requests[0].parameters || []).filter(p=>p.protocol.http.in == 'body' && !project.helper.IsConstantEnumParameter(p)).forEach(function(parameter){-%>
<%if(parameter.extensions && parameter.extensions['x-ms-client-flatten'] ) {-%>
<%project.helper.GetAllPublicVirtualProperties(parameter.schema.language.default.virtualProperties).filter(p => !project.helper.IsConstantEnumProperty(p)).forEach(function(vp) {-%>
@ -24,6 +25,7 @@
/// </param>
<%}-%>
<% });-%>
<% } -%>
<% if(method.language.default.pageable?.nextPageOperation) {-%>
/// <param name='nextPageLink'>
/// The NextLink from the previous successful call to List operation.

Просмотреть файл

@ -30,7 +30,7 @@ if (method.extensions && method.extensions['x-ms-request-id']) {
<% } -%>
<%if(method.requests[0].protocol.http.method != 'patch') {-%>
<%# for odata, validation is not needed. -%>
<%-parameter.extensions && parameter.extensions['x-ms-odata'] ? '' : project.helper.ValidateType(parameter.schema, method, parameter.language.default.name, parameter.nullable)%>
<%-parameter.extensions && parameter.extensions['x-ms-odata'] ? '' : project.helper.ValidateType(parameter.schema, method, parameter.language.default.name, parameter.nullable != false)%>
<%}-%>
<%}-%>
<% });-%>
@ -44,7 +44,7 @@ if (method.extensions && method.extensions['x-ms-request-id']) {
}
<% } -%>
<%# for odata, validation is not needed. -%>
<%- parameter.extensions && parameter.extensions['x-ms-odata'] ? '' : project.helper.ValidateType(parameter.schema, method, prefix + parameter.language.default.name, parameter.nullable)%>
<%- parameter.extensions && parameter.extensions['x-ms-odata'] ? '' : project.helper.ValidateType(parameter.schema, method, prefix + parameter.language.default.name, parameter.nullable != false)%>
<%});}-%>
<%(method.parameters || []).filter(p => p.protocol.http.in == 'complex').forEach(function(parameter) {-%>
<%-project.helper.PopulateGroupParameters(parameter)%>
@ -174,6 +174,7 @@ var prefix = parameter.implementation == 'Client' ? `this${clientPrefix}.` : ''-
}
// Serialize Request
string _requestContent = null;
<% if(!method.language.default.pageable?.nextPageOperation) {-%>
<%# ToDo: add RequestBody, formdata support-%>
<% (method.requests[0].parameters || []).filter(p =>p.protocol.http.in == 'body').forEach(function (parameter) {-%>
<%# ToDo: currently only support for an unexpanded nullable body, need other support in the future -%>
@ -202,6 +203,7 @@ var prefix = parameter.implementation == 'Client' ? `this${clientPrefix}.` : ''-
_httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8");
<% } -%>
<% });-%>
<% } -%>
<%# ToDo: Need to confirm in which case Settings.AddCredentials is false -%>
// Set Credentials
if (this<%-clientPrefix%>.Credentials != null)