public static void ConstructRequestBodyMapper(TSValue value, Parameter requestBody) { IModelType requestBodyModelType = requestBody.ModelType; if (requestBodyModelType is CompositeType) { string mapperReference = $"Mappers.{requestBodyModelType.Name}"; if (!requestBody.IsRequired) { value.Text(mapperReference); } else { value.Object(mapperObject => { mapperObject.Spread(mapperReference); mapperObject.BooleanProperty("required", true); }); } } else { ConstructMapper( value, requestBodyModelType, requestBody.SerializedName, requestBody, isPageable: false, expandComposite: false, isXML: requestBody.Parent.CodeModel.ShouldGenerateXmlSerialization == true, xmlName: requestBodyModelType.XmlProperties?.Name); } }
public static void ConstructResponseBodyMapper(TSValue value, Response response, Method method) { IModelType responseBodyModelType = response.Body; if (responseBodyModelType is CompositeType) { value.Text($"Mappers.{responseBodyModelType.Name}"); } else { ConstructMapper( value: value, type: responseBodyModelType, serializedName: "parsedResponse", parameter: null, isPageable: false, expandComposite: false, isXML: method.CodeModel.ShouldGenerateXmlSerialization == true); } }