Search in sources :

Example 1 with CallbackImpl

use of org.wildfly.swarm.microprofile.openapi.api.models.callbacks.CallbackImpl in project wildfly-swarm by wildfly-swarm.

the class OpenApiParser method readCallback.

/**
 * Reads a {@link Callback} OpenAPI node.
 * @param node
 */
private Callback readCallback(JsonNode node) {
    if (node == null || !node.isObject()) {
        return null;
    }
    CallbackImpl model = new CallbackImpl();
    model.setRef(JsonUtil.stringProperty(node, OpenApiConstants.PROP_$REF));
    for (Iterator<String> fieldNames = node.fieldNames(); fieldNames.hasNext(); ) {
        String fieldName = fieldNames.next();
        if (fieldName.startsWith(OpenApiConstants.EXTENSION_PROPERTY_PREFIX) || fieldName.equals(OpenApiConstants.PROP_$REF)) {
            continue;
        }
        model.put(fieldName, readPathItem(node.get(fieldName)));
    }
    readExtensions(node, model);
    return model;
}
Also used : CallbackImpl(org.wildfly.swarm.microprofile.openapi.api.models.callbacks.CallbackImpl)

Example 2 with CallbackImpl

use of org.wildfly.swarm.microprofile.openapi.api.models.callbacks.CallbackImpl in project wildfly-swarm by wildfly-swarm.

the class OpenApiAnnotationScanner method readCallback.

/**
 * Reads a Callback annotation into a model.
 * @param annotation
 */
private Callback readCallback(AnnotationInstance annotation) {
    if (annotation == null) {
        return null;
    }
    LOG.debug("Processing a single @Callback annotation.");
    Callback callback = new CallbackImpl();
    callback.setRef(JandexUtil.refValue(annotation, RefType.Callback));
    String expression = JandexUtil.stringValue(annotation, OpenApiConstants.PROP_CALLBACK_URL_EXPRESSION);
    callback.put(expression, readCallbackOperations(annotation.value(OpenApiConstants.PROP_OPERATIONS)));
    return callback;
}
Also used : Callback(org.eclipse.microprofile.openapi.models.callbacks.Callback) CallbackImpl(org.wildfly.swarm.microprofile.openapi.api.models.callbacks.CallbackImpl)

Aggregations

CallbackImpl (org.wildfly.swarm.microprofile.openapi.api.models.callbacks.CallbackImpl)2 Callback (org.eclipse.microprofile.openapi.models.callbacks.Callback)1