Skip to content

Commit

Permalink
Merge branch 'master' into test-cases-for-ClassCastException-when-res…
Browse files Browse the repository at this point in the history
…olving-external-refs-more-than-once
  • Loading branch information
gracekarina authored Jan 15, 2024
2 parents 7cbf895 + 2295b8a commit 4606548
Show file tree
Hide file tree
Showing 375 changed files with 25,594 additions and 1,616 deletions.
3 changes: 2 additions & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ charset = utf-8

[modules/swagger-parser-v3/src/test/resources/**/*.json]
trim_trailing_whitespace = false

insert_final_newline = false
[modules/swagger-parser-v3/src/test/resources/**/*.yaml]
trim_trailing_whitespace = false
insert_final_newline = false
40 changes: 40 additions & 0 deletions .github/actions/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: 'Swagger Parser'
description: 'Parses, validates, dereferences an OpenAPI definition'
inputs:
inputSpec:
description: 'path to OpenAPI definition file'
required: true
options:
description: 'parser options'
required: false
serializationType:
description: 'result file serialization type'
required: false
logsPath:
description: 'path to validation result file'
required: false
parserSpecPath:
description: 'output path of the serialized parsed definition'
required: false
parserVersion:
description: 'parser version'
required: false
runs:
using: "composite"
steps:
- id: java-version
run: java -version 2>&1 | fgrep -i version | cut -d'"' -f2 | sed -e 's/^1\./1\%/' -e 's/\..*//' -e 's/%/./'
shell: bash
- name: Build Java
if: steps.java-version == null || steps.java-version < 1.8
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: '11'
- name: Download JAR
run: curl -L 'https://repository.sonatype.org/service/local/artifact/maven/content?r=central-proxy&g=io.swagger.parser.v3&a=swagger-parser-cli&e=jar&v=${{ inputs.parserVersion }}' -o swagger-parser-cli.jar
shell: bash
- id: execute
name: Execute Jar
run: java -jar swagger-parser-cli.jar -i /home/runner/work/${{ inputs.inputSpec }} ${{ inputs.options }} ${{ inputs.serializationType }} -o /home/runner/work/${{ inputs.parserSpecPath }} -l /home/runner/work/${{ inputs.logsPath }}
shell: bash
9 changes: 9 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
version: 2
updates:
- package-ecosystem: "maven"
directory: "/"
schedule:
interval: "daily"
ignore:
- dependency-name: "*"
update-types: ["version-update:semver-major"]
16 changes: 16 additions & 0 deletions .github/workflows/dependency-review.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: 'Dependency Review'
on: [pull_request]

permissions:
contents: read

jobs:
dependency-review:
runs-on: ubuntu-latest
steps:
- name: 'Checkout Repository'
uses: actions/checkout@v4
- name: Dependency Review
uses: actions/dependency-review-action@v3
with:
fail-on-severity: high
2 changes: 1 addition & 1 deletion .github/workflows/maven-pulls.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
java: [ 8, 11, 14 ]
java: [ 11, 14, 17 ]

steps:
- uses: actions/checkout@v2
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/maven.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
java: [ 8, 11, 14 ]
java: [ 11, 14, 17 ]

steps:
- uses: actions/checkout@v2
Expand Down Expand Up @@ -38,7 +38,7 @@ jobs:
mvn --no-transfer-progress -B install --file pom.xml
export MY_JAVA_VERSION=`java -version 2>&1 | head -1 | cut -d'"' -f2 | sed '/^1\./s///' | cut -d'.' -f1`
echo "JAVA VERSION" ${MY_JAVA_VERSION}
if [[ ${MY_JAVA_VERSION} == "8" ]];
if [[ ${MY_JAVA_VERSION} == "11" ]];
then
export MY_POM_VERSION=`mvn -q -Dexec.executable="echo" -Dexec.args='${projects.version}' --non-recursive org.codehaus.mojo:exec-maven-plugin:1.3.1:exec`
echo "POM VERSION" ${MY_POM_VERSION}
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/next-snapshot-v1.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ jobs:
with:
app_id: ${{ secrets.APP_ID }}
private_key: ${{ secrets.APP_PRIVATE_KEY }}
- name: Set up Python 2.7
uses: actions/setup-python@v2
- name: Set up Python 3.10
uses: actions/setup-python@v4
with:
python-version: 2.7
python-version: '3.10'
- name: Set up Java 8
uses: actions/setup-java@v2
with:
Expand Down Expand Up @@ -68,7 +68,7 @@ jobs:
run: |
. ./CI/post-nextsnap-v1.sh
- name: Create Next Snapshot Pull Request
uses: peter-evans/create-pull-request@v2
uses: peter-evans/create-pull-request@v4
if: env.RELEASE_OK == 'yes'
with:
token: ${{ steps.generate-token.outputs.token }}
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/next-snapshot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@ jobs:
with:
app_id: ${{ secrets.APP_ID }}
private_key: ${{ secrets.APP_PRIVATE_KEY }}
- name: Set up Python 2.7
uses: actions/setup-python@v2
- name: Set up Python 3.10
uses: actions/setup-python@v4
with:
python-version: 2.7
- name: Set up Java 8
python-version: '3.10'
- name: Set up Java 11
uses: actions/setup-java@v2
with:
java-version: 8
java-version: 11
distribution: 'zulu'
server-id: ossrh
server-username: MAVEN_USERNAME
Expand Down Expand Up @@ -68,7 +68,7 @@ jobs:
run: |
. ./CI/post-nextsnap.sh
- name: Create Next Snapshot Pull Request
uses: peter-evans/create-pull-request@v2
uses: peter-evans/create-pull-request@v4
if: env.RELEASE_OK == 'yes'
with:
token: ${{ steps.generate-token.outputs.token }}
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/prepare-release-v1.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ jobs:
with:
app_id: ${{ secrets.APP_ID }}
private_key: ${{ secrets.APP_PRIVATE_KEY }}
- name: Set up Python 2.7
uses: actions/setup-python@v2
- name: Set up Python 3.10
uses: actions/setup-python@v4
with:
python-version: 2.7
python-version: '3.10'
- name: Set up Java 8
uses: actions/setup-java@v2
with:
Expand Down Expand Up @@ -50,7 +50,7 @@ jobs:
echo "SC_VERSION=$SC_VERSION" >> $GITHUB_ENV
echo "SC_NEXT_VERSION=$SC_NEXT_VERSION" >> $GITHUB_ENV
- name: Create Prepare Release Pull Request
uses: peter-evans/create-pull-request@v2
uses: peter-evans/create-pull-request@v4
if: env.PREPARE_RELEASE_OK == 'yes'
with:
token: ${{ steps.generate-token.outputs.token }}
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/prepare-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@ jobs:
with:
app_id: ${{ secrets.APP_ID }}
private_key: ${{ secrets.APP_PRIVATE_KEY }}
- name: Set up Python 2.7
uses: actions/setup-python@v2
- name: Set up Python 3.10
uses: actions/setup-python@v4
with:
python-version: 2.7
- name: Set up Java 8
python-version: '3.10'
- name: Set up Java 11
uses: actions/setup-java@v2
with:
java-version: 8
java-version: 11
distribution: 'zulu'
server-id: ossrh
server-username: MAVEN_USERNAME
Expand All @@ -50,7 +50,7 @@ jobs:
echo "SC_VERSION=$SC_VERSION" >> $GITHUB_ENV
echo "SC_NEXT_VERSION=$SC_NEXT_VERSION" >> $GITHUB_ENV
- name: Create Prepare Release Pull Request
uses: peter-evans/create-pull-request@v2
uses: peter-evans/create-pull-request@v4
if: env.PREPARE_RELEASE_OK == 'yes'
with:
token: ${{ steps.generate-token.outputs.token }}
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/release-v1.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ jobs:
with:
app_id: ${{ secrets.APP_ID }}
private_key: ${{ secrets.APP_PRIVATE_KEY }}
- name: Set up Python 2.7
uses: actions/setup-python@v2
- name: Set up Python 3.10
uses: actions/setup-python@v4
with:
python-version: 2.7
python-version: '3.10'
- name: Set up Java 8
uses: actions/setup-java@v2
with:
Expand Down Expand Up @@ -72,7 +72,7 @@ jobs:
run: |
. ./CI/post-release-v1.sh
- name: Create Next Snapshot Pull Request
uses: peter-evans/create-pull-request@v2
uses: peter-evans/create-pull-request@v4
if: env.RELEASE_OK == 'yes'
with:
token: ${{ steps.generate-token.outputs.token }}
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@ jobs:
with:
app_id: ${{ secrets.APP_ID }}
private_key: ${{ secrets.APP_PRIVATE_KEY }}
- name: Set up Python 2.7
uses: actions/setup-python@v2
- name: Set up Python 3.10
uses: actions/setup-python@v4
with:
python-version: 2.7
- name: Set up Java 8
python-version: '3.10'
- name: Set up Java 11
uses: actions/setup-java@v2
with:
java-version: 8
java-version: 11
distribution: 'zulu'
server-id: ossrh
server-username: MAVEN_USERNAME
Expand Down Expand Up @@ -72,7 +72,7 @@ jobs:
run: |
. ./CI/post-release.sh
- name: Create Next Snapshot Pull Request
uses: peter-evans/create-pull-request@v2
uses: peter-evans/create-pull-request@v4
if: env.RELEASE_OK == 'yes'
with:
token: ${{ steps.generate-token.outputs.token }}
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ modules/swagger-parser/src/test/resources/relative-file-references/yaml
**/test-output/*
dependency-reduced-pom.xml
*.pyc
/bin/
6 changes: 6 additions & 0 deletions .whitesource
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"settingsInheritedFrom": "swagger-api/whitesource-config@main",
"scanSettings": {
"baseBranches": ["master", "v1"]
}
}
47 changes: 24 additions & 23 deletions CI/ghApiClient.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

import os
import time
import urllib2
import httplib
import urllib.request, urllib.error, urllib.parse
import http.client
import json

GH_BASE_URL = "https://api.github.com/"
Expand All @@ -13,46 +13,47 @@

def readUrl(name):
try:
request = urllib2.Request(GH_BASE_URL + name)
request = urllib.request.Request(GH_BASE_URL + name)
request.add_header("Authorization", GH_AUTH)
content = urllib2.urlopen(request).read()
content = urllib.request.urlopen(request).read()
jcont = json.loads(content)
return jcont;
except urllib2.HTTPError, e:
print 'HTTPError = ' + str(e.code)
return jcont
except urllib.error.HTTPError as e:
print(('HTTPError = ' + str(e.code)))
raise e
except urllib2.URLError, e:
print 'URLError = ' + str(e.reason)
except urllib.error.URLError as e:
print(('URLError = ' + str(e.reason)))
raise e
except httplib.HTTPException, e:
print 'HTTPException = ' + str(e)
except http.client.HTTPException as e:
print(('HTTPException = ' + str(e)))
raise e
except Exception:
import traceback
print 'generic exception: ' + traceback.format_exc()
print(('generic exception: ' + traceback.format_exc()))
raise IOError

def postUrl(name, body):
global GH_BASE_URL
try:
time.sleep(0.05)
request = urllib2.Request(GH_BASE_URL + name)
request = urllib.request.Request(GH_BASE_URL + name)
request.add_header("Authorization", GH_AUTH)
request.add_header("Accept", "application/vnd.github.v3+json")
content = urllib2.urlopen(request, body).read()
data = body.encode('utf-8')
content = urllib.request.urlopen(request, data).read()
jcont = json.loads(content)
return jcont;
except urllib2.HTTPError, e:
print 'HTTPError = ' + str(e.code)
print str(e)
return jcont
except urllib.error.HTTPError as e:
print(('HTTPError = ' + str(e.code)))
print((str(e)))
raise e
except urllib2.URLError, e:
print 'URLError = ' + str(e.reason)
except urllib.error.URLError as e:
print(('URLError = ' + str(e.reason)))
raise e
except httplib.HTTPException, e:
print 'HTTPException = ' + str(e)
except http.client.HTTPException as e:
print(('HTTPException = ' + str(e)))
raise e
except Exception:
import traceback
print 'generic exception: ' + traceback.format_exc()
print(('generic exception: ' + traceback.format_exc()))
raise IOError
3 changes: 2 additions & 1 deletion CI/lastRelease.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ def getLastReleaseTag():
# main
def main():
result = getLastReleaseTag()
print result
print(result)

# here start main
main()

3 changes: 2 additions & 1 deletion CI/lastReleaseV1.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ def getLastReleaseTag():
# main
def main():
result = getLastReleaseTag()
print result
print(result)

# here start main
main()

1 change: 1 addition & 0 deletions CI/publishRelease.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,4 @@ def main(tag):

# here start main
main(sys.argv[1])

1 change: 1 addition & 0 deletions CI/publishReleaseV1.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,4 @@ def main(tag):

# here start main
main(sys.argv[1])

Loading

0 comments on commit 4606548

Please sign in to comment.