You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by "heliang666s (via GitHub)" <gi...@apache.org> on 2024/12/01 15:44:15 UTC
[PR] add openapi sample [dubbo-samples]
heliang666s opened a new pull request, #1197:
URL: https://github.com/apache/dubbo-samples/pull/1197
add openapi sample
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
Re: [PR] add openapi sample [dubbo-samples]
Posted by "chickenlj (via GitHub)" <gi...@apache.org>.
chickenlj merged PR #1197:
URL: https://github.com/apache/dubbo-samples/pull/1197
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
Re: [PR] add openapi sample [dubbo-samples]
Posted by "zrlw (via GitHub)" <gi...@apache.org>.
zrlw commented on PR #1197:
URL: https://github.com/apache/dubbo-samples/pull/1197#issuecomment-2658707727
@chickenlj @heliang666s
1. test result of dubbo-samples-triple-rest-openapi-advance is always failed at dubbo-samples github Actions on Dubbo 3.3:
```
[dubbo-samples-triple-rest-openapi-advance:1/1] TEST FAILURE: Run tests timeout, version: -Ddubbo.version=3.3.3-SNAPSHOT -Dspring.version=6.1.5 -Djava.version=17, please check logs: /home/runner/work/dubbo-samples/dubbo-samples/2-advanced/dubbo-samples-triple-rest/dubbo-samples-triple-rest-openapi-advance/target/logs
```
2. it's case-versions.conf set:
```
dubbo.version=3.3.*
spring.version=6.*
```
but current dubbo 3.3.* use spring 5.*, so the dubbo CI workflow always ignores this sample test.
so adding it to dubbo-samples for what?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
Re: [PR] add openapi sample [dubbo-samples]
Posted by "oxsean (via GitHub)" <gi...@apache.org>.
oxsean commented on code in PR #1197:
URL: https://github.com/apache/dubbo-samples/pull/1197#discussion_r1865871595
##########
2-advanced/dubbo-samples-triple-rest/dubbo-samples-triple-rest-openapi/src/test/java/org/apache/dubbo/rest/demo/test/ConsumerIT.java:
##########
@@ -0,0 +1,55 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.dubbo.rest.demo.test;
+
+import org.apache.dubbo.config.annotation.DubboReference;
+import org.apache.dubbo.config.spring.context.annotation.EnableDubbo;
+import org.apache.dubbo.rest.demo.DemoService;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.web.client.RestClient;
+
+
+@EnableDubbo
+@SpringBootTest
+public class ConsumerIT {
+
+ private static final String HOST = System.getProperty("dubbo.address", "localhost");
+ private final RestClient webClient = RestClient.create();
+
+ @DubboReference(url = "tri://${dubbo.address:localhost}:50052")
+
+ private DemoService demoService;
+
+ private static String toUri(String path) {
+ return "http://" + HOST + ":50052/" + path;
+ }
+
+ @Test
+ public void helloWithRest() {
+ String result = webClient.get().
+ uri(toUri("/dubbo/openapi/api-docs")).
+ retrieve().
+ body(String.class);
+ System.out.println(result);
+ Assert.assertNotNull(result);
Review Comment:
It's a good to add content asserts, such as containing a specific path
##########
2-advanced/dubbo-samples-triple-rest/dubbo-samples-triple-rest-openapi/pom.xml:
##########
@@ -0,0 +1,113 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.dubbo</groupId>
+ <artifactId>dubbo-samples-triple-rest</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <artifactId>dubbo-samples-triple-rest-openapi</artifactId>
+
+ <properties>
+ <maven.compiler.source>17</maven.compiler.source>
+ <maven.compiler.target>17</maven.compiler.target>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ <dubbo.version>3.3.3-SNAPSHOT</dubbo.version>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.dubbo</groupId>
+ <artifactId>dubbo-registry-zookeeper</artifactId>
+ <version>${dubbo.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.dubbo</groupId>
+ <artifactId>dubbo-rpc-triple</artifactId>
+ <version>${dubbo.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.dubbo</groupId>
Review Comment:
For a example, depend on
```xml
<dependency>
<groupId>org.apache.dubbo</groupId>
<artifactId>dubbo-spring-boot-starter</artifactId>
</dependency>
```
enough, please refer to https://github.com/apache/dubbo-samples/blob/master/2-advanced/dubbo-samples-triple-rest/dubbo-samples-triple-rest-basic/pom.xml
##########
2-advanced/dubbo-samples-triple-rest/dubbo-samples-triple-rest-openapi/src/main/java/org/apache/dubbo/rest/demo/DemoService.java:
##########
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.dubbo.rest.demo;
+
+import org.apache.dubbo.remoting.http12.HttpMethods;
+import org.apache.dubbo.remoting.http12.rest.Mapping;
+import org.apache.dubbo.remoting.http12.rest.Param;
+import org.apache.dubbo.remoting.http12.rest.ParamType;
+
+public interface DemoService {
Review Comment:
Add demo method for @OpenAPI @Operation @Schema
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org