private NormalizationApiOperationResponse ParseResponse(dynamic op) { var dataType = SimpleNormalizationApiDataType.ParseFromJObject(op); var resp = new NormalizationApiOperationResponse(); resp.CopyFrom(dataType); return(resp); }
private NormalizationApiOperationResponse ParseResponse(dynamic op) { //Not sure if this is the best way to go about handling response. //In Swagger 2.0 Response type seems to be tied to the //response element whereas it was not in Swagger 1.2. dynamic dataType = op.Value; if (dataType.responses.ContainsKey("200")) { dataType = dataType.responses["200"]; } else if (dataType.responses.ContainsKey("201")) { dataType = op.Value.responses["201"]; } else if (dataType.responses.ContainsKey("204")) { dataType = op.Value.responses["204"]; } else if (dataType.responses.ContainsKey("202")) { dataType = op.Value.responses["202"]; } string title = ""; if (dataType.ContainsKey("schema")) { if (dataType.schema.ContainsKey("title")) { title = dataType.schema["title"]; } } dataType = SimpleNormalizationApiDataType.ParseFromJObject(dataType); var resp = new NormalizationApiOperationResponse(); resp.CopyFrom(dataType); resp.Title20 = title; return(resp); }