Skip to content

Commit 77050e4

Browse files
authored
Merge branch '3.0.0' into aspnetcore_2_x_samples
2 parents 14e0e4c + 9df2874 commit 77050e4

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+3142
-7
lines changed

README.md

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -821,6 +821,10 @@ Please refer to this [page.](https://github.com/swagger-api/swagger-codegen/blob
821821
Also for `swagger-codegen version 3` templates and classes for code generation are being migrated to [swagger-codegen-generators](https://github.com/swagger-api/swagger-codegen-generators)
822822
repo. In order to know this migration process you can refer this [page.](https://github.com/swagger-api/swagger-codegen/wiki/Swagger-Codegen-migration-(swagger-codegen-generators-repository))
823823

824+
# Security contact
825+
826+
Please disclose any security-related issues or vulnerabilities by emailing [[email protected]](mailto:[email protected]), instead of using the public issue tracker.
827+
824828
# License information on Generated Code
825829

826830
The Swagger Codegen project is intended as a benefit for users of the Swagger / Open API Specification. The project itself has the [License](#license) as specified. In addition, please understand the following points:
@@ -830,10 +834,10 @@ The Swagger Codegen project is intended as a benefit for users of the Swagger /
830834

831835
When code is generated from this project, it shall be considered **AS IS** and owned by the user of the software. There are no warranties--expressed or implied--for generated code. You can do what you wish with it, and once generated, the code is your responsibility and subject to the licensing terms that you deem appropriate.
832836

833-
License
834-
-------
837+
# License
835838

836-
Copyright 2018 SmartBear Software
839+
```
840+
Copyright 2019 SmartBear Software
837841

838842
Licensed under the Apache License, Version 2.0 (the "License");
839843
you may not use this file except in compliance with the License.
@@ -844,3 +848,5 @@ distributed under the License is distributed on an "AS IS" BASIS,
844848
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
845849
See the License for the specific language governing permissions and
846850
limitations under the License.
851+
```
852+

bin/python-flask-petstore.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ fi
2626

2727
# if you've executed sbt assembly previously it will use that instead.
2828
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -Dlogback.configurationFile=bin/logback.xml"
29-
ags="$@ generate -t modules/swagger-codegen/src/main/resources/flaskConnexion -i modules/swagger-codegen/src/test/resources/2_0/petstore.yaml -l python-flask -o samples/server/petstore/flaskConnexion -Dservice"
29+
ags="$@ generate -i modules/swagger-codegen/src/test/resources/3_0_0/petstore.yaml -l python-flask -o samples/server/petstore/flaskConnexion -Dservice"
3030

3131
rm -rf samples/server/petstore/flaskConnexion/*
32-
# java $JAVA_OPTS -jar $executable $ags
32+
java $JAVA_OPTS -jar $executable $ags

modules/swagger-codegen/src/main/java/io/swagger/codegen/v3/utils/ModelUtils.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@
1212
import java.util.HashMap;
1313
import java.util.List;
1414
import java.util.Map;
15+
import java.util.Objects;
16+
import java.util.stream.Collectors;
17+
import java.util.stream.Stream;
1518

1619
public class ModelUtils {
1720
/**
@@ -43,15 +46,18 @@ public static CodegenModel getModelByName(final String name, final Map<String, O
4346
}
4447

4548
public static Operation[] createOperationArray (PathItem pathItem) {
46-
return new Operation[]{
49+
return Stream.of(
4750
pathItem.getGet(),
4851
pathItem.getPost(),
4952
pathItem.getDelete(),
5053
pathItem.getHead(),
5154
pathItem.getPut(),
5255
pathItem.getPatch(),
5356
pathItem.getOptions()
54-
};
57+
)
58+
.filter(Objects::nonNull)
59+
.collect(Collectors.toSet())
60+
.toArray(new Operation[]{});
5561
}
5662

5763
public static void processCodegenModels(Map<String, CodegenModel> allModels) {
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
.travis.yaml
2+
.swagger-codegen-ignore
3+
README.md
4+
tox.ini
5+
git_push.sh
6+
test-requirements.txt
7+
setup.py
8+
9+
# Byte-compiled / optimized / DLL files
10+
__pycache__/
11+
*.py[cod]
12+
*$py.class
13+
14+
# C extensions
15+
*.so
16+
17+
# Distribution / packaging
18+
.Python
19+
env/
20+
build/
21+
develop-eggs/
22+
dist/
23+
downloads/
24+
eggs/
25+
.eggs/
26+
lib/
27+
lib64/
28+
parts/
29+
sdist/
30+
var/
31+
*.egg-info/
32+
.installed.cfg
33+
*.egg
34+
35+
# PyInstaller
36+
# Usually these files are written by a python script from a template
37+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
38+
*.manifest
39+
*.spec
40+
41+
# Installer logs
42+
pip-log.txt
43+
pip-delete-this-directory.txt
44+
45+
# Unit test / coverage reports
46+
htmlcov/
47+
.tox/
48+
.coverage
49+
.coverage.*
50+
.cache
51+
nosetests.xml
52+
coverage.xml
53+
*,cover
54+
.hypothesis/
55+
venv/
56+
.python-version
57+
58+
# Translations
59+
*.mo
60+
*.pot
61+
62+
# Django stuff:
63+
*.log
64+
65+
# Sphinx documentation
66+
docs/_build/
67+
68+
# PyBuilder
69+
target/
70+
71+
#Ipython Notebook
72+
.ipynb_checkpoints
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
# Byte-compiled / optimized / DLL files
2+
__pycache__/
3+
*.py[cod]
4+
*$py.class
5+
6+
# C extensions
7+
*.so
8+
9+
# Distribution / packaging
10+
.Python
11+
env/
12+
build/
13+
develop-eggs/
14+
dist/
15+
downloads/
16+
eggs/
17+
.eggs/
18+
lib/
19+
lib64/
20+
parts/
21+
sdist/
22+
var/
23+
*.egg-info/
24+
.installed.cfg
25+
*.egg
26+
27+
# PyInstaller
28+
# Usually these files are written by a python script from a template
29+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
30+
*.manifest
31+
*.spec
32+
33+
# Installer logs
34+
pip-log.txt
35+
pip-delete-this-directory.txt
36+
37+
# Unit test / coverage reports
38+
htmlcov/
39+
.tox/
40+
.coverage
41+
.coverage.*
42+
.cache
43+
nosetests.xml
44+
coverage.xml
45+
*,cover
46+
.hypothesis/
47+
venv/
48+
.python-version
49+
50+
# Translations
51+
*.mo
52+
*.pot
53+
54+
# Django stuff:
55+
*.log
56+
57+
# Sphinx documentation
58+
docs/_build/
59+
60+
# PyBuilder
61+
target/
62+
63+
#Ipython Notebook
64+
.ipynb_checkpoints
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Swagger Codegen Ignore
2+
# Generated by swagger-codegen https://github.com/swagger-api/swagger-codegen
3+
4+
# Use this file to prevent files from being overwritten by the generator.
5+
# The patterns follow closely to .gitignore or .dockerignore.
6+
7+
# As an example, the C# client generator defines ApiClient.cs.
8+
# You can make changes and tell Swagger Codgen to ignore just this file by uncommenting the following line:
9+
#ApiClient.cs
10+
11+
# You can match any string of characters against a directory, file or extension with a single asterisk (*):
12+
#foo/*/qux
13+
# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux
14+
15+
# You can recursively match patterns against a directory, file or extension with a double asterisk (**):
16+
#foo/**/qux
17+
# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux
18+
19+
# You can also negate patterns with an exclamation (!).
20+
# For example, you can ignore all files in a docs folder with the file extension .md:
21+
#docs/*.md
22+
# Then explicitly reverse the ignore rule for a single file:
23+
#!docs/README.md
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
3.0.9-SNAPSHOT
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# ref: https://docs.travis-ci.com/user/languages/python
2+
language: python
3+
python:
4+
- "3.2"
5+
- "3.3"
6+
- "3.4"
7+
- "3.5"
8+
#- "3.5-dev" # 3.5 development branch
9+
#- "nightly" # points to the latest development branch e.g. 3.6-dev
10+
# command to install dependencies
11+
install: "pip install -r requirements.txt"
12+
# command to run tests
13+
script: nosetests
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
FROM python:3-alpine
2+
3+
RUN mkdir -p /usr/src/app
4+
WORKDIR /usr/src/app
5+
6+
COPY requirements.txt /usr/src/app/
7+
8+
RUN pip3 install --no-cache-dir -r requirements.txt
9+
10+
COPY . /usr/src/app
11+
12+
EXPOSE 8080
13+
14+
ENTRYPOINT ["python3"]
15+
16+
CMD ["-m", "swagger_server"]
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# Swagger generated server
2+
3+
## Overview
4+
This server was generated by the [swagger-codegen](https://github.com/swagger-api/swagger-codegen) project. By using the
5+
[OpenAPI-Spec](https://github.com/swagger-api/swagger-core/wiki) from a remote server, you can easily generate a server stub. This
6+
is an example of building a swagger-enabled Flask server.
7+
8+
This example uses the [Connexion](https://github.com/zalando/connexion) library on top of Flask.
9+
10+
## Requirements
11+
Python 3.5.2+
12+
13+
## Usage
14+
To run the server, please execute the following from the root directory:
15+
16+
```
17+
pip3 install -r requirements.txt
18+
python3 -m swagger_server
19+
```
20+
21+
and open your browser to here:
22+
23+
```
24+
http://localhost:8080/ui/
25+
```
26+
27+
Your Swagger definition lives here:
28+
29+
```
30+
http://localhost:8080/swagger.json
31+
```
32+
33+
To launch the integration tests, use tox:
34+
```
35+
sudo pip install tox
36+
tox
37+
```
38+
39+
## Running with Docker
40+
41+
To run the server on a Docker container, please execute the following from the root directory:
42+
43+
```bash
44+
# building the image
45+
docker build -t swagger_server .
46+
47+
# starting up a container
48+
docker run -p 8080:8080 swagger_server
49+
```

0 commit comments

Comments
 (0)