void visit(final PathItem.HttpMethod method, final Operation operation, final PathItem pathItem) {
        if (filter.accept(operation.getOperationId())) {
            final String methodName = method.name().toLowerCase();
            emitter.emit(methodName, path);

            emit("id", operation.getOperationId());
            emit("description", operation.getDescription());
            Set<String> operationLevelConsumes = new LinkedHashSet<>();
            if (operation.getRequestBody() != null && operation.getRequestBody().getContent() != null) {
                operationLevelConsumes.addAll(operation.getRequestBody().getContent().keySet());
            }
            emit("consumes", operationLevelConsumes);
            Set<String> operationLevelProduces = new LinkedHashSet<>();
            if (operation.getResponses() != null) {
                for (ApiResponse response : operation.getResponses().values()) {
                    if (response.getContent() != null) {
                        operationLevelProduces.addAll(response.getContent().keySet());
                    }
                }
                ApiResponse response = operation.getResponses().get(ApiResponses.DEFAULT);
                if (response != null && response.getContent() != null) {
                    operationLevelProduces.addAll(response.getContent().keySet());
                }
            }
            emit("produces", operationLevelProduces);

            if (ObjectHelper.isNotEmpty(operation.getParameters())) {
                operation.getParameters().forEach(this::emit);
            }
            if (ObjectHelper.isNotEmpty(pathItem.getParameters())) {
                pathItem.getParameters().forEach(this::emit);
            }
            emitOperation(operation);

            emitter.emit("to", destinationGenerator.generateDestinationFor(operation));
        }
    }
@Test
    public void shouldEmitReferenceType() {
        final Builder method = MethodSpec.methodBuilder("configure");
        final MethodBodySourceCodeEmitter emitter = new MethodBodySourceCodeEmitter(method);
        final OperationVisitor<?> visitor = new OperationVisitor<>(
                emitter, new OperationFilter(), "/path", new DefaultDestinationGenerator(), "camel.sample");

        final OpenAPI document = new OpenAPIV3Parser().read(
                "src/test/resources/org/apache/camel/generator/openapi/openapi-v3-ref-schema.yaml", null, null);
        final PathItem pathItem = document.getPaths().get("/pet");

        visitor.visit(PathItem.HttpMethod.PUT, pathItem.getPut(), pathItem);

        assertThat(method.build().toString()).isEqualTo("void configure() {\n"
                                                        + "    put(\"/path\")\n"
                                                        + "      .id(\"updatePet\")\n"
                                                        + "      .description(\"Update an existing pet by Id\")\n"
                                                        + "      .consumes(\"application/json\")\n"
                                                        + "      .produces(\"application/json\")\n"
                                                        + "      .param()\n"
                                                        + "        .name(\"body\")\n"
                                                        + "        .type(org.apache.camel.model.rest.RestParamType.body)\n"
                                                        + "        .required(true)\n"
                                                        + "        .description(\"Update an existent pet in the store\")\n"
                                                        + "      .endParam()\n"
                                                        + "      .type(\"camel.sample.Pet[]\")\n"
                                                        + "      .outType(\"camel.sample.Pet[]\")\n"
                                                        + "      .to(\"direct:updatePet\")\n"
                                                        + "    }\n");
    }