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

com.reprezen.genflow.openapi3.doc.PathDoc 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.DocHelper;
import com.reprezen.genflow.openapi3.doc.HelperHelper;
import com.reprezen.genflow.openapi3.doc.HtmlHelper;
import com.reprezen.genflow.openapi3.doc.MiscHelper;
import com.reprezen.genflow.openapi3.doc.OpDoc;
import com.reprezen.genflow.openapi3.doc.OptionHelper;
import com.reprezen.genflow.openapi3.doc.TagHelper;
import com.reprezen.kaizen.oasparser.model3.OpenApi3;
import com.reprezen.kaizen.oasparser.model3.Operation;
import com.reprezen.kaizen.oasparser.model3.Path;
import com.reprezen.kaizen.oasparser.model3.Tag;
import java.util.List;
import org.eclipse.xtend2.lib.StringConcatenation;
import org.eclipse.xtext.xbase.lib.Extension;
import org.eclipse.xtext.xbase.lib.Functions.Function1;
import org.eclipse.xtext.xbase.lib.IterableExtensions;

@SuppressWarnings("all")
public class PathDoc {
  private final OpenApi3 model = HelperHelper.getModel();
  
  private final String pathName;
  
  private final Path path;
  
  @Extension
  private DocHelper _docHelper = HelperHelper.getDocHelper();
  
  @Extension
  private TagHelper _tagHelper = HelperHelper.getTagHelper();
  
  @Extension
  private HtmlHelper _htmlHelper = HelperHelper.getHtmlHelper();
  
  @Extension
  private MiscHelper _miscHelper = HelperHelper.getMiscHelper();
  
  @Extension
  private OptionHelper _optionHelper = HelperHelper.getOptionHelper();
  
  public PathDoc(final String pathName) {
    this.pathName = pathName;
    this.path = this.model.getPaths().get(pathName);
  }
  
  public PathDoc(final String pathName, final Path path) {
    this.pathName = pathName;
    this.path = path;
  }
  
  public CharSequence getHtml() {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("");
    _builder.newLineIfNotEmpty();
    _builder.append("
"); _builder.newLine(); _builder.append(" "); _builder.append("
"); _builder.newLine(); _builder.append("\t\t"); _builder.append("

"); _builder.newLine(); _builder.append("\t\t "); _builder.append("Path: "); _builder.append(this.pathName, "\t\t "); _builder.newLineIfNotEmpty(); { Boolean _isPreview = this._optionHelper.isPreview(); if ((_isPreview).booleanValue()) { _builder.append("\t\t "); _builder.append("  "); _builder.newLine(); _builder.append("\t\t "); _builder.append(""); _builder.newLine(); _builder.append("\t\t "); _builder.append(" "); _builder.append(""); _builder.newLineIfNotEmpty(); _builder.append("\t\t "); _builder.append(""); _builder.newLine(); } } _builder.append("\t\t"); _builder.append("

"); _builder.newLine(); _builder.append("\t\t "); _builder.append("
"); _builder.newLine(); _builder.append("\t\t "); _builder.append("
"); _builder.newLine(); _builder.append("\t\t "); final Function1 _function = (String it) -> { Tag _modelTag = this._tagHelper.getModelTag(it); String _description = null; if (_modelTag!=null) { _description=_modelTag.getDescription(); } return _description; }; String _docHtml = this._docHelper.getDocHtml(IterableExtensions.join(IterableExtensions.filterNull(IterableExtensions.map(this._tagHelper.getCommonTags(this.path), _function)), "\n\n")); _builder.append(_docHtml, "\t\t "); _builder.newLineIfNotEmpty(); { List _sortByPosition = this._miscHelper.sortByPosition(this.path.getOperations().keySet(), this.path.getOperations()); for(final String method : _sortByPosition) { _builder.append("\t\t "); Operation _get = this.path.getOperations().get(method); String _html = new OpDoc(_get, this.model, this.path).getHtml(method); _builder.append(_html, "\t\t "); _builder.newLineIfNotEmpty(); } } _builder.append("\t\t "); _builder.append("
"); _builder.newLine(); _builder.append("
"); _builder.newLine(); return _builder; } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy