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

java.OpenAPIFunctions.ext Maven / Gradle / Ivy

There is a newer version: 1.24.1
Show newest version
extension java::Naming;
extension java::GeneratorCommons;
extension jeaf::RESTFunctions;
extension functions::JEAFDeprecated;
extension functions::BreakingChange;
extension functions::Class;
extension functions::TemplateParameter;
extension functions::Operation;
extension functions::Alias;
extension functions::SoftLink;
extension functions::RESTOperation;
extension jeafgenerator::api::OpenAPIEnumExtensionPoint;
extension functions::AddToJSON;

cached boolean hasOpenAPITypes(JMM::OpenAPI3Specification spec):
	getOpenAPITypes(spec).size > 0;
	
cached List[JMM::OpenAPIType] getOpenAPITypes(JMM::OpenAPI3Specification spec):
	spec.clientDependency.supplier.typeSelect(uml::Package).ownedElement.typeSelect(JMM::OpenAPIType).select(e|e.ignore() == false);
	
cached List[JMM::OpenAPIDataType] getOpenAPIDataTypes(JMM::OpenAPI3Specification spec):
	spec.clientDependency.supplier.typeSelect(uml::Package).ownedElement.typeSelect(JMM::OpenAPIDataType).select(e|e.ignore() == false);
	
cached boolean hasOpenAPISecuritySchemes(JMM::OpenAPI3Specification spec):
    getOpenAPISecuritySchemes(spec).size > 0;
    
cached List[uml::Property] getOpenAPIParameters(JMM::OpenAPI3Specification spec):
	spec.clientDependency.supplier.typeSelect(uml::Package).ownedElement.typeSelect(JMM::BeanParam).select(e|e.inline==false).typeSelect(uml::Class).ownedAttribute.select(e|e.isIgnoredHeaderParam()== false).sortBy(e|e.name);
    
cached boolean hasOpenAPIParameters(JMM::OpenAPI3Specification spec):
    spec.getOpenAPIParameters().size > 0;

cached List[JMM::OpenAPISecurityScheme] getOpenAPISecuritySchemes(JMM::OpenAPI3Specification spec):
    spec.getModel().allOwnedElements().typeSelect(JMM::OpenAPISecurityScheme).select(e|e.isInGeneratorWhitelist() == true).sortBy(e|e.name);

cached List[JMM::OpenAPIResponse] getResponses(JMM::OpenAPI3Specification spec):
	spec.clientDependency.supplier.typeSelect(uml::Package).ownedElement.typeSelect(JMM::OpenAPIResponse).sortBy(e|e.name).sortBy(e|e.getOrderNumber());

cached List[JMM::OpenAPI3Specification] getDependentSpecs(JMM::OpenAPI3Specification spec):
	spec.clientDependency.supplier.typeSelect(JMM::OpenAPI3Specification);
	
Void registerSpecDependency( uml::Component pSource, uml::Component pTarget, String pReference ):
    JAVA com.anaptecs.jeaf.fwk.generator.util.OpenAPIHelper.registerSpecDependency( org.eclipse.uml2.uml.Component, org.eclipse.uml2.uml.Component, java.lang.String );
	
cached boolean hasOpenAPIEnums(JMM::OpenAPI3Specification spec):
	getOpenAPIEnums(spec).size > 0;
	
cached List[JMM::OpenAPIEnumeration] getOpenAPIEnums(JMM::OpenAPI3Specification spec):
	spec.clientDependency.supplier.typeSelect(uml::Package).ownedElement.typeSelect(JMM::OpenAPIEnumeration).select(e|e.ignore() == false);
	
cached boolean referencesRESTResources(JMM::OpenAPI3Specification spec):
	spec.getRESTResources().size > 0;
	
cached List[JMM::RESTResource] getRESTResources(JMM::OpenAPI3Specification spec):
	spec.clientDependency.supplier.typeSelect(JMM::RESTResource).select(e|e.isInGeneratorWhitelist()).sortBy(e|e.name).sortBy(e|e.getOrderNumber());
	
cached List[JMM::RESTOperation] getRESTOperations(JMM::RESTResource service, String pPath):
   service.ownedOperation.typeSelect(JMM::RESTOperation).select(e|e.getRESTOperationPath(service) == pPath);
   
cached Set[String] getPaths(JMM::RESTResource service):
   service.ownedOperation.typeSelect(JMM::RESTOperation).getRESTOperationPath(service).toSet();
	
cached String getYAMLStyleComment(uml::Element element, String indentation):
    element.ownedComment.get(0).body.trim().replaceAll("\n", "\r\n" + indentation + "# ");

cached String getCommentForOpenAPIDescription(uml::Element element, String indentation):
    if element.ownedComment.size > 0
    then element.ownedComment.first().body.trim().replaceAll("\n", "\r\n" + indentation) + element.getAlternateNameForOpenAPI(indentation) + element.getAliasDocs(indentation) + ((uml::NamedElement) element).getBreakingChangeDescriptionInternal(indentation) + element.getAuthorizedRoles(indentation) + ((uml::NamedElement) element).getInternalDeprecationDescription(indentation)
    else element.getAlternateNameForOpenAPI(indentation) + element.getAliasDocs(indentation) + ((uml::NamedElement) element).getBreakingChangeDescriptionInternal(indentation) + element.getAuthorizedRoles(indentation) + ((uml::NamedElement) element).getInternalDeprecationDescription(indentation);

private cached String getAlternateNameForOpenAPI(uml::Element element, String indentation):
    if element.isAlias()
    then "\r\n" + indentation + "

\r\n" + indentation + "Alternate Name: " + element.asAlias().getAlternateName() else ""; private cached String getAliasDocs(uml::Element property, String indentation): if property.hasAliasAttributeName() then "\r\n" + indentation + "

\r\n" + indentation + "Java Property Name: '" + ((uml::Property) property).name + "' " else ""; private cached String getAuthorizedRoles(uml::Element element, String indentation): if element.isOperation() && element.asOperation().hasSecurityRoles() then "\r\n" + indentation + "

\r\n" + indentation + "Authorized Roles: " + element.asOperation().getSecurityRolesForDocumentation().toString(", ") else ""; private cached String getInternalDeprecationDescription(uml::NamedElement element, String indentation): if element.isJEAFDeprecated() && element.hasMeaningfulDeprecationInfo() then "\r\n" + indentation + "

\r\n" + indentation + "Deprecated: " + element.getDeprecationDescriptionForMarkup() + " (since: " + element.getDeprecatedSince() + ", removed with: " + element.getDeprecationRemoval() + ")" else ""; private cached String getBreakingChangeDescriptionInternal(uml::NamedElement element, String indentation): if element.isBreakingChange() then "\r\n" + indentation + "

\r\n" + indentation + "Breaking Change with " + element.getBreakingChangeActiveWith() + ": " + element.getBreakingChangeDescription() else ""; cached boolean hasMultiLineComment(uml::Element element) : //element.ownedComment.get(0).body.contains("\n"); true; cached boolean generateDefaultClassMapping() : false; cached String getOpenAPIType(uml::Type type, JMM::OpenAPI3Specification spec): JAVA com.anaptecs.jeaf.fwk.generator.util.OpenAPIHelper.getOpenAPIType(org.eclipse.uml2.uml.Type, org.eclipse.uml2.uml.Component); cached String getOpenAPISoftLinkRefType(JMM::SoftLink softLink): if (softLink.getOpenAPISoftLinkType() == "integer" || softLink.getOpenAPISoftLinkType() == "string") then "type" else "$ref"; cached String getOpenAPISoftLinkType(JMM::SoftLink softLink): if (softLink.softLinkType.name == "long" || softLink.softLinkType.name == "Long") then "integer" else if getOpenAPIGenericSoftLinkType().length > 0 then "'" +getOpenAPIGenericSoftLinkType() + "'" else "string"; cached String getOpenAPISoftLinkFormat(JMM::SoftLink softLink): if (softLink.softLinkType.name == "long" || softLink.softLinkType.name == "Long") then "int64" else null; cached boolean hasOpenAPISoftLinkFormat(JMM::SoftLink softLink): softLink.getOpenAPISoftLinkFormat() != null; cached String getOpenAPIParameter(uml::Property property, JMM::OpenAPI3Specification spec): JAVA com.anaptecs.jeaf.fwk.generator.util.OpenAPIHelper.getOpenAPIParameter(org.eclipse.uml2.uml.Property, org.eclipse.uml2.uml.Component); cached String getResponseType(uml::Type type, JMM::OpenAPI3Specification spec): JAVA com.anaptecs.jeaf.fwk.generator.util.OpenAPIHelper.getResponseType(org.eclipse.uml2.uml.Type, org.eclipse.uml2.uml.Component); cached String getOpenAPIFormatInternal(uml::Type type): JAVA com.anaptecs.jeaf.fwk.generator.util.OpenAPIHelper.getOpenAPIFormat(org.eclipse.uml2.uml.Type); cached String getOpenAPIFormatForProperty(uml::Property property): if property.isStereotypeApplied("OpenAPIFormat") then ((JMM::OpenAPIFormat) property).format else property.type.getOpenAPIFormatInternal(); cached boolean hasOpenAPIFormatForProperty(uml::Property property): getOpenAPIFormatForProperty(property) != null; cached String getOpenAPIFormatForParam(uml::Parameter parameter): if parameter.isStereotypeApplied("OpenAPIFormat") then ((JMM::OpenAPIFormat) parameter).format else parameter.type.getOpenAPIFormatInternal(); cached boolean hasOpenAPIFormatForParam(uml::Parameter parameter): getOpenAPIFormatForParam(parameter) != null; cached String getPatternForProperty(uml::Property property): if property.isStereotypeApplied("OpenAPIPattern") then ((JMM::OpenAPIPattern) property).pattern else ""; cached boolean hasPatternForProperty(uml::Property property): property.isStereotypeApplied("OpenAPIPattern"); cached String getPatternForParam(uml::Parameter parameter): if parameter.isStereotypeApplied("OpenAPIPattern") then ((JMM::OpenAPIPattern) parameter).pattern else ""; cached boolean hasPatternForParam(uml::Parameter parameter): parameter.isStereotypeApplied("OpenAPIPattern"); cached boolean isBasicOpenAPIType(uml::Element type): JAVA com.anaptecs.jeaf.fwk.generator.util.OpenAPIHelper.isBasicOpenAPIType(org.eclipse.uml2.uml.Element); cached boolean isOpenAPIDataType(uml::Type type): isStereotypeApplied(type, "OpenAPIDataType"); cached List[uml::Parameter] getDataTypeParameters(uml::Operation operation): operation.ownedParameter.select(e|e.type.isOpenAPIDataType() && e.isInputParameter() && e.isRequestBody() == false && e.isParameterSuppressed() == false); cached boolean hasDataTypeParameters(uml::Operation operation): operation.getDataTypeParameters().size > 0; cached List[uml::Parameter] getDateParameters(uml::Operation operation): operation.ownedParameter.select(e|e.type.isAnyDateType() && e.isInputParameter() && e.isRequestBody() == false && e.isParameterSuppressed() == false); cached boolean hasDateParameters(uml::Operation operation): operation.getDateParameters().size > 0; cached List[uml::Parameter] getByteArrayHeaderParameters(uml::Operation operation): operation.ownedParameter.select(e|e.type.isPrimitiveType() && e.type.isByteType() && e.isHeaderParam() && e.isMultivalued() && e.isInputParameter() && e.isRequestBody() == false && e.isParameterSuppressed() == false); cached boolean hasByteArrayHeaderParameters(uml::Operation operation): operation.getByteArrayHeaderParameters().size > 0; Void registerLocalType(uml::NamedElement localClass, JMM::OpenAPI3Specification spec): JAVA com.anaptecs.jeaf.fwk.generator.util.OpenAPIHelper.registerLocalType(org.eclipse.uml2.uml.NamedElement, org.eclipse.uml2.uml.Component); Void registerLocalParameter(uml::Property localParam, JMM::OpenAPI3Specification spec): JAVA com.anaptecs.jeaf.fwk.generator.util.OpenAPIHelper.registerLocalParameter(org.eclipse.uml2.uml.Property, org.eclipse.uml2.uml.Component); Void clearCaches(): JAVA com.anaptecs.jeaf.fwk.generator.util.OpenAPIHelper.clearCaches(); cached List[uml::Class] getAllSubclasses(uml::Type class) : JAVA com.anaptecs.jeaf.fwk.generator.util.ClassUtil.getAllSubclasses(org.eclipse.uml2.uml.Type); cached List[uml::Class] getAllConcreteSubclasses(uml::Type class) : class.getAllSubclasses().select(e|e.isAbstract == false); cached boolean isOneOfForClassHierachieEnabled(): false; cached boolean isTopOfClassHierarchy(uml::Class class) : if class.superClass.isEmpty == true && class.isTechnicalBaseClass() == false && class.getAllSubclasses().size > 0 then true else if class.superClass.select(e|e.isTechnicalBaseClass()).isEmpty == false && class.isTechnicalBaseClass() == false && class.getAllSubclasses().size > 0 then true else false; cached String toOpenAPIContentType(JMM::MediaType mediaType) : toOpenAPIContentType(mediaType.toString()); cached Set[JMM::MediaType] unifyMediaTypes(Collection[JMM::MediaType] mediaTypes1, Collection[JMM::MediaType] mediaTypes2): mediaTypes1.toSet().addAll(mediaTypes2); cached String toOpenAPIContentType(String mediaType) : JAVA com.anaptecs.jeaf.fwk.generator.util.OpenAPIHelper.toOpenAPIContentType(java.lang.String); cached boolean isOpenAPIParameterType(uml::Element element): getOpenAPIParameterType(element) != null; cached String getOpenAPIParameterType(uml::Element param): JAVA com.anaptecs.jeaf.fwk.generator.util.OpenAPIHelper.getOpenAPIParameterType(org.eclipse.uml2.uml.Element); cached boolean isOpenAPIInputParameter(uml::Parameter param): param.isInputParameter() && param.isOpenAPIParameterType(); cached List[uml::Parameter] getOpenAPIInputParameters(uml::Operation operation): operation.ownedParameter.select(p| p.isOpenAPIInputParameter()); cached boolean isIgnoredHeaderParam(uml::Element element) : JAVA com.anaptecs.jeaf.fwk.generator.util.OpenAPIHelper.isIgnoredHeader(org.eclipse.uml2.uml.Element); cached boolean hasOpenAPIInputParameters(uml::Operation operation): getOpenAPIInputParameters(operation).size > 0; cached boolean isBeanParamater(uml::Parameter param): param.isStereotypeApplied("BeanParam") || param.type.isStereotypeApplied("BeanParam"); cached List[uml::Parameter] getBeanParams(uml::Operation operation): operation.ownedParameter.select(e|e.isBeanParamater()); cached boolean inlineBeanParam(uml::Parameter param) : if param.type.isStereotypeApplied("BeanParam") then ((JMM::BeanParam) param.type).inline else true; cached boolean hasBeanParameters(uml::Operation operation): getBeanParams(operation).size > 0; cached boolean hasOpenAPIProperties(uml::Class pClass): getOpenAPIProperties(pClass).size > 0; cached List[uml::Property] getOpenAPIProperties(uml::Element class): class.getAllAttributesFromHierarchy().select(e|e.isOpenAPIParameterType()); cached List[uml::Property] getAllAttributesFromHierarchy(uml::Element class): JAVA com.anaptecs.jeaf.fwk.generator.util.OpenAPIHelper.getAllAttributesFromHierarchy(org.eclipse.uml2.uml.Element); cached boolean isRequired(uml::Parameter param): param.isStereotypeApplied("NotNull") || param.isStereotypeApplied("NotEmpty") || param.isStereotypeApplied("NotBlank") || (param.type.isPrimitiveType() && param.lower > 0) || param.lower > 0; cached boolean isRequiredProperty(uml::Property property): property.isStereotypeApplied("NotNull") || property.isStereotypeApplied("NotEmpty") || property.isStereotypeApplied("NotBlank") || (property.lower > 0) || (property.association != null && property.lower > 0) || (property.isMultivalued() && property.lower > 0); cached List[uml::Property] getRequiredProperties(uml::Class class): class.getPropertiesForOpenAPI().select(e|e.isRequiredProperty()); cached boolean hasRequiredProperties(uml::Class class): getRequiredProperties(class).size > 0; cached boolean supportsRequestBody(JMM::HTTPMethod httpMethod): httpMethod.toString().toLowerCase() == "post" || httpMethod.toString().toLowerCase() == "put" || httpMethod.toString().toLowerCase() == "patch"; cached boolean hasRequestBody(uml::Operation operation, JMM::HTTPMethod httpMethod): operation.getRequestBodyParameters().size == 1 && httpMethod.supportsRequestBody() == true; cached List[uml::Parameter] getRequestBodyParameters(uml::Operation operation): operation.ownedParameter.select(e|e.isInputParameter() && e.isOpenAPIInputParameter() == false && e.isBeanParamater() == false && e.isIgnoredHeaderParam() == false); cached boolean hasRequestBody(uml::Operation operation): operation.getRequestBodyParameters().size > 0; cached boolean hasReturnTypeVoid(uml::Operation operation): getReturnTypeName(operation) == "void"; cached uml::Parameter getReturnParameter(uml::Operation operation): operation.getReturnResult(); cached boolean isNullable(uml::Property property): if property.isStereotypeApplied("OpenAPIProperty") then ((JMM::OpenAPIProperty) property).nullable else if property.isStereotypeApplied("NotNull") then false else if property.lower > 0 then false else true; cached boolean isReadOnly(uml::Property property): if property.isStereotypeApplied("OpenAPIProperty") then ((JMM::OpenAPIProperty) property).accessType.name == "READ_ONLY" else property.isReadOnly; cached boolean isWriteOnly(uml::Property property): if property.isStereotypeApplied("OpenAPIProperty") then ((JMM::OpenAPIProperty) property).accessType.name == "WRITE_ONLY" else false; cached boolean isNullableForParam(uml::Parameter param): if param.isStereotypeApplied("NotNull") then false else if param.lower > 0 then false else true; cached String getOperationID(uml::Operation operation, uml::Interface service): operation.name; cached String getStatusCodeName(JMM::RESTOperation operation): if operation.statusCode.name != "DEFAULT" then operation.statusCode.name else if operation.isReturnTypeVoid() then getModelStatusCodeName(getRESTDefaultVoidStatusCode()) else getModelStatusCodeName(getRESTDefaultSuccessStatusCode()); cached String getModelStatusCodeName(int pStatusCode): JAVA com.anaptecs.jeaf.fwk.generator.util.OpenAPIHelper.getModelStatusCodeName(java.lang.Integer); cached String getJAXRSStatusCodeName(String pJMMStatusCode): JAVA com.anaptecs.jeaf.fwk.generator.util.OpenAPIHelper.getJAXRSStatusCodeName(java.lang.String); boolean isJAXRSStatusCode(String pJMMStatusCode): getJAXRSStatusCodeName(pJMMStatusCode) != null; cached List[JMM::OpenAPIResponse] getGlobalDefaultErrorResponses(uml::Model model): model.allOwnedElements().typeSelect(JMM::OpenAPIResponse).select(e|e.globalDefaultErrorResponse ==true).sortBy(e|e.statusCodes); boolean hasValidOneGlobalDefaultErrorResponse(uml::Model model): getGlobalDefaultErrorResponses(model).size<=1; cached List[JMM::OpenAPIType] getResponseTypes(JMM::OpenAPIResponse response): response.clientDependency.supplier.typeSelect(JMM::OpenAPIType); JMM::OpenAPIType getResponseType(JMM::OpenAPIResponse response): getResponseTypes(response).first(); cached String getErrorCode(JMM::HTTPStatusCode status): status.toString().subString(0, 3); cached String getHTTPStatusCode(JMM::RESTOperation operation): if operation.statusCode.name != "DEFAULT" then operation.statusCode.name.subString(0, 3) else if operation.isReturnTypeVoid() then getRESTDefaultVoidStatusCode() else getRESTDefaultSuccessStatusCode(); List[JMM::OpenAPIResponse] getCustomResponses(JMM::OpenAPI3Specification spec): spec.clientDependency.supplier.typeSelect(JMM::OpenAPIResponse); cached List[uml::Class] getResponseHeaderGroups(uml::Operation operation) : operation.clientDependency.supplier.typeSelect(JMM::ResponseHeaderGroup).addAll(operation.interface.clientDependency.supplier.typeSelect(JMM::ResponseHeaderGroup)).toSet(); cached List[uml::Property] getHeaderFields(uml::Operation operation) : operation.getResponseHeaderGroups().ownedAttribute; cached boolean hasResponseHeaderFields(uml::Operation operation) : operation.getResponseHeaderGroups().size > 0; cached boolean hasCustomResponse(JMM::OpenAPI3Specification spec): getCustomResponses(spec).size > 0; cached Set[JMM::OAuthScope] getOAuthScopes(JMM::OpenAPISecurityScheme scheme): scheme.clientDependency.supplier.typeSelect(JMM::OAuthFlow).clientDependency.supplier.typeSelect(JMM::OAuthScope).toSet().sortBy(e|e.name); cached boolean isOrdered(uml::Element element) : element.isStereotypeApplied("Ordered"); cached String getOrderNumber(uml::Element element) : if element.isOrdered() == true then ((JMM::Ordered) element).order.toString() else "9999"; cached List[uml::Element] getOrderedSchemaElements(JMM::OpenAPI3Specification spec) : spec.getOpenAPITypes().addAll(spec.getOpenAPIDataTypes().select(e|e.inline == false)).addAll(spec.getOpenAPIEnums()).toList().sortBy(e|e.name).sortBy(e|e.getOrderNumber()); cached List[JMM::OpenAPITag] getOrderedOpenAPITags(JMM::OpenAPI3Specification spec) : spec.clientDependency.supplier.typeSelect(JMM::OpenAPITag).toList().sortBy(e|e.name).sortBy(e|e.order); cached uml::EnumerationLiteral getDefaultLiteral(JMM::OpenAPIEnumeration enum) : enum.ownedLiteral.select(e|e.isStereotypeApplied("DefaultLiteral")).first(); cached String getLiteralName(uml::EnumerationLiteral literal): if literal.isYAML11QutingRequired() == true then "'" + literal.name + "'" else literal.name; cached String getEnumerationType(uml::Enumeration enum): if enum.isStereotypeApplied("OpenAPIEnumeration") && ((JMM::OpenAPIEnumeration) enum).extensibleEnum then "x-extensible-enum" else "enum"; cached boolean isYAML11QutingRequired(uml::EnumerationLiteral literal): enableYAML11Compatibility() && isYAML11Boolean(literal.name.toUpperCase()); boolean isYAML11Boolean(String value): value == "YES" || value == "NO" || value == "Y" || value == "N" || value == "ON" || value == "OFF" || value == "TRUE" || value == "FALSE"; cached boolean hasDefaultLiteral(JMM::OpenAPIEnumeration enum) : getDefaultLiteral(enum) != null; cached JMM::OpenAPIAliasName asAlias(uml::Property property): (JMM::OpenAPIAliasName) property; cached boolean hasAliasAttributeName(uml::Element element) : element.isStereotypeApplied("OpenAPIAliasName"); cached String getAttributeName(uml::Property property) : if property.hasAliasAttributeName() == true then ((JMM::OpenAPIAliasName) property).openAPIPropertyName else property.getSoftLinkAwarePropertyNameForOpenAPI(); cached boolean isOpenAPIEnum(uml::Parameter paramater): paramater.type.isStereotypeApplied("OpenAPIEnumeration"); cached boolean isResponseApplicable(JMM::OpenAPIResponse response, JMM::RESTOperation operation): if response.httpMethods.size > 0 then response.httpMethods.intersect(operation.httpMethods).size > 0 else true; cached hasOpenAPIComment(JMM::OpenAPIEnumeration enum): if enum.hasComment() then true else enum.hasLiteralComment() || (enum.hasDynamicLiterals && enum.getDynamicLiteralDescriptions().selectFirst(e|e.length > 0) != null); cached hasLiteralComment(JMM::OpenAPIEnumeration enum): if enum.ownedLiteral.select(e|e.hasComment()).isEmpty == false then true else enum.ownedLiteral.select(e|e.isDeprecated()).isEmpty == false; cached List[JMM::OpenAPIDataType] getOpenAPIDataTypes(JMM::ModuleFactory moduleFactory): moduleFactory.clientDependency.supplier.typeSelect(uml::Package).allOwnedElements().typeSelect(JMM::OpenAPIDataType).sortBy(e|e.name); cached List[String] collectSerializedClassNames(uml::Class class): {class.fqn()}.addAll(class.attribute.collectDependendTypeNames()).toSet().select(e|e.length > 0); cached List[String] collectDependendTypeNames(uml::Property property): if (property.type.isPrimitiveType() == false && property.type.isBasicType() == false) then {property.getCollectionImplType(), property.type.fqn(), property.type.getExtensibleEnumType()}.addAll(((uml::Class)property.type).attribute.collectDependendTypeNames()) else if property.isMultivalued() then {property.type.fqn() + "[]"}; cached String getExtensibleEnumType(uml::Type type): if type.isStereotypeApplied("JEAFEnumeration") && ((JMM::JEAFEnumeration) type).extensibleEnum && generateHeavyStyleExtensibleEnums() then type.fqn() +"." + type.name + "Type" else if type.isStereotypeApplied("JEAFEnumeration") && ((JMM::JEAFEnumeration) type).extensibleEnum then type.fqn(); cached boolean isCompositeDataTypeConverterRequiredForObjectMapperFactory(JMM::ObjectMapperFactory factory): if(factory.clientDependency.supplier.typeSelect(JMM::ModuleFactory).getOpenAPIDataTypes().select(e|e.generateInternalViewOfCompositeDataType() && e.hasCompositeDateTypeCustomSerialization() == false).size > 0 && isTargetRuntimeJEAF() == false) then true else false; cached boolean requiresCompositeDataTypeConverter(JMM::ModuleFactory factory): factory.getOpenAPIDataTypes().select(e|e.generateInternalViewOfCompositeDataType() && e.hasCompositeDateTypeCustomSerialization() == false).size > 0 && isTargetRuntimeJEAF() == false; cached List[uml::Property] getPropertiesForOpenAPI(uml::Class class): if class.hasTemplateClassProperties() then class.ownedAttribute.addAll(class.getTemplateClassProperties()).select(e | e.isTransient() == false && e.ignore() == false && (e.isDerived == false || (e.isDerived && e.isAddToJSON())) && e.isStatic == false) else class.ownedAttribute.select(e | e.isTransient() == false && e.ignore() == false && (e.isDerived == false || (e.isDerived && e.isAddToJSON())) && e.isStatic == false); cached String getTemplateParamName(uml::Class class): if class.templateBinding.isEmpty == false then class.templateBinding.first().parameterSubstitution.first().formal.getTemplateParameterName(); private cached List[uml::Property] getTemplateClassProperties(uml::Class class): if class.templateBinding.isEmpty == false then class.getGenericClass().getAllAttributesFromHierarchy(); private cached boolean hasTemplateClassProperties(uml::Class class): class.getTemplateClassProperties().isEmpty == false; cached boolean isTemplateProperty(uml::Class class, uml::Property property): class.getTemplateParamName() == property.type.name; cached uml::Class getTemplateBindingType(uml::Class class): class.templateBinding.first().parameterSubstitution.first().actual.first().asClass(); cached boolean hasMultivaluedTemplateBinding(uml::Class class, uml::Property property): isTemplateProperty(class, property) && class.hasMultivaluedTemplateBinding(); private cached boolean hasMultivaluedTemplateBinding(uml::Class class): if class.templateBinding.first().isStereotypeApplied("TemplateBindingMultiplicity") then ((JMM::TemplateBindingMultiplicity) class.templateBinding.first()).multivalued else false; List[String] detectMissingRESTPathParams(JMM::RESTOperation operation): javaDetectMissingRESTPathParams(operation.getRESTOperationPath(null), operation.getAllRESTPathParamNames()); private List[String] javaDetectMissingRESTPathParams(String restPath, List[String] restPathParamNames): JAVA com.anaptecs.jeaf.fwk.generator.util.OpenAPIHelper.detectMissingRESTPathParams(java.lang.String, java.util.List); List[String] detectDeadRESTPathParams(JMM::RESTOperation operation): javaDetectDeadRESTPathParams(operation.getRESTOperationPath(null), operation.getAllRESTPathParamNames()); private List[String] javaDetectDeadRESTPathParams(String restPath, List[String] restPathParamNames): JAVA com.anaptecs.jeaf.fwk.generator.util.OpenAPIHelper.detectDeadRESTPathParams(java.lang.String, java.util.List); cached boolean isOpenAPIVersion31( ): JAVA com.anaptecs.jeaf.fwk.generator.util.OpenAPIHelper.isOpenAPIVersion31(); cached boolean isOpenAPIVersion30( ): JAVA com.anaptecs.jeaf.fwk.generator.util.OpenAPIHelper.isOpenAPIVersion30(); cached String getOpenAPIVersion(): if isOpenAPIVersion30() then "3.0.3" else "3.1.0"; cached boolean hasOperationOpenAPITags(JMM::RESTOperation operation): operation.getOpenAPITagsForOperation().isEmpty == false; cached List[JMM::OpenAPITag] getOpenAPITagsForOperation(JMM::RESTOperation operation): operation.getOpenAPITagsForOperationOnly().addAll(((uml::Interface)operation.owner).getOpenAPITagsForInterface()); private List[JMM::OpenAPITag] getOpenAPITagsForOperationOnly(JMM::RESTOperation operation): operation.getTargetDirectedRelationships().source.typeSelect(JMM::OpenAPITag).sortBy(e|e.name); private List[JMM::OpenAPITag] getOpenAPITagsForInterface(uml::Interface interface): interface.getTargetDirectedRelationships().source.typeSelect(JMM::OpenAPITag).sortBy(e|e.name);




© 2015 - 2024 Weber Informatics LLC | Privacy Policy