private void ParseRequests(KeyValuePair<string, ResourceType> type, Verb verb) { if (verb.Body == null) return; var name = Enum.GetName(typeof(VerbType), verb.Type); if (name == null) return; var key = type.Key + "-" + name.ToLower() + RequestContentSuffix; var obj = objectParser.ParseObject(key, verb.Body.Schema, schemaRequestObjects, warnings, enums); AddObjectToObjectCollectionOrLink(obj, key, schemaRequestObjects); }
public Verb Build(IDictionary<string, object> dynamicRaml, VerbType type, string defaultMediaType, bool isOptional = false) { if (dynamicRaml == null) return null; this.dynamicRaml = dynamicRaml; this.defaultMediaType = defaultMediaType; var verb = new Verb { Type = type, IsOptional = isOptional, Headers = GetHeaders(), Responses = GetResponses(), Body = GetBody(), Description = GetDescription(), QueryParameters = GetQueryParameters() }; return verb; }
private void ParseResponses(KeyValuePair<string, ResourceType> type, Verb verb) { if (verb.Responses == null) return; foreach (var response in verb.Responses.Where(response => response != null)) { var name = Enum.GetName(typeof(VerbType), verb.Type); if (name == null) continue; var key = type.Key + "-" + name.ToLower() + ParserHelpers.GetStatusCode(response.Code) + ResponseContentSuffix; if (response.Body == null || !response.Body.Any(b => b.Value != null && !string.IsNullOrWhiteSpace(b.Value.Schema))) continue; var mimeType = GeneratorServiceHelper.GetMimeType(response); var obj = objectParser.ParseObject(key, mimeType.Schema, schemaResponseObjects, warnings, enums); AddObjectToObjectCollectionOrLink(obj, key, schemaResponseObjects); } }