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 ConstructMapper(TSValue value, IModelType type, string serializedName, IVariable parameter, bool isPageable, bool expandComposite, bool isXML, bool isCaseSensitive = true, string xmlName = null) { value.Object(mapper => ConstructMapper(mapper, type, serializedName, parameter, isPageable, expandComposite, isXML, isCaseSensitive, xmlName)); }