com.reprezen.genflow.openapi.diagram.openapi3.KaiZenParserHelper Maven / Gradle / Ivy
package com.reprezen.genflow.openapi.diagram.openapi3;
import com.reprezen.genflow.api.normal.openapi.RepreZenVendorExtension;
import com.reprezen.jsonoverlay.IJsonOverlay;
import com.reprezen.jsonoverlay.JsonOverlay;
import com.reprezen.jsonoverlay.Overlay;
import com.reprezen.kaizen.oasparser.model3.Schema;
import java.util.Collections;
import java.util.Map;
import org.eclipse.xtext.xbase.lib.CollectionLiterals;
import org.eclipse.xtext.xbase.lib.Functions.Function1;
import org.eclipse.xtext.xbase.lib.IterableExtensions;
@SuppressWarnings("all")
public class KaiZenParserHelper {
public > T asNullIfMissing(final T el) {
boolean _isPresent = Overlay.of(((IJsonOverlay>) el)).isPresent();
boolean _not = (!_isPresent);
if (_not) {
return null;
}
return el;
}
public String getKaiZenSchemaName(final Schema schema) {
return Overlay.of(schema).getPathInParent();
}
public String getSchemaTitle(final Schema schema) {
String _kaiZenSchemaName = this.getKaiZenSchemaName(schema);
String _title = schema.getTitle();
String _rzveTypeName = this.getRzveTypeName(schema);
final Function1 _function = (String it) -> {
return Boolean.valueOf((it != null));
};
return IterableExtensions.head(IterableExtensions.filter(Collections.unmodifiableList(CollectionLiterals.newArrayList(_kaiZenSchemaName, _title, _rzveTypeName, "UNKNOWN")), _function));
}
public Map getRZVE(final Schema schema) {
Object _extension = schema.getExtension(RepreZenVendorExtension.EXTENSION_NAME);
return ((Map) _extension);
}
public String getRzveTypeName(final Schema schema) {
Map _rZVE = this.getRZVE(schema);
Object _get = null;
if (_rZVE!=null) {
_get=_rZVE.get("typeName");
}
return ((String) _get);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy