Class SwaggerDocUtil


  • public class SwaggerDocUtil
    extends java.lang.Object
    SwaggerDocUtils is used to provided required component/s from the swagger document.

    Created by sunilp on 26/5/15.

    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String ARRAY  
      static java.lang.String FILE  
      static java.lang.String STRING  
    • Constructor Summary

      Constructors 
      Constructor Description
      SwaggerDocUtil()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static com.wavemaker.tools.apidocs.tools.core.model.properties.Property buildProperty​(java.lang.String type, java.lang.String format)
      Builds property based on given type and format.
      static java.lang.Class<?> findDateType​(com.wavemaker.tools.apidocs.tools.core.model.properties.DateProperty property)  
      static com.wavemaker.tools.apidocs.tools.core.model.Operation getOperation​(com.wavemaker.tools.apidocs.tools.core.model.Swagger swagger, java.lang.String endPoint, java.lang.String operationUid)
      Return Operation from the Swagger object based on operationUid in provided endPoint.
      static com.wavemaker.tools.apidocs.tools.core.model.Operation getOperationByUid​(com.wavemaker.tools.apidocs.tools.core.model.Swagger swagger, java.lang.String operationUid)
      Return Operation from the Swagger object based on first occurrence in paths
      static java.lang.String getOperationType​(com.wavemaker.tools.apidocs.tools.core.model.Path path, java.lang.String operationUid)
      Return method type of the operation in a path
      static java.lang.String getParameterType​(com.wavemaker.tools.apidocs.tools.core.model.parameters.Parameter parameter)  
      static com.wavemaker.tools.apidocs.tools.core.model.Path getPathByEndPoint​(com.wavemaker.tools.apidocs.tools.core.model.Swagger swagger, java.lang.String endPoint)
      Return Path from the Swagger object based on endPoint
      static com.wavemaker.tools.apidocs.tools.core.model.Path getPathByOperationUid​(com.wavemaker.tools.apidocs.tools.core.model.Swagger swagger, java.lang.String operationUid)
      Return Operation from the Path object based on first occurrence in paths
      static java.util.Map<java.lang.String,​com.wavemaker.tools.apidocs.tools.core.model.properties.Property> getProperties​(com.wavemaker.tools.apidocs.tools.core.model.Swagger swagger, com.wavemaker.tools.apidocs.tools.core.model.Model model)  
      static java.util.Map<java.lang.String,​com.wavemaker.tools.apidocs.tools.core.model.properties.Property> getProperties​(com.wavemaker.tools.apidocs.tools.core.model.Swagger swagger, com.wavemaker.tools.apidocs.tools.core.model.properties.Property property)  
      static java.lang.String getWrapperPropertyFQType​(com.wavemaker.tools.apidocs.tools.core.model.properties.Property property)
      Constructs fully qualified name for the give property based on property type and format.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • SwaggerDocUtil

        public SwaggerDocUtil()
    • Method Detail

      • getPathByEndPoint

        public static com.wavemaker.tools.apidocs.tools.core.model.Path getPathByEndPoint​(com.wavemaker.tools.apidocs.tools.core.model.Swagger swagger,
                                                                                          java.lang.String endPoint)
        Return Path from the Swagger object based on endPoint
        Parameters:
        swagger - : Searches in Swagger Object
        endPoint - : search based on endPoint
        Returns:
        Path
      • getPathByOperationUid

        public static com.wavemaker.tools.apidocs.tools.core.model.Path getPathByOperationUid​(com.wavemaker.tools.apidocs.tools.core.model.Swagger swagger,
                                                                                              java.lang.String operationUid)
        Return Operation from the Path object based on first occurrence in paths
        Parameters:
        swagger - : searches in Swagger Object
        operationUid - : search based on operationUid
        Returns:
        path
      • getOperationByUid

        public static com.wavemaker.tools.apidocs.tools.core.model.Operation getOperationByUid​(com.wavemaker.tools.apidocs.tools.core.model.Swagger swagger,
                                                                                               java.lang.String operationUid)
        Return Operation from the Swagger object based on first occurrence in paths
        Parameters:
        swagger - : searches in Swagger Object
        operationUid - : search based on operationUid
        Returns:
        Operation
      • getOperation

        public static com.wavemaker.tools.apidocs.tools.core.model.Operation getOperation​(com.wavemaker.tools.apidocs.tools.core.model.Swagger swagger,
                                                                                          java.lang.String endPoint,
                                                                                          java.lang.String operationUid)
        Return Operation from the Swagger object based on operationUid in provided endPoint.
        Parameters:
        swagger - : Searches in Swagger Object
        endPoint - : search operation in this endPoint
        operationUid - : search based on operationUid
        Returns:
        Operation
      • getOperationType

        public static java.lang.String getOperationType​(com.wavemaker.tools.apidocs.tools.core.model.Path path,
                                                        java.lang.String operationUid)
        Return method type of the operation in a path
        Parameters:
        path - : searches in path object
        operationUid - : search operation based on this id.
        Returns:
        method type
      • buildProperty

        public static com.wavemaker.tools.apidocs.tools.core.model.properties.Property buildProperty​(java.lang.String type,
                                                                                                     java.lang.String format)
        Builds property based on given type and format.
        Parameters:
        type - : type of the property
        format - : format of the property
        Returns:
        Property, may returns null if type and format is not based on swagger property.
      • getWrapperPropertyFQType

        public static java.lang.String getWrapperPropertyFQType​(com.wavemaker.tools.apidocs.tools.core.model.properties.Property property)
        Constructs fully qualified name for the give property based on property type and format.
        Returns:
        fully qualified name for given property,Returns null if type and format is not based on swagger property.
      • getParameterType

        public static java.lang.String getParameterType​(com.wavemaker.tools.apidocs.tools.core.model.parameters.Parameter parameter)
      • findDateType

        public static java.lang.Class<?> findDateType​(com.wavemaker.tools.apidocs.tools.core.model.properties.DateProperty property)
      • getProperties

        public static java.util.Map<java.lang.String,​com.wavemaker.tools.apidocs.tools.core.model.properties.Property> getProperties​(com.wavemaker.tools.apidocs.tools.core.model.Swagger swagger,
                                                                                                                                           com.wavemaker.tools.apidocs.tools.core.model.Model model)
      • getProperties

        public static java.util.Map<java.lang.String,​com.wavemaker.tools.apidocs.tools.core.model.properties.Property> getProperties​(com.wavemaker.tools.apidocs.tools.core.model.Swagger swagger,
                                                                                                                                           com.wavemaker.tools.apidocs.tools.core.model.properties.Property property)