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

crud_openapi_java_server_app.functions.ftl Maven / Gradle / Ivy

There is a newer version: 2.4.3
Show newest version
<#function getReturnType operation isServiceResponse>
  <#assign result=[]>
  <#assign differentMediaTypes="">
  <#list operation.responses as response>
    <#list response.mediaTypes as mt>
      <#if !(differentMediaTypes?contains(mt))>
        <#assign result=result+[response]>
      
    
  
  <#if result?size gte 2>
    <#return "Object">
  <#else>
    <#if result?size lt 1>
      <#return "void">
    <#else>
      <#if isServiceResponse>
        <#return OpenApiUtil.printJavaServiceResponseReturnType(result?first)>
      <#else>
        <#return result?first.type>
      
    
  


<#function getDistinctMediaTypes operation>
  <#assign result=" ">
  <#assign amountOfTypes=0>
  <#list operation.responses as response>
    <#list response.mediaTypes as mt>
      <#if !(result?contains(mt))>
        <#if !(result==" ")>
          <#assign result=result+",">
        
        <#assign result=result?trim+"MediaType."+OaspUtil.getSpringMediaType(mt)>
      
    
    
  <#return result>


<#function hasMediaTypeInResponses operation>
  <#list operation.responses as response>
    <#if response.mediaTypes?size gt 0>
      <#return true>
    
  
  <#return false>


<#function hasResponseOfType responses type>
  <#list responses as response>
    <#if type=="Entity">
      <#return response.isEntity>
    <#elseif type=="Paginated">
      <#return response.isPaginated>
    <#elseif type=="Array">
      <#return response.isArray>
    <#elseif type=="Void">
      <#return response.isVoid>
    <#else>
      <#return false>
    
  




© 2015 - 2024 Weber Informatics LLC | Privacy Policy