Skip to content
  • Sponsor
  • Notifications You must be signed in to change notification settings
  • Fork 70
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: python-openapi/openapi-spec-validator
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 0.5.6
Choose a base ref
...
head repository: python-openapi/openapi-spec-validator
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref
Loading
Showing with 3,404 additions and 1,806 deletions.
  1. +0 −18 .bumpversion.cfg
  2. +14 −0 .github/dependabot.yml
  3. +9 −11 .github/workflows/build-docs.yml
  4. +51 −0 .github/workflows/docker-publish-manual.yml
  5. +19 −13 .github/workflows/docker-publish.yml
  6. +10 −11 .github/workflows/python-publish.yml
  7. +9 −6 .github/workflows/python-test.yml
  8. +4 −0 .gitignore
  9. +7 −0 .pre-commit-config.yaml
  10. +10 −7 .readthedocs.yaml
  11. +0 −1 .travis.yml
  12. +17 −3 Dockerfile
  13. +1 −1 Makefile
  14. +22 −7 README.rst
  15. +20 −0 SECURITY.md
  16. +1 −1 docs/cli.rst
  17. +0 −1 docs/conf.py
  18. +1 −1 docs/hook.rst
  19. +15 −3 docs/index.rst
  20. +18 −18 docs/python.rst
  21. +13 −1 openapi_spec_validator/__init__.py
  22. +59 −42 openapi_spec_validator/__main__.py
  23. +5 −1 openapi_spec_validator/exceptions.py
  24. +5 −7 openapi_spec_validator/readers.py
  25. +24 −12 openapi_spec_validator/resources/schemas/v3.0/schema.json
  26. +175 −73 openapi_spec_validator/resources/schemas/v3.1/schema.json
  27. +10 −0 openapi_spec_validator/schemas/__init__.py
  28. +6 −0 openapi_spec_validator/schemas/types.py
  29. +6 −14 openapi_spec_validator/schemas/utils.py
  30. +84 −11 openapi_spec_validator/shortcuts.py
  31. +25 −42 openapi_spec_validator/validation/__init__.py
  32. +65 −0 openapi_spec_validator/validation/caches.py
  33. +42 −15 openapi_spec_validator/validation/decorators.py
  34. +450 −0 openapi_spec_validator/validation/keywords.py
  35. +13 −14 openapi_spec_validator/validation/protocols.py
  36. +71 −9 openapi_spec_validator/validation/proxies.py
  37. +22 −0 openapi_spec_validator/validation/registries.py
  38. +5 −0 openapi_spec_validator/validation/types.py
  39. +124 −311 openapi_spec_validator/validation/validators.py
  40. +13 −0 openapi_spec_validator/versions/__init__.py
  41. +23 −0 openapi_spec_validator/versions/consts.py
  42. +15 −0 openapi_spec_validator/versions/datatypes.py
  43. +6 −0 openapi_spec_validator/versions/exceptions.py
  44. +26 −0 openapi_spec_validator/versions/finders.py
  45. +10 −0 openapi_spec_validator/versions/shortcuts.py
  46. +1,521 −986 poetry.lock
  47. +66 −27 pyproject.toml
  48. +2 −21 tests/integration/conftest.py
  49. +42 −0 tests/integration/data/v3.0/read-only-write-only.yaml
  50. +29 −26 tests/integration/data/v3.1/petstore.yaml
  51. +68 −11 tests/integration/test_main.py
  52. +33 −18 tests/integration/test_shortcuts.py
  53. +43 −0 tests/integration/test_versions.py
  54. +33 −38 tests/integration/validation/test_exceptions.py
  55. +42 −25 tests/integration/validation/test_validators.py
18 changes: 0 additions & 18 deletions .bumpversion.cfg

This file was deleted.

14 changes: 14 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
version: 2
updates:
- package-ecosystem: "docker"
directory: "/"
schedule:
interval: "weekly"
- package-ecosystem: "pip"
directory: "/"
schedule:
interval: "weekly"
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
20 changes: 9 additions & 11 deletions .github/workflows/build-docs.yml
Original file line number Diff line number Diff line change
@@ -9,27 +9,25 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Set up Python 3.9
uses: actions/setup-python@v2
- name: Set up Python 3.12
uses: actions/setup-python@v4
with:
python-version: 3.9
python-version: 3.12

- name: Get full Python version
id: full-python-version
run: echo ::set-output name=version::$(python -c "import sys; print('-'.join(str(v) for v in sys.version_info))")

- name: Bootstrap poetry
run: |
curl -sL https://raw.githubusercontent.com/python-poetry/poetry/master/install-poetry.py | python - -y
echo "$HOME/.local/bin" >> $GITHUB_PATH
- name: Set up poetry
uses: Gr1N/setup-poetry@v8

- name: Configure poetry
run: poetry config virtualenvs.in-project true

- name: Set up cache
uses: actions/cache@v2
uses: actions/cache@v3
id: cache
with:
path: .venv
@@ -40,13 +38,13 @@ jobs:
run: timeout 10s poetry run pip --version || rm -rf .venv

- name: Install dependencies
run: poetry install -E docs
run: poetry install --with docs

- name: Build documentation
run: |
poetry run python -m sphinx -T -b html -d docs/_build/doctrees -D language=en docs docs/_build/html -n -W
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v4
name: Upload docs as artifact
with:
name: docs-html
51 changes: 51 additions & 0 deletions .github/workflows/docker-publish-manual.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# This workflow will upload Docker image when a release is created
# For more information see: https://github.com/marketplace/actions/docker-build-push-action

name: Publish docker image (manual)

on:
workflow_dispatch:
inputs:
version:
required: true
description: Version to build
push:
type: boolean
description: Push to docker hub

jobs:
docker:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: Docker meta
id: meta
uses: docker/metadata-action@v4
with:
images: |
pythonopenapi/openapi-spec-validator
tags: |
type=semver,pattern={{version}},value=${{ github.event.inputs.version }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v2

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Login to DockerHub
if: github.event.inputs.push
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build and push
uses: docker/build-push-action@v4
with:
context: .
platforms: linux/amd64,linux/arm64
push: ${{ github.event.inputs.push }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
32 changes: 19 additions & 13 deletions .github/workflows/docker-publish.yml
Original file line number Diff line number Diff line change
@@ -7,35 +7,41 @@ on:
workflow_dispatch:
release:
types:
- created
- published

jobs:
docker:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Docker meta
id: docker_meta
uses: crazy-max/ghaction-docker-meta@v1
id: meta
uses: docker/metadata-action@v4
with:
images: |
p1c2u/openapi-spec-validator
tag-semver: |
{{version}}
pythonopenapi/openapi-spec-validator
tags: |
type=semver,pattern={{version}}
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
uses: docker/setup-qemu-action@v2

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
uses: docker/setup-buildx-action@v2

- name: Login to DockerHub
if: github.event_name != 'pull_request'
uses: docker/login-action@v1
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build and push
uses: docker/build-push-action@v2
uses: docker/build-push-action@v4
with:
context: .
platforms: linux/amd64,linux/arm64
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.docker_meta.outputs.tags }}
labels: ${{ steps.docker_meta.outputs.labels }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
21 changes: 10 additions & 11 deletions .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
@@ -7,29 +7,28 @@ on:
workflow_dispatch:
release:
types:
- created
- published

jobs:
publish:
runs-on: ubuntu-latest
permissions:
id-token: write
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v2
uses: actions/setup-python@v5
with:
python-version: '3.x'

- name: Bootstrap poetry
run: |
curl -sL https://raw.githubusercontent.com/python-poetry/poetry/master/install-poetry.py | python - -y
echo "$HOME/.local/bin" >> $GITHUB_PATH
- name: Set up poetry
uses: Gr1N/setup-poetry@v9

- name: Build
run: poetry build

- name: Publish
env:
POETRY_HTTP_BASIC_PYPI_USERNAME: ${{ secrets.PYPI_USERNAME }}
POETRY_HTTP_BASIC_PYPI_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: poetry publish
uses: pypa/gh-action-pypi-publish@release/v1
with:
packages-dir: dist/
15 changes: 9 additions & 6 deletions .github/workflows/python-test.yml
Original file line number Diff line number Diff line change
@@ -14,14 +14,14 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11']
python-version: ['3.9', '3.10', '3.11', '3.12', '3.13']
os: [windows-latest, ubuntu-latest]
fail-fast: false
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

@@ -36,7 +36,7 @@ jobs:
run: poetry config virtualenvs.in-project true

- name: Set up cache
uses: actions/cache@v2
uses: actions/cache@v3
id: cache
with:
path: .venv
@@ -48,7 +48,7 @@ jobs:
run: timeout 10s poetry run pip --version || rm -rf .venv

- name: Install dependencies
run: poetry install -E requests
run: poetry install --all-extras

- name: Test
env:
@@ -58,5 +58,8 @@ jobs:
- name: Static type check
run: poetry run mypy

- name: Check dependencies
run: poetry run deptry .

- name: Upload coverage
uses: codecov/codecov-action@v1
uses: codecov/codecov-action@v3
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -97,6 +97,10 @@ ENV/
# mkdocs documentation
/site

# asdf versions
.tool-versions
.default-python-packages

# mypy
.mypy_cache/

7 changes: 7 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -37,3 +37,10 @@ repos:
language: system
require_serial: true
types: [python]

- id: pyflakes
name: pyflakes
entry: pyflakes
language: system
require_serial: true
types: [python]
17 changes: 10 additions & 7 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
@@ -5,10 +5,13 @@ sphinx:

formats: all

python:
version: 3.8
install:
- method: pip
path: .
extra_requirements:
- docs
build:
os: ubuntu-20.04
tools:
python: "3.9"
jobs:
post_create_environment:
- pip install poetry
- poetry config virtualenvs.create false
post_install:
- poetry install --with docs
1 change: 0 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -2,7 +2,6 @@ language: python
sudo: false
matrix:
include:
- python: '3.7'
- python: '3.8'
- python: '3.9'
- python: '3.10-dev'
20 changes: 17 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,21 @@
FROM python:3.7-alpine
ARG OPENAPI_SPEC_VALIDATOR_VERSION=0.8.0b1

ARG OPENAPI_SPEC_VALIDATOR_VERSION=0.5.6
FROM python:3.13.4-alpine as builder

RUN pip install --no-cache-dir openapi-spec-validator==${OPENAPI_SPEC_VALIDATOR_VERSION}
ARG OPENAPI_SPEC_VALIDATOR_VERSION

ENV CARGO_REGISTRIES_CRATES_IO_PROTOCOL=sparse

RUN apk add --no-cache cargo
RUN python -m pip wheel --wheel-dir /wheels openapi-spec-validator==${OPENAPI_SPEC_VALIDATOR_VERSION}

FROM python:3.13.4-alpine

ARG OPENAPI_SPEC_VALIDATOR_VERSION

COPY --from=builder /wheels /wheels
RUN apk add --no-cache libgcc
RUN pip install --no-cache-dir --pre --find-links /wheels openapi-spec-validator==${OPENAPI_SPEC_VALIDATOR_VERSION} && \
rm -r /wheels

ENTRYPOINT ["openapi-spec-validator"]
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -4,7 +4,7 @@ PROJECT_NAME=openapi-spec-validator
PACKAGE_NAME=$(subst -,_,${PROJECT_NAME})
VERSION=`git describe --abbrev=0`

DOCKER_REGISTRY=p1c2u
DOCKER_REGISTRY=pythonopenapi

PYTHONDONTWRITEBYTECODE=1

Loading