public void Serialize(JsonWriter writer) { writer.WriteStartObject(); writer.WritePropertyName("swagger"); writer.WriteValue(Swagger); if (Info != null) { writer.WritePropertyName("info"); Info.Serialize(writer); } if (Host != null) { writer.WritePropertyName("host"); writer.WriteValue(Host); } if (BasePath != null) { writer.WritePropertyName("basePath"); writer.WriteValue(BasePath); } if (Schemes != null && Schemes.Any()) { writer.WritePropertyName("schemes"); writer.WriteStartArray(); foreach (string sch in Schemes) { writer.WriteValue(sch); } writer.WriteEndArray(); } if (Paths != null && Paths.Any()) { writer.WritePropertyName("paths"); WritePaths(writer); } if (Definitions != null && Definitions.Any()) { writer.WritePropertyName("definitions"); WriteDefinitions(writer); } if (SecurityDefinitions != null && SecurityDefinitions.Any()) { writer.WritePropertyName("securityDefinitions"); WriteSecurityDefinitions(writer); } if (Tags?.Count > 0) { writer.WritePropertyName("tags"); var tagsValue = JsonConvert.SerializeObject(Tags); writer.WriteRawValue(tagsValue); } writer.WriteEndObject(); }
/// <summary> /// Gets the marked methods. /// </summary> /// <param name="reflectionNode">The reflection node.</param> /// <param name="markerInterface">The marker interface.</param> /// <param name="context">The context.</param> /// <returns></returns> private IEnumerable <MarkedNode> GetMarkedMethods(ReflectionNode reflectionNode, ITypeDefOrRef markerInterface, WeavingContext context) { var ancestorsToChildren = reflectionNode.GetAncestorsToDescendants().ToArray(); return(from node in ancestorsToChildren where node.Method is not null let allMakersNode = new MarkedNode(node, GetAllMarkers(node, markerInterface, context).Select(t => t.Item2)) where allMakersNode.Definitions.Any() && IsIncludedByPointcut(allMakersNode, context) //&& !IsDeclaredByValue(node) let includedMarkersNode = new MarkedNode(node, allMakersNode.Definitions.Where(d => IsIncludedByNode(d, node, context))) where includedMarkersNode.Definitions.Any() select includedMarkersNode); }
public void Serialize(JsonWriter writer) { writer.WriteStartObject(); writer.WritePropertyName("swagger"); writer.WriteValue(Swagger); if (Info != null) { writer.WritePropertyName("info"); Info.Serialize(writer); } if (Host != null) { writer.WritePropertyName("host"); writer.WriteValue(Host); } if (BasePath != null) { writer.WritePropertyName("basePath"); writer.WriteValue(BasePath); } if (Paths != null && Paths.Any()) { writer.WritePropertyName("paths"); WritePaths(writer); } if (Definitions != null && Definitions.Any()) { writer.WritePropertyName("definitions"); WriteDefinitions(writer); } if (SecurityDefinitions != null && SecurityDefinitions.Any()) { writer.WritePropertyName("securityDefinitions"); WriteSecurityDefinitions(writer); } writer.WriteEndObject(); }
public bool Validate() { return(string.IsNullOrEmpty(Pronunciation) && string.IsNullOrEmpty(Word) && Definitions.Any()); }
public bool Contains(string logicalName) { return(Definitions.Any(d => d.LogicalName == logicalName)); }
public static FilterChain CreateChain(Definitions defs, CreatorCallback creator) { FilterChain chain = new AndChain(); if (defs != null && defs.Count > 0) { if (!defs.Any(f => f.Operation == Operations.Or)) { // Simple AND chain defs.ForEach(def => chain.Add(creator(def))); } else { // Mixed chain Definition prev = defs[0]; Definition curr; FilterChain or = new OrChain(); for (int index = 1; index < defs.Count; ++index) { curr = defs[index]; if (curr.Operation == Operations.Or && prev.Operation == Operations.Or) { // Add another "or" or.Add(creator(prev)); } else { if (or.Count != 0) { // End current "or" and create new chain or.Add(creator(prev)); chain.Add(or); or = new OrChain(); } else { // Add single filter chain.Add(creator(prev)); } } prev = curr; } // Add last pending if (prev.Operation == Operations.Or) { or.Add(creator(prev)); } if (or.Count > 0) { chain.Add(or); } if (prev.Operation == Operations.And) { chain.Add(creator(prev)); } } } return(chain); }