Search in sources :

Example 1 with BodyLike

use of org.raml.v2.api.model.v08.bodies.BodyLike in project raml-for-jax-rs by mulesoft-labs.

the class V08Finder method typesInBodies.

private void typesInBodies(Resource resource, Method method, List<BodyLike> body, GFinderListener listener) {
    for (BodyLike typeDeclaration : body) {
        if (typeDeclaration.schema() == null) {
            continue;
        }
        if (globalSchemas.containsKey(typeDeclaration.schema().value())) {
            V08GType type = new V08GType(typeDeclaration.schema().value(), typeDeclaration);
            registry.addType(type);
            listener.newTypeDeclaration(type);
        } else {
            V08GType type = new V08GType(resource, method, typeDeclaration);
            registry.addType(type);
            listener.newTypeDeclaration(type);
        }
    }
    for (Response response : method.responses()) {
        for (BodyLike typeDeclaration : response.body()) {
            if (typeDeclaration.schema() == null) {
                continue;
            }
            if (globalSchemas.containsKey(typeDeclaration.schema().value())) {
                V08GType type = new V08GType(typeDeclaration.schema().value(), typeDeclaration);
                registry.addType(type);
                listener.newTypeDeclaration(type);
            } else {
                V08GType type = new V08GType(resource, method, response, typeDeclaration);
                registry.addType(type);
                listener.newTypeDeclaration(type);
            }
        }
    }
}
Also used : Response(org.raml.v2.api.model.v08.bodies.Response) BodyLike(org.raml.v2.api.model.v08.bodies.BodyLike)

Aggregations

BodyLike (org.raml.v2.api.model.v08.bodies.BodyLike)1 Response (org.raml.v2.api.model.v08.bodies.Response)1