Skip to content

Commit

Permalink
Merge branch 'master' into meta-codegen-improvements
Browse files Browse the repository at this point in the history
* master: (141 commits)
  smaller tests, better code format (OpenAPITools#4355)
  csharp-netcore: Replace null literals with default (OpenAPITools#4345)
  [core] consider polymorphism when computing unused schemas (OpenAPITools#4335)
  Fix issue 4326 forward throws for delegate to main method (OpenAPITools#4327)
  [kotlin][client] annotate api exceptions (OpenAPITools#4339)
  refactor java-vertx-web parameters and bugfix on non primitive parameter (OpenAPITools#4353)
  Remove deprecated API use of ObjectFactory.property() (OpenAPITools#2613) (OpenAPITools#4352)
  [python][metadata]: Adding license and author fields (OpenAPITools#4318)
  [Python] Avoid pep8 violation (OpenAPITools#4316)
  [JS] Update package.json (OpenAPITools#4261)
  Add slash-arun to Python technical committee (OpenAPITools#4354)
  [typescript-fetch] Fix discriminator mapping name (OpenAPITools#4340)
  fix security alerts reported by github (OpenAPITools#4344)
  fix cpp-restbed-server json field serialization OpenAPITools#4320 (OpenAPITools#4323)
  typescript-angular: fix oneOf and anyOf generates incorrect model for primitive types (OpenAPITools#4341)
  fix(typescript-angular): do not call .toISOString() on a string (OpenAPITools#4330) (OpenAPITools#4337)
  update samples (OpenAPITools#4334)
  Prepare 4.2.0 release (OpenAPITools#4333)
  [FEATURE][Haskell] Haskell-Servant serves static files (OpenAPITools#4058)
  [FEATURE][Haskell] Add Middleware support for the haskell servant generator (OpenAPITools#4056)
  ...
  • Loading branch information
jimschubert committed Nov 3, 2019
2 parents 63acf45 + 61d7d22 commit 2c41f8c
Show file tree
Hide file tree
Showing 4,578 changed files with 59,352 additions and 85,624 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
92 changes: 81 additions & 11 deletions .github/.test/samples.json
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@
]
},
{
"input": "csharp-refactor-petstore.sh",
"input": "csharp-netcore-petstore.sh",
"matches": [
"Client: C-Sharp"
]
Expand All @@ -151,6 +151,12 @@
"Client: Dart"
]
},
{
"input": "dart-dio-petstore.sh",
"matches": [
"Client: Dart"
]
},
{
"input": "dart-petstore.sh",
"matches": [
Expand Down Expand Up @@ -212,7 +218,7 @@
]
},
{
"input": "finch-petstore-server.sh",
"input": "scala-finch-petstore-server.sh",
"matches": [
"Server: Scala"
]
Expand Down Expand Up @@ -254,7 +260,7 @@
]
},
{
"input": "graphql-server-petstore.sh",
"input": "graphql-nodejs-express-server.sh",
"matches": [
"Server: GraphQL"
]
Expand Down Expand Up @@ -819,13 +825,13 @@
]
},
{
"input": "python-flask-petstore-python2.sh",
"input": "python-server-flask-petstore-python2.sh",
"matches": [
"Server: Python"
]
},
{
"input": "python-flask-petstore.sh",
"input": "python-server-flask-petstore.sh",
"matches": [
"Server: Python"
]
Expand Down Expand Up @@ -872,12 +878,6 @@
"Client: Rust"
]
},
{
"input": "rust-reqwest-petstore.sh",
"matches": [
"Client: Rust"
]
},
{
"input": "rust-server-petstore.sh",
"matches": [
Expand Down Expand Up @@ -1305,6 +1305,76 @@
"matches": [
"Announcement"
]
},
{
"input": "[typescript] Generic typescript text",
"matches": [
"Client: TypeScript"
]
},
{
"input": "[typescript] Generic typescript text",
"matches": [
"Client: TypeScript"
]
},
{
"input": "[typescript-angular] Generic typescript text",
"matches": [
"Client: TypeScript"
]
},
{
"input": "[typescript-angularjs] Generic typescript text",
"matches": [
"Client: TypeScript"
]
},
{
"input": "[typescript-aurelia] Generic typescript text",
"matches": [
"Client: TypeScript"
]
},
{
"input": "[typescript-axios] Generic typescript text",
"matches": [
"Client: TypeScript"
]
},
{
"input": "[typescript-fetch] Generic typescript text",
"matches": [
"Client: TypeScript"
]
},
{
"input": "[typescript-inversify] Generic typescript text",
"matches": [
"Client: TypeScript"
]
},
{
"input": "[typescript-jquery] Generic typescript text",
"matches": [
"Client: TypeScript"
]
},
{
"input": "[typescript-node] Generic typescript text",
"matches": [
"Client: TypeScript"
]
},
{
"input": "[typescript-rxjs] Generic typescript text",
"matches": [
"Client: TypeScript"
]
},
{
"input": "Should not auto-label for typescript outside of brackets.",
"matches": []
}
]
}
2 changes: 1 addition & 1 deletion .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
### PR checklist

- [ ] Read the [contribution guidelines](https://github.com/openapitools/openapi-generator/blob/master/CONTRIBUTING.md).
- [ ] If contributing template-only or documentation-only changes which will change sample output, [build the project](https://github.com/OpenAPITools/openapi-generator#14---build-projects) before .
- [ ] If contributing template-only or documentation-only changes which will change sample output, [build the project](https://github.com/OpenAPITools/openapi-generator#14---build-projects) before.
- [ ] Run the shell script(s) under `./bin/` (or Windows batch scripts under`.\bin\windows`) to update Petstore samples related to your fix. This is important, as CI jobs will verify _all_ generator outputs of your HEAD commit, and these must match the expectations made by your contribution. You only need to run `./bin/{LANG}-petstore.sh`, `./bin/openapi3/{LANG}-petstore.sh` if updating the code or mustache templates for a language (`{LANG}`) (e.g. php, ruby, python, etc).
- [ ] File the PR against the [correct branch](https://github.com/OpenAPITools/openapi-generator/wiki/Git-Branches): `master`, `4.1.x`, `5.0.x`. Default: `master`.
- [ ] Copy the [technical committee](https://github.com/openapitools/openapi-generator/#62---openapi-generator-technical-committee) to review the pull request if your PR is targeting a particular programming language.
1 change: 1 addition & 0 deletions .github/auto-labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ labels:
- '\s*?-[gl] swift[34]+\s*?'
- '\s*?-[gl] swift2-deprecated\s*?'
'Client: TypeScript':
- '\s*?\[typescript\]\s*?'
- '\s*?\[typescript-[\-a-z]+\]\s*?'
- '\s*?-[gl] typescript-[\-a-z]+\s*?'
# 'Client: VB/VB.net': # NOTE: Not yet implemented
Expand Down
23 changes: 9 additions & 14 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,10 @@ before_install:
- docker run -d -e SWAGGER_HOST=http://petstore.swagger.io -e SWAGGER_BASE_PATH=/v2 -p 80:8080 swaggerapi/petstore
- docker ps -a
# Add bats test framework and cURL for Bash script integration tests
#- sudo add-apt-repository ppa:duggan/bats --yes
#- sudo apt-get update -qq
#- sudo apt-get install -qq bats
#- sudo apt-get install -qq curl
- sudo add-apt-repository ppa:duggan/bats --yes
- sudo apt-get update -qq
- sudo apt-get install -qq bats
- sudo apt-get install -qq curl
# install dart
#- sudo apt-get update
#- sudo apt-get install apt-transport-https
Expand All @@ -94,16 +94,11 @@ before_install:
# - Rely on `kerl` for [pre-compiled versions available](https://docs.travis-ci.com/user/languages/erlang#Choosing-OTP-releases-to-test-against). Rely on installation path chosen by [`travis-erlang-builder`](https://github.com/travis-ci/travis-erlang-builder/blob/e6d016b1a91ca7ecac5a5a46395bde917ea13d36/bin/compile#L18).
# - . ~/otp/18.2.1/activate && erl -version
#- curl -f -L -o ./rebar3 https://s3.amazonaws.com/rebar3/rebar3 && chmod +x ./rebar3 && ./rebar3 version && export PATH="${TRAVIS_BUILD_DIR}:$PATH"
# install valgrind for C++ memory test
- sudo apt-get install valgrind
# install Qt 5.10
# comment out the following due to failure in downloading http://ppa.launchpad.net/beineri/opt-qt-5.10.1-trusty/ubuntu/dists/xenial/main/binary-amd64/Packages
#- sudo add-apt-repository --yes ppa:beineri/opt-qt-5.10.1-trusty
#- sudo apt-get update -qq
#- sudo apt-get install qt510-meta-minimal
#- source /opt/qt510/bin/qt510-env.sh
#- qmake -v

# install C++ tools
- sudo apt install -y --no-install-recommends valgrind cmake build-essential
# install Qt5
- sudo apt install -y --no-install-recommends qt5-default
- cmake --version
# show host table to confirm petstore.swagger.io is mapped to localhost
- cat /etc/hosts
# show java version
Expand Down
4 changes: 4 additions & 0 deletions CI/circle_parallel.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ elif [ "$NODE_INDEX" = "2" ]; then
# install elm-format
npm install -g elm-format

# clear any changes to the samples
git checkout -- .

# look for outdated samples
./bin/utils/ensure-up-to-date
fi
#elif [ "$NODE_INDEX" = "3" ]; then
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,33 +15,57 @@ public class ApiKeyAuthTest {
public void testApplyToParamsInQuery() {
List<Pair> queryParams = new ArrayList<Pair>();
Map<String, String> headerParams = new HashMap<String, String>();
Map<String, String> cookieParams = new HashMap<String, String>();

ApiKeyAuth auth = new ApiKeyAuth("query", "api_key");
auth.setApiKey("my-api-key");
auth.applyToParams(queryParams, headerParams);
auth.applyToParams(queryParams, headerParams, cookieParams);

assertEquals(1, queryParams.size());
for (Pair queryParam : queryParams) {
assertEquals("my-api-key", queryParam.getValue());
}

// no changes to header parameters
// no changes to header or cookie parameters
assertEquals(0, headerParams.size());
assertEquals(0, cookieParams.size());
}

@Test
public void testApplyToParamsInHeaderWithPrefix() {
List<Pair> queryParams = new ArrayList<Pair>();
Map<String, String> headerParams = new HashMap<String, String>();
Map<String, String> cookieParams = new HashMap<String, String>();

ApiKeyAuth auth = new ApiKeyAuth("header", "X-API-TOKEN");
auth.setApiKey("my-api-token");
auth.setApiKeyPrefix("Token");
auth.applyToParams(queryParams, headerParams);
auth.applyToParams(queryParams, headerParams, cookieParams);

// no changes to query parameters
// no changes to query or cookie parameters
assertEquals(0, queryParams.size());
assertEquals(0, cookieParams.size());

assertEquals(1, headerParams.size());
assertEquals("Token my-api-token", headerParams.get("X-API-TOKEN"));
}

@Test
public void testApplyToParamsInCookieWithPrefix() {
List<Pair> queryParams = new ArrayList<Pair>();
Map<String, String> headerParams = new HashMap<String, String>();
Map<String, String> cookieParams = new HashMap<String, String>();

ApiKeyAuth auth = new ApiKeyAuth("cookie", "X-API-TOKEN");
auth.setApiKey("my-api-token");
auth.setApiKeyPrefix("Token");
auth.applyToParams(queryParams, headerParams, cookieParams);

// no changes to query or header parameters
assertEquals(0, queryParams.size());
assertEquals(0, headerParams.size());

assertEquals(1, cookieParams.size());
assertEquals("Token my-api-token", cookieParams.get("X-API-TOKEN"));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,29 +22,31 @@ public void setup() {
public void testApplyToParams() {
List<Pair> queryParams = new ArrayList<Pair>();
Map<String, String> headerParams = new HashMap<String, String>();
Map<String, String> cookieParams = new HashMap<String, String>();

auth.setUsername("my-username");
auth.setPassword("my-password");
auth.applyToParams(queryParams, headerParams);
auth.applyToParams(queryParams, headerParams, cookieParams);

// no changes to query parameters
// no changes to query or cookie parameters
assertEquals(0, queryParams.size());
assertEquals(0, cookieParams.size());
assertEquals(1, headerParams.size());
// the string below is base64-encoded result of "my-username:my-password" with the "Basic " prefix
String expected = "Basic bXktdXNlcm5hbWU6bXktcGFzc3dvcmQ=";
assertEquals(expected, headerParams.get("Authorization"));

// null username should be treated as empty string
auth.setUsername(null);
auth.applyToParams(queryParams, headerParams);
auth.applyToParams(queryParams, headerParams, cookieParams);
// the string below is base64-encoded result of ":my-password" with the "Basic " prefix
expected = "Basic Om15LXBhc3N3b3Jk";
assertEquals(expected, headerParams.get("Authorization"));

// null password should be treated as empty string
auth.setUsername("my-username");
auth.setPassword(null);
auth.applyToParams(queryParams, headerParams);
auth.applyToParams(queryParams, headerParams, cookieParams);
// the string below is base64-encoded result of "my-username:" with the "Basic " prefix
expected = "Basic bXktdXNlcm5hbWU6";
assertEquals(expected, headerParams.get("Authorization"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,33 +15,55 @@ public class ApiKeyAuthTest {
public void testApplyToParamsInQuery() {
List<Pair> queryParams = new ArrayList<Pair>();
Map<String, String> headerParams = new HashMap<String, String>();
Map<String, String> cookieParams = new HashMap<String, String>();

ApiKeyAuth auth = new ApiKeyAuth("query", "api_key");
auth.setApiKey("my-api-key");
auth.applyToParams(queryParams, headerParams);
auth.applyToParams(queryParams, headerParams, cookieParams);

assertEquals(1, queryParams.size());
for (Pair queryParam : queryParams) {
assertEquals("my-api-key", queryParam.getValue());
}

// no changes to header parameters
// no changes to header or cookie parameters
assertEquals(0, headerParams.size());
assertEquals(0, cookieParams.size());
}

@Test
public void testApplyToParamsInHeaderWithPrefix() {
List<Pair> queryParams = new ArrayList<Pair>();
Map<String, String> headerParams = new HashMap<String, String>();
Map<String, String> cookieParams = new HashMap<String, String>();

ApiKeyAuth auth = new ApiKeyAuth("header", "X-API-TOKEN");
auth.setApiKey("my-api-token");
auth.setApiKeyPrefix("Token");
auth.applyToParams(queryParams, headerParams);
auth.applyToParams(queryParams, headerParams, cookieParams);

// no changes to query parameters
assertEquals(0, queryParams.size());
assertEquals(0, cookieParams.size());
assertEquals(1, headerParams.size());
assertEquals("Token my-api-token", headerParams.get("X-API-TOKEN"));
}

@Test
public void testApplyToParamsInCookieWithPrefix() {
List<Pair> queryParams = new ArrayList<Pair>();
Map<String, String> headerParams = new HashMap<String, String>();
Map<String, String> cookieParams = new HashMap<String, String>();

ApiKeyAuth auth = new ApiKeyAuth("cookie", "X-API-TOKEN");
auth.setApiKey("my-api-token");
auth.setApiKeyPrefix("Token");
auth.applyToParams(queryParams, headerParams, cookieParams);

// no changes to query or header parameters
assertEquals(0, queryParams.size());
assertEquals(0, headerParams.size());
assertEquals(1, cookieParams.size());
assertEquals("Token my-api-token", cookieParams.get("X-API-TOKEN"));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,11 @@ public void setup() {
public void testApplyToParams() {
List<Pair> queryParams = new ArrayList<Pair>();
Map<String, String> headerParams = new HashMap<String, String>();
Map<String, String> cookieParams = new HashMap<String, String>();

auth.setUsername("my-username");
auth.setPassword("my-password");
auth.applyToParams(queryParams, headerParams);
auth.applyToParams(queryParams, headerParams, cookieParams);

// no changes to query parameters
assertEquals(0, queryParams.size());
Expand All @@ -36,15 +37,15 @@ public void testApplyToParams() {

// null username should be treated as empty string
auth.setUsername(null);
auth.applyToParams(queryParams, headerParams);
auth.applyToParams(queryParams, headerParams, cookieParams);
// the string below is base64-encoded result of ":my-password" with the "Basic " prefix
expected = "Basic Om15LXBhc3N3b3Jk";
assertEquals(expected, headerParams.get("Authorization"));

// null password should be treated as empty string
auth.setUsername("my-username");
auth.setPassword(null);
auth.applyToParams(queryParams, headerParams);
auth.applyToParams(queryParams, headerParams, cookieParams);
// the string below is base64-encoded result of "my-username:" with the "Basic " prefix
expected = "Basic bXktdXNlcm5hbWU6";
assertEquals(expected, headerParams.get("Authorization"));
Expand Down
Loading

0 comments on commit 2c41f8c

Please sign in to comment.