All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.reprezen.genflow.openapi3.doc.ResponseHelper Maven / Gradle / Ivy

/**
 * Copyright © 2013, 2016 Modelsolv, Inc.
 * All Rights Reserved.
 * 
 * NOTICE: All information contained herein is, and remains the property
 * of ModelSolv, Inc. See the file license.html in the root directory of
 * this project for further information.
 */
package com.reprezen.genflow.openapi3.doc;

import com.reprezen.genflow.openapi3.doc.Helper;
import com.reprezen.genflow.openapi3.doc.HelperHelper;
import com.reprezen.genflow.openapi3.doc.HtmlHelper;
import com.reprezen.kaizen.oasparser.model3.Header;
import com.reprezen.kaizen.oasparser.model3.Response;
import com.reprezen.kaizen.oasparser.model3.Schema;
import java.util.Map;
import java.util.Set;
import org.eclipse.xtend2.lib.StringConcatenation;
import org.eclipse.xtext.xbase.lib.Extension;

@SuppressWarnings("all")
public class ResponseHelper implements Helper {
  @Extension
  private HtmlHelper htmlHelper;
  
  @Override
  public void init() {
    this.htmlHelper = HelperHelper.getHtmlHelper();
  }
  
  public CharSequence getHeadersHtml(final Response response) {
    CharSequence _xblockexpression = null;
    {
      final Map headers = response.getHeaders();
      CharSequence _xifexpression = null;
      if (((headers != null) && (!headers.isEmpty()))) {
        StringConcatenation _builder = new StringConcatenation();
        _builder.append("");
        _builder.newLine();
        _builder.append("    ");
        _builder.append("");
        _builder.newLine();
        {
          Set> _entrySet = headers.entrySet();
          for(final Map.Entry header : _entrySet) {
            _builder.append("    ");
            _builder.append("");
            _builder.newLineIfNotEmpty();
          }
        }
        _builder.append("
NameTypeDescription
"); String _key = header.getKey(); _builder.append(_key, " "); _builder.append(""); Header _value = header.getValue(); Schema _schema = null; if (_value!=null) { _schema=_value.getSchema(); } String _type = _schema.getType(); _builder.append(_type, " "); _builder.append(""); Header _value_1 = header.getValue(); String _description = null; if (_value_1!=null) { _description=_value_1.getDescription(); } String _htmlEscape = null; if (_description!=null) { _htmlEscape=this.htmlHelper.htmlEscape(_description); } _builder.append(_htmlEscape, " "); _builder.append("
"); _builder.newLine(); _xifexpression = _builder; } _xblockexpression = _xifexpression; } return _xblockexpression; } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy