azure-functions-openapi 0.4.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. azure_functions_openapi-0.4.0/.coveragerc +4 -0
  2. azure_functions_openapi-0.4.0/.editorconfig +12 -0
  3. azure_functions_openapi-0.4.0/.github/copilot-instructions.md +1 -0
  4. azure_functions_openapi-0.4.0/.github/workflows/deploy-docs.yml +32 -0
  5. azure_functions_openapi-0.4.0/.github/workflows/test.yml +48 -0
  6. azure_functions_openapi-0.4.0/.gitignore +179 -0
  7. azure_functions_openapi-0.4.0/.pre-commit-config.yaml +36 -0
  8. azure_functions_openapi-0.4.0/CHANGELOG.md +27 -0
  9. azure_functions_openapi-0.4.0/LICENSE +21 -0
  10. azure_functions_openapi-0.4.0/Makefile +104 -0
  11. azure_functions_openapi-0.4.0/PKG-INFO +244 -0
  12. azure_functions_openapi-0.4.0/README.md +217 -0
  13. azure_functions_openapi-0.4.0/codecov.yml +14 -0
  14. azure_functions_openapi-0.4.0/docs/MILESTONES.md +59 -0
  15. azure_functions_openapi-0.4.0/docs/api.md +82 -0
  16. azure_functions_openapi-0.4.0/docs/assets/hello_openapi_swagger_ui_preview.png +0 -0
  17. azure_functions_openapi-0.4.0/docs/assets/todo_crud_api_swagger_ui_preview.png +0 -0
  18. azure_functions_openapi-0.4.0/docs/changelog.md +8 -0
  19. azure_functions_openapi-0.4.0/docs/contributing.md +64 -0
  20. azure_functions_openapi-0.4.0/docs/development.md +88 -0
  21. azure_functions_openapi-0.4.0/docs/docs.md +59 -0
  22. azure_functions_openapi-0.4.0/docs/examples/hello_openapi.md +22 -0
  23. azure_functions_openapi-0.4.0/docs/examples/todo_crud_api.md +18 -0
  24. azure_functions_openapi-0.4.0/docs/index.md +151 -0
  25. azure_functions_openapi-0.4.0/docs/installation.md +36 -0
  26. azure_functions_openapi-0.4.0/docs/usage.md +258 -0
  27. azure_functions_openapi-0.4.0/examples/__init__.py +0 -0
  28. azure_functions_openapi-0.4.0/examples/hello_openapi/.funcignore +3 -0
  29. azure_functions_openapi-0.4.0/examples/hello_openapi/.gitignore +48 -0
  30. azure_functions_openapi-0.4.0/examples/hello_openapi/__init__.py +0 -0
  31. azure_functions_openapi-0.4.0/examples/hello_openapi/function_app.py +133 -0
  32. azure_functions_openapi-0.4.0/examples/hello_openapi/host.json +15 -0
  33. azure_functions_openapi-0.4.0/examples/hello_openapi/local.settings.json +7 -0
  34. azure_functions_openapi-0.4.0/examples/hello_openapi/requirements.txt +5 -0
  35. azure_functions_openapi-0.4.0/examples/todo_crud_api/__init__.py +0 -0
  36. azure_functions_openapi-0.4.0/examples/todo_crud_api/function_app.py +319 -0
  37. azure_functions_openapi-0.4.0/examples/todo_crud_api/host.json +15 -0
  38. azure_functions_openapi-0.4.0/examples/todo_crud_api/local.settings.json +7 -0
  39. azure_functions_openapi-0.4.0/mkdocs.yml +49 -0
  40. azure_functions_openapi-0.4.0/pyproject.toml +76 -0
  41. azure_functions_openapi-0.4.0/src/azure_functions_openapi/__init__.py +3 -0
  42. azure_functions_openapi-0.4.0/src/azure_functions_openapi/decorator.py +143 -0
  43. azure_functions_openapi-0.4.0/src/azure_functions_openapi/openapi.py +99 -0
  44. azure_functions_openapi-0.4.0/src/azure_functions_openapi/swagger_ui.py +28 -0
  45. azure_functions_openapi-0.4.0/src/azure_functions_openapi/utils.py +20 -0
  46. azure_functions_openapi-0.4.0/tests/test_decorator.py +66 -0
  47. azure_functions_openapi-0.4.0/tests/test_hello_openapi_function_app.py +50 -0
  48. azure_functions_openapi-0.4.0/tests/test_openapi.py +196 -0
  49. azure_functions_openapi-0.4.0/tests/test_openapi_spec.py +29 -0
  50. azure_functions_openapi-0.4.0/tests/test_test_swagger_ui.py +15 -0
  51. azure_functions_openapi-0.4.0/tests/test_utils.py +44 -0
@@ -0,0 +1,4 @@
1
+ # .coveragerc
2
+ [run]
3
+ relative_files = True
4
+ source = src/azure_functions_openapi
@@ -0,0 +1,12 @@
1
+ # This file sets code formatting rules that are respected by many editors and IDEs
2
+ # It helps maintain consistent coding style across different environments
3
+
4
+ root = true
5
+
6
+ [*]
7
+ charset = utf-8 # Use UTF-8 encoding for all files
8
+ end_of_line = lf # Use LF (Unix-style) line endings
9
+ indent_style = space # Use spaces instead of tabs
10
+ indent_size = 4 # Indent with 4 spaces
11
+ trim_trailing_whitespace = true # Remove any whitespace characters at the end of lines
12
+ insert_final_newline = true # Ensure every file ends with a newline
@@ -0,0 +1 @@
1
+ - @azure Rule - Use Azure Best Practices: When generating code for Azure, running terminal commands for Azure, or performing operations related to Azure, invoke your `azure_development-get_best_practices` tool if available.
@@ -0,0 +1,32 @@
1
+ name: Deploy MkDocs to GitHub Pages
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - main
7
+
8
+ permissions:
9
+ contents: write
10
+
11
+ jobs:
12
+ deploy:
13
+ runs-on: ubuntu-latest
14
+
15
+ steps:
16
+ - name: Checkout repository
17
+ uses: actions/checkout@v4
18
+
19
+ - name: Set up Python
20
+ uses: actions/setup-python@v5
21
+ with:
22
+ python-version: "3.8"
23
+
24
+ - name: Install dependencies
25
+ run: |
26
+ pip install mkdocs mkdocs-material
27
+
28
+ - name: Build docs to verify build before deploy
29
+ run: mkdocs build --strict
30
+
31
+ - name: Deploy to GitHub Pages
32
+ run: mkdocs gh-deploy --force
@@ -0,0 +1,48 @@
1
+ name: Test and Coverage
2
+
3
+ on: [push, pull_request]
4
+
5
+ permissions:
6
+ contents: read
7
+
8
+ jobs:
9
+ test:
10
+ runs-on: ubuntu-latest
11
+ strategy:
12
+ matrix:
13
+ python-version: ["3.9", "3.10", "3.11", "3.12"]
14
+
15
+ steps:
16
+ - name: Checkout code
17
+ uses: actions/checkout@v4
18
+
19
+ - name: Set up Python ${{ matrix.python-version }}
20
+ uses: actions/setup-python@v5
21
+ with:
22
+ python-version: ${{ matrix.python-version }}
23
+
24
+ - name: Create virtualenv and install dev dependencies
25
+ run: |
26
+ make install PYTHON=python
27
+
28
+ - name: Show workspace contents (debug)
29
+ run: ls -R
30
+
31
+ - name: Run tests with coverage (Makefile)
32
+ run: |
33
+ . .venv/bin/activate
34
+ make coverage
35
+
36
+ - name: Verify coverage output
37
+ run: ls -lh coverage.xml
38
+
39
+ - name: Upload coverage to Codecov
40
+ if: matrix.python-version == '3.9'
41
+ uses: codecov/codecov-action@v4
42
+ with:
43
+ token: ${{ secrets.CODECOV_TOKEN }}
44
+ files: ./coverage.xml
45
+ verbose: true
46
+ fail_ci_if_error: true
47
+ env:
48
+ CODECOV_RETRIES: 3
@@ -0,0 +1,179 @@
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
+ build/
12
+ develop-eggs/
13
+ dist/
14
+ downloads/
15
+ eggs/
16
+ .eggs/
17
+ lib/
18
+ lib64/
19
+ parts/
20
+ sdist/
21
+ var/
22
+ wheels/
23
+ share/python-wheels/
24
+ *.egg-info/
25
+ .installed.cfg
26
+ *.egg
27
+ MANIFEST
28
+
29
+ # PyInstaller
30
+ # Usually these files are written by a python script from a template
31
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
32
+ *.manifest
33
+ *.spec
34
+
35
+ # Installer logs
36
+ pip-log.txt
37
+ pip-delete-this-directory.txt
38
+
39
+ # Unit test / coverage reports
40
+ htmlcov/
41
+ .tox/
42
+ .nox/
43
+ .coverage
44
+ .coverage.*
45
+ .cache
46
+ nosetests.xml
47
+ coverage.xml
48
+ *.cover
49
+ *.py,cover
50
+ .hypothesis/
51
+ .pytest_cache/
52
+ cover/
53
+
54
+ # Translations
55
+ *.mo
56
+ *.pot
57
+
58
+ # Django stuff:
59
+ *.log
60
+ local_settings.py
61
+ db.sqlite3
62
+ db.sqlite3-journal
63
+
64
+ # Flask stuff:
65
+ instance/
66
+ .webassets-cache
67
+
68
+ # Scrapy stuff:
69
+ .scrapy
70
+
71
+ # Sphinx documentation
72
+ docs/_build/
73
+
74
+ # PyBuilder
75
+ .pybuilder/
76
+ target/
77
+
78
+ # Jupyter Notebook
79
+ .ipynb_checkpoints
80
+
81
+ # IPython
82
+ profile_default/
83
+ ipython_config.py
84
+
85
+ # pyenv
86
+ # For a library or package, you might want to ignore these files since the code is
87
+ # intended to run in multiple environments; otherwise, check them in:
88
+ # .python-version
89
+
90
+ # pipenv
91
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
92
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
93
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
94
+ # install all needed dependencies.
95
+ #Pipfile.lock
96
+
97
+ # UV
98
+ # Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
99
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
100
+ # commonly ignored for libraries.
101
+ #uv.lock
102
+
103
+ # poetry
104
+ # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
105
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
106
+ # commonly ignored for libraries.
107
+ # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
108
+ #poetry.lock
109
+
110
+ # pdm
111
+ # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
112
+ #pdm.lock
113
+ # pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
114
+ # in version control.
115
+ # https://pdm.fming.dev/latest/usage/project/#working-with-version-control
116
+ .pdm.toml
117
+ .pdm-python
118
+ .pdm-build/
119
+
120
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
121
+ __pypackages__/
122
+
123
+ # Celery stuff
124
+ celerybeat-schedule
125
+ celerybeat.pid
126
+
127
+ # SageMath parsed files
128
+ *.sage.py
129
+
130
+ # Environments
131
+ .env
132
+ .venv
133
+ env/
134
+ venv/
135
+ ENV/
136
+ env.bak/
137
+ venv.bak/
138
+
139
+ # Spyder project settings
140
+ .spyderproject
141
+ .spyproject
142
+
143
+ # Rope project settings
144
+ .ropeproject
145
+
146
+ # mkdocs documentation
147
+ /site
148
+
149
+ # mypy
150
+ .mypy_cache/
151
+ .dmypy.json
152
+ dmypy.json
153
+
154
+ # Pyre type checker
155
+ .pyre/
156
+
157
+ # pytype static type analyzer
158
+ .pytype/
159
+
160
+ # Cython debug symbols
161
+ cython_debug/
162
+
163
+ # PyCharm
164
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
165
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
166
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
167
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
168
+ #.idea/
169
+
170
+ # Ruff stuff:
171
+ .ruff_cache/
172
+
173
+ # PyPI configuration file
174
+ .pypirc
175
+
176
+ .vscode/
177
+
178
+ # Coverage
179
+ junit.xml
@@ -0,0 +1,36 @@
1
+ repos:
2
+ # Format code using Black (PEP8-compliant, compatible with Python 3.9+)
3
+ - repo: https://github.com/psf/black
4
+ rev: 23.11.0
5
+ hooks:
6
+ - id: black
7
+
8
+ # Lint and auto-fix style using Ruff (Python 3.9 compatible)
9
+ - repo: https://github.com/astral-sh/ruff-pre-commit
10
+ rev: v0.4.4 # Latest stable release, compatible with Python 3.9
11
+ hooks:
12
+ - id: ruff
13
+ args: [--fix]
14
+
15
+ # Perform static type checking with mypy using Python 3.9 environment
16
+ - repo: https://github.com/pre-commit/mirrors-mypy
17
+ rev: v1.15.0
18
+ hooks:
19
+ - id: mypy
20
+ language: system # Ensure it uses Python 3.9 (activate venv or set PATH)
21
+ args:
22
+ [
23
+ "--config-file=pyproject.toml",
24
+ "--install-types",
25
+ "--non-interactive"
26
+ ]
27
+
28
+ # Run security checks using Bandit, focused on src/ directory (exclude tests/)
29
+ - repo: https://github.com/PyCQA/bandit
30
+ rev: 1.7.7 # Compatible with Python 3.9+
31
+ hooks:
32
+ - id: bandit
33
+ language: python
34
+ name: bandit-src-only
35
+ entry: bandit -r src/ -x tests/
36
+ pass_filenames: false # Don't pass file names individually (analyze whole dir)
@@ -0,0 +1,27 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
6
+ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
7
+
8
+ <!-- insertion marker -->
9
+ ## [v0.4.0](https://github.com/yeongseon/azure-functions-openapi/releases/tag/v0.4.0) - 2025-05-13
10
+
11
+ <small>[Compare with v0.3.0](https://github.com/yeongseon/azure-functions-openapi/compare/v0.3.0...v0.4.0)</small>
12
+
13
+ ### Fixed
14
+
15
+ - fix: move isort settings under lint section in pyproject.toml ([90d2cf3](https://github.com/yeongseon/azure-functions-openapi/commit/90d2cf324673f0d3d758a8aa1aaeb4d8ba375077) by Yeongseon Choe).
16
+ - fix(example): resolve double /api prefix and update route in spec ([daa54de](https://github.com/yeongseon/azure-functions-openapi/commit/daa54de05bd1680c1be8411b152fc2b4ebcece5c) by Yeongseon Choe).
17
+ - fix(openapi): avoid requestBody for GET methods ([2f6b8f6](https://github.com/yeongseon/azure-functions-openapi/commit/2f6b8f63b8c17e9cb4cd0dcfdd90c74394f7bfde) by Yeongseon Choe).
18
+ - fix: add type hints and support Pydantic v2, clean test/lint output ([cf7e8b3](https://github.com/yeongseon/azure-functions-openapi/commit/cf7e8b3f5a418ff765077d014424ca36af039bd0) by Yeongseon Choe).
19
+
20
+ ## [v0.3.0](https://github.com/yeongseon/azure-functions-openapi/releases/tag/v0.3.0) - 2025-05-07
21
+
22
+ <small>[Compare with v0.2.0](https://github.com/yeongseon/azure-functions-openapi/compare/v0.2.0...v0.3.0)</small>
23
+
24
+ ## [v0.2.0](https://github.com/yeongseon/azure-functions-openapi/releases/tag/v0.2.0) - 2025-05-03
25
+
26
+ <small>[Compare with first commit](https://github.com/yeongseon/azure-functions-openapi/compare/ff19e445109dada7de213bc92f2765e154878050...v0.2.0)</small>
27
+
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Yeongseon Choe
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,104 @@
1
+ # ------------------------
2
+ # Path variables
3
+ # ------------------------
4
+ PYTHON ?= python3.9
5
+ VENV_DIR = .venv
6
+ UV = $(VENV_DIR)/bin/uv
7
+ PIP = $(VENV_DIR)/bin/pip
8
+ PYTHON_BIN = $(VENV_DIR)/bin/python
9
+
10
+ # ------------------------
11
+ # Help
12
+ # ------------------------
13
+ help: ## Show this help.
14
+ @grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}'
15
+
16
+ # ------------------------
17
+ # Setup
18
+ # ------------------------
19
+ install: ## Set up the virtual environment and install development dependencies
20
+ $(PYTHON) -m venv $(VENV_DIR)
21
+ $(PIP) install uv
22
+ $(UV) pip install --link-mode=copy -e ".[dev]"
23
+
24
+ # ------------------------
25
+ # Quality Checks
26
+ # ------------------------
27
+ format: ## Format code using black
28
+ $(VENV_DIR)/bin/black src/ tests/
29
+
30
+ lint: ## Lint using ruff
31
+ $(VENV_DIR)/bin/ruff check src/ tests/
32
+
33
+ typecheck: ## Static type checking using mypy
34
+ $(VENV_DIR)/bin/mypy src/
35
+
36
+ test: ## Run tests using pytest
37
+ PYTHONPATH=$(PWD) $(VENV_DIR)/bin/pytest -v tests/
38
+
39
+ check: format lint typecheck coverage precommit-run ## Run all quality checks including test coverage
40
+
41
+ # ------------------------
42
+ # Cleaning
43
+ # ------------------------
44
+ clean: ## Remove caches and build artifacts
45
+ rm -rf __pycache__/ *.egg-info .mypy_cache .pytest_cache dist build
46
+
47
+ # ------------------------
48
+ # Build
49
+ # ------------------------
50
+ dist: ## Build source and wheel distributions
51
+ $(VENV_DIR)/bin/hatch build
52
+
53
+ # ------------------------
54
+ # Versioning
55
+ # ------------------------
56
+ version-patch: ## Bump patch version
57
+ $(VENV_DIR)/bin/hatch version patch
58
+
59
+ version-minor: ## Bump minor version
60
+ $(VENV_DIR)/bin/hatch version minor
61
+
62
+ version-major: ## Bump major version
63
+ $(VENV_DIR)/bin/hatch version major
64
+
65
+ # ------------------------
66
+ # Release automation
67
+ # ------------------------
68
+ release-patch: version-patch git-release ## Patch version bump and release (commit + tag + push)
69
+ release-minor: version-minor git-release ## Minor version bump and release
70
+ release-major: version-major git-release ## Major version bump and release
71
+
72
+ git-release: ## Commit, tag, and push the release
73
+ git add .
74
+ git commit -m "chore: release v$(shell grep -oP '__version__ = \"\K[^\"]+' src/azure_functions_openapi/__init__.py)"
75
+ git tag v$(shell grep -oP '__version__ = \"\K[^\"]+' src/azure_functions_openapi/__init__.py)
76
+ git push origin main --tags
77
+
78
+ # ------------------------
79
+ # Pre-commit
80
+ # ------------------------
81
+ precommit-install: ## Install pre-commit hooks
82
+ $(VENV_DIR)/bin/pre-commit install
83
+
84
+ precommit-run: ## Run all pre-commit hooks on all files
85
+ $(VENV_DIR)/bin/pre-commit run --all-files
86
+
87
+ # ------------------------
88
+ # Changelog
89
+ # ------------------------
90
+ changelog: ## Generate CHANGELOG.md from git tags
91
+ $(VENV_DIR)/bin/git-changelog --output CHANGELOG.md --template keepachangelog
92
+
93
+ # ------------------------
94
+ # Test coverage
95
+ # ------------------------
96
+ coverage: ## Run tests with coverage report (text and XML + JUnit)
97
+ PYTHONPATH=$(PWD) $(VENV_DIR)/bin/pytest \
98
+ --cov=src/azure_functions_openapi \
99
+ --cov-report=term-missing \
100
+ --cov-report=xml \
101
+ --junitxml=junit.xml -o junit_family=legacy
102
+
103
+ coverage-html: ## Run tests with coverage and generate HTML report
104
+ PYTHONPATH=$(PWD) $(VENV_DIR)/bin/pytest --cov=src/azure_functions_openapi --cov-report=html