public XmlObjectElementSerialization( ObjectTypeProperty property, XmlElementSerialization valueSerialization) { Property = property; ValueSerialization = valueSerialization; }
public XmlObjectAttributeSerialization( string name, ObjectTypeProperty property, XmlValueSerialization valueSerialization) { Name = name; Property = property; ValueSerialization = valueSerialization; }
private IEnumerable <PagingMethod> BuildPagingMethods() { foreach (var operation in _operationGroup.Operations) { Paging?paging = operation.Language.Default.Paging; if (paging == null || operation.IsLongRunning) { continue; } foreach (var serviceRequest in operation.Requests) { RestClientMethod method = RestClient.GetOperationMethod(serviceRequest); RestClientMethod?nextPageMethod = RestClient.GetNextOperationMethod(serviceRequest); if (!(method.Responses.SingleOrDefault(r => r.ResponseBody != null)?.ResponseBody is ObjectResponseBody objectResponseBody)) { throw new InvalidOperationException($"Method {method.Name} has to have a return value"); } TypeProvider implementation = objectResponseBody.Type.Implementation; if (!(implementation is ObjectType type)) { throw new InvalidOperationException($"The return type of {method.Name} has to be an object schema to be used in paging"); } string?nextLinkName = paging.NextLinkName; string itemName = paging.ItemName ?? "value"; ObjectTypeProperty itemProperty = type.GetPropertyBySerializedName(itemName); ObjectTypeProperty?nextLinkProperty = null; if (!string.IsNullOrWhiteSpace(nextLinkName)) { nextLinkProperty = type.GetPropertyBySerializedName(nextLinkName); } if (!(itemProperty.SchemaProperty?.Schema is ArraySchema arraySchema)) { throw new InvalidOperationException($"{itemName} property has to be an array schema, actual {itemProperty.SchemaProperty?.Schema}"); } CSharpType itemType = _context.TypeFactory.CreateType(arraySchema.ElementType, false); yield return(new PagingMethod( method, nextPageMethod, method.Name, nextLinkProperty?.Declaration.Name, itemProperty.Declaration.Name, itemType, new Diagnostic($"{Declaration.Name}.{method.Name}"))); } } }
public JsonAdditionalPropertiesSerialization(ObjectTypeProperty property, JsonSerialization valueSerialization, CSharpType type) { Property = property; ValueSerialization = valueSerialization; Type = type; }
public XmlObjectArraySerialization(ObjectTypeProperty property, XmlArraySerialization arraySerialization) { Property = property; ArraySerialization = arraySerialization; }