Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[example]add swagger sample project to test the relevant functionality of the API documentation. #4825

Merged
merged 91 commits into from Jul 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
91 commits
Select commit Hold shift + click to select a range
1de4c09
apidoc sql
Jun 8, 2022
943536e
refact
Jun 21, 2022
43a3e04
commit
Jun 22, 2022
058677d
[Task] Shenyu-admin: Fix API document failed to build because of NPE.
Jun 22, 2022
8412561
[Task] Shenyu-admin: Fix API document failed to build because of NPE.
Jun 22, 2022
36d90f9
Merge branch 'refact' into 3603
Jun 23, 2022
1991e45
Merge branch 'apidoc-sql' into 3603
Jun 23, 2022
22dfce6
Merge branch 'master' of https://github.com/apache/incubator-shenyu i…
Jun 24, 2022
d2ebf48
solve conficts,modify LICENSE.
Jun 24, 2022
5230091
Merge branch '3603-BACK'
Jun 25, 2022
0c63d0c
Merge branch 'master' of https://github.com/apache/incubator-shenyu
Jun 26, 2022
e569cfa
Merge branch 'master' of https://github.com/apache/incubator-shenyu
Jul 1, 2022
12d9797
Merge branch 'master' of https://github.com/apache/incubator-shenyu
Jul 3, 2022
6671f90
delete useless code.
Jul 4, 2022
4b0e879
delete useless code.
Jul 4, 2022
0522fbf
commit
Jul 4, 2022
c7b535f
Merge branch 'master' of https://github.com/apache/incubator-shenyu
Jul 4, 2022
77e0b9a
Merge branch 'header'
Jul 4, 2022
d37ae8a
Merge branch 'master' of https://github.com/apache/incubator-shenyu
Jul 19, 2022
0df6f18
Merge branch 'master' of https://github.com/apache/incubator-shenyu
Jul 20, 2022
a1e05c9
Merge branch 'master' of https://github.com/apache/incubator-shenyu
Aug 12, 2022
a62545a
[ISSUE #3843]admin apidoc fix: the required attribute prompt is incor…
Aug 13, 2022
daad095
commit
Aug 13, 2022
9c54200
Merge branch 'master' into 3843
Aug 13, 2022
c1b13a6
[shenyu-examples]add swagger to the example project to test the apido…
Aug 13, 2022
eba290f
Merge branch 'master' of https://github.com/apache/shenyu into exampl…
Aug 13, 2022
da2d8ba
commit
Aug 13, 2022
3d31495
commit
Aug 14, 2022
dee2616
commit
Aug 14, 2022
2bbf088
Merge branch 'apache:master' into master
lianjunwei Aug 31, 2022
83aa04c
Merge branch 'apache:master' into master
lianjunwei Sep 14, 2022
950d23c
Merge branch 'apache:master' into master
lianjunwei Sep 22, 2022
b7886c0
Merge branch 'apache:master' into master
lianjunwei Sep 29, 2022
646af38
Merge branch 'apache:master' into master
lianjunwei Nov 7, 2022
be38ab3
Merge branch 'apache:master' into master
lianjunwei Nov 8, 2022
433dd44
Merge branch 'apache:master' into master
lianjunwei Nov 9, 2022
5b61de4
Merge branch 'apache:master' into master
lianjunwei Nov 13, 2022
6d91b73
Merge branch 'apache:master' into master
lianjunwei Jan 8, 2023
eb22b39
Merge branch 'apache:master' into master
lianjunwei Jan 17, 2023
9192e47
Merge branch 'apache:master' into master
lianjunwei Jan 28, 2023
e181701
Merge branch 'apache:master' into master
lianjunwei Apr 7, 2023
cccfada
Merge branch 'apache:master' into master
lianjunwei May 10, 2023
4db5386
Merge branch 'apache:master' into master
lianjunwei May 17, 2023
356a19f
Merge branch 'apache:master' into master
lianjunwei May 28, 2023
153b00e
Merge branch 'apache:master' into master
lianjunwei May 30, 2023
459adff
Merge branch 'apache:master' into master
lianjunwei May 31, 2023
f9383f8
[ISSUE #4690]Supports gzip compression in response to HTTP requests.
May 31, 2023
56901ae
Merge branch 'master' into 4690
lianjunwei Jun 1, 2023
4f27bea
Merge branch 'apache:master' into master
lianjunwei Jun 1, 2023
3584275
Merge branch 'master' into 4690
loongs-zhang Jun 3, 2023
31e2283
Merge branch 'apache:master' into master
lianjunwei Jun 4, 2023
5740490
Merge branch 'master' into 4690
Jun 4, 2023
2a66dcc
Merge remote-tracking branch 'origin/4690' into 4690
Jun 4, 2023
88fe30a
Merge branch 'apache:master' into master
lianjunwei Jun 5, 2023
43999b4
Merge branch '4690'
Jun 5, 2023
be6b36b
Merge branch 'apache:master' into master
lianjunwei Jun 6, 2023
44b3e70
Merge remote-tracking branch 'origin/master'
Jun 6, 2023
b523445
Merge branch 'apache:master' into master
lianjunwei Jun 7, 2023
1c59c48
Merge remote-tracking branch 'origin/master'
Jun 7, 2023
5bd6308
Merge branch 'apache:master' into master
lianjunwei Jun 9, 2023
14be36b
Merge branch 'apache:master' into master
lianjunwei Jun 9, 2023
e6eefd8
Merge branch 'master' into example-add-swagger
Jun 9, 2023
1a4376e
[examples]Add Swagger sample project to demonstrate automatic pull in…
Jun 10, 2023
83e31aa
Merge branch 'apache:master' into master
lianjunwei Jun 26, 2023
37f2036
Merge remote-tracking branch 'origin/master'
Jun 26, 2023
70002c9
Merge branch 'apache:master' into master
lianjunwei Jun 27, 2023
704507a
Merge remote-tracking branch 'origin/master'
Jun 27, 2023
6f7978e
Merge branch 'apache:master' into master
lianjunwei Jul 1, 2023
b0a0876
Merge remote-tracking branch 'origin/master'
Jul 1, 2023
24efdb6
Merge branch 'apache:master' into master
lianjunwei Jul 9, 2023
40a0bd4
Merge remote-tracking branch 'origin/master'
Jul 9, 2023
ccae655
Add swagger to the sample project to test the relevant functionality …
Jul 9, 2023
7eb7269
commit
Jul 9, 2023
573029d
commit
Jul 9, 2023
774bb3d
[examples]Add Swagger sample project to demonstrate automatic pull in…
Jul 9, 2023
5237da8
commit
Jul 9, 2023
129a1a2
Merge branch 'master' into 4824
lianjunwei Jul 10, 2023
bbb460e
Merge branch 'master' into 4824
lianjunwei Jul 12, 2023
03fc05f
Merge branch 'master' into 4824
loongs-zhang Jul 13, 2023
78fef67
Merge branch 'master' into 4824
lianjunwei Jul 13, 2023
8737065
Merge branch 'master' into 4824
lianjunwei Jul 14, 2023
3b5cb8f
add test example.
Jul 16, 2023
e95c071
Merge remote-tracking branch 'origin/4824' into 4824
Jul 16, 2023
942c85e
commit.
Jul 16, 2023
b63a3f9
Merge branch 'master' into 4824
lianjunwei Jul 16, 2023
046a1b6
commit
Jul 16, 2023
e16846a
commit
Jul 16, 2023
ad78339
Merge branch 'master' into 4824
lianjunwei Jul 17, 2023
367c8cc
Merge branch 'master' into 4824
lianjunwei Jul 18, 2023
02de41f
Merge branch 'master' into 4824
lianjunwei Jul 18, 2023
4cf9119
Merge branch 'master' into 4824
lianjunwei Jul 18, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
18 changes: 18 additions & 0 deletions shenyu-examples/pom.xml
Expand Up @@ -38,11 +38,13 @@
<versions-maven-plugin.version>2.5</versions-maven-plugin.version>
<docker-maven-plugin.version>0.40.1</docker-maven-plugin.version>
<maven-checkstyle-plugin.version>3.1.0</maven-checkstyle-plugin.version>
<swagger.version>2.9.2</swagger.version>
</properties>

<modules>
<module>shenyu-examples-common</module>
<module>shenyu-examples-http</module>
<module>shenyu-examples-http-swagger2</module>
<module>shenyu-examples-https</module>
<module>shenyu-examples-dubbo</module>
<module>shenyu-examples-springcloud</module>
Expand All @@ -59,6 +61,22 @@
<module>shenyu-examples-brpc</module>
</modules>

<dependencyManagement>
<dependencies>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>${swagger.version}</version>
</dependency>

<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>${swagger.version}</version>
</dependency>
</dependencies>
</dependencyManagement>

<build>
<plugins>
<plugin>
Expand Down
29 changes: 29 additions & 0 deletions shenyu-examples/shenyu-examples-http-swagger2/Dockerfile
@@ -0,0 +1,29 @@
# 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.

FROM openjdk:8-jre-alpine

ENV APP_NAME shenyu-examples-http-swagger2
ENV LOCAL_PATH /opt/${APP_NAME}

RUN mkdir -p ${LOCAL_PATH}

ADD target/${APP_NAME}.jar ${LOCAL_PATH}

WORKDIR ${LOCAL_PATH}
EXPOSE 8190

CMD java -jar ${APP_NAME}.jar
@@ -0,0 +1,48 @@
#!/bin/bash
#
# 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.
#

PRGDIR=`dirname "$0"`
for service in `grep -v -E "^$|^#" ${PRGDIR}/services.list`
do
for loop in `seq 1 30`
do
status=`curl -o /dev/null -s -w %{http_code} $service`
echo -e "curl $service response $status"

if [ $status -eq 200 ]; then
break
fi

sleep 2
done
done

sleep 5

status=`curl -s -o /dev/null -w "%{http_code}" -X POST -H "Content-Type:application/json" http://localhost:31195/http/order/save --data '{"name":"test", "id": 123}'`

sleep 3

if [ $status -eq 200 ]; then
echo -e "Success to send request: $status"
echo -e "\n-------------------"
exit 0
fi
echo -e "Failed to send request from shenyu-bootstrap to http example: $status"
echo -e "\n-------------------"
exit 1
@@ -0,0 +1,19 @@
# 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.

http://localhost:31095/actuator/health
http://localhost:31195/actuator/health
http://localhost:31189/test/path/123?name=tom
@@ -0,0 +1,82 @@
# 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.

apiVersion: apps/v1
kind: Deployment
metadata:
name: shenyu-admin
labels:
app: shenyu-admin
all: shenyu-examples-http-swagger2
spec:
replicas: 1
selector:
matchLabels:
app: shenyu-admin
all: shenyu-examples-http-swagger2
template:
metadata:
labels:
app: shenyu-admin
all: shenyu-examples-http-swagger2
spec:
containers:
- name: shenyu-admin
image: apache/shenyu-admin:latest
resources: {}
env:
- name: SPRING_PROFILES_ACTIVE
value: h2
- name: shenyu.database.init_script
value: sql-script/h2/schema.sql
ports:
- containerPort: 9095
imagePullPolicy: IfNotPresent
restartPolicy: Always
status: {}

---
apiVersion: apps/v1
kind: Deployment
metadata:
name: shenyu-bootstrap
labels:
app: shenyu-bootstrap
all: shenyu-examples-http-swagger2
spec:
replicas: 1
selector:
matchLabels:
app: shenyu-bootstrap
all: shenyu-examples-http-swagger2
template:
metadata:
labels:
app: shenyu-bootstrap
all: shenyu-examples-http-swagger2
spec:
containers:
- name: shenyu-bootstrap
image: apache/shenyu-bootstrap:latest
resources: {}
env:
- name: shenyu.sync.websocket.urls
value: ws://shenyu-admin:9095/websocket
ports:
- containerPort: 9195
imagePullPolicy: IfNotPresent
restartPolicy: Always
status: {}
@@ -0,0 +1,91 @@
# 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.

apiVersion: apps/v1
kind: Deployment
metadata:
name: shenyu-examples-http-swagger2-deployment
labels:
app: shenyu-examples-http-swagger2
all: shenyu-examples-http-swagger2
spec:
replicas: 1
selector:
matchLabels:
app: shenyu-examples-http-swagger2
all: shenyu-examples-http-swagger2
strategy: {}
template:
metadata:
labels:
app: shenyu-examples-http-swagger2
all: shenyu-examples-http-swagger2
spec:
containers:
- image: shenyu-examples-http-swagger2
name: shenyu-examples-http-swagger2
livenessProbe:
exec:
command:
- wget -q -O - http://localhost:8190/actuator/health | grep UP || exit 1
initialDelaySeconds: 10
failureThreshold: 3
timeoutSeconds: 2
env:
- name: shenyu.register.serverLists
value: http://shenyu-admin:9095
ports:
- containerPort: 8190
imagePullPolicy: IfNotPresent
restartPolicy: Always
status: {}

---
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: shenyu-zk
all: shenyu-examples-http-swagger2
name: shenyu-zk
spec:
replicas: 1
selector:
matchLabels:
app: shenyu-zk
all: shenyu-examples-http-swagger2
strategy: {}
template:
metadata:
labels:
app: shenyu-zk
all: shenyu-examples-http-swagger2
spec:
containers:
- image: zookeeper:3.5
name: shenyu-zk
resources: {}
ports:
- containerPort: 2181
name: client
- containerPort: 2888
name: server
- containerPort: 3888
name: leader-election
- containerPort: 8080
name: website
restartPolicy: Always
status: {}
@@ -0,0 +1,62 @@
# 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.

apiVersion: v1
kind: Service
metadata:
name: shenyu-examples-http-swagger2-service
labels:
app: shenyu-examples-http-swagger2
all: shenyu-examples-http-swagger2
spec:
selector:
app: shenyu-examples-http-swagger2
all: shenyu-examples-http-swagger2
type: NodePort
ports:
- name: "8190"
port: 8190
targetPort: 8190
nodePort: 31189
status:
loadBalancer: {}

---
apiVersion: v1
kind: Service
metadata:
name: shenyu-zk
labels:
app: shenyu-zk
all: shenyu-examples-http-swagger2
spec:
type: NodePort
selector:
app: shenyu-zk
all: shenyu-examples-http-swagger2
ports:
- name: "client"
port: 2181
targetPort: 2181
- name: "server"
port: 2888
targetPort: 2888
- name: "election"
port: 3888
targetPort: 3888
- name: "website"
port: 8080
targetPort: 8080