@team-supercharge/oasg 13.1.2 → 13.2.0-feature-python-fastapi-3f657d88.0
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.
- package/README.md +20 -0
- package/bin/oasg +1 -0
- package/config.schema.yml +15 -0
- package/package.json +1 -1
- package/targets/python-fastapi/generate.sh +29 -0
- package/targets/python-fastapi/generator-config.json +7 -0
- package/targets/python-fastapi/publish.sh +9 -0
- package/targets/python-fastapi/templates/pyproject_toml.mustache +35 -0
package/README.md
CHANGED
@@ -656,6 +656,26 @@ TBD
|
|
656
656
|
|
657
657
|
Publishing the PyPI packages is done with Twine. For authentication againts the PiPI repository you need to set the `TWINE_USERNAME` and `TWINE_PASSWORD` environment variables.
|
658
658
|
|
659
|
+
|
660
|
+
#### `python-fastapi`
|
661
|
+
|
662
|
+
```json
|
663
|
+
{
|
664
|
+
"id": "server-python",
|
665
|
+
"type": "python-fastapi",
|
666
|
+
"source": "source-merged",
|
667
|
+
"packageName": "oasg_example",
|
668
|
+
"repositoryUrl": "https://gitlab.supercharge.io/api/v4/projects/1226/packages/pypi"
|
669
|
+
}
|
670
|
+
```
|
671
|
+
|
672
|
+
|Parameter| Description| Required | Default |
|
673
|
+
|-|-|-|-|
|
674
|
+
| packageName | Package nem for the project (convention: snake_case) | Y | - |
|
675
|
+
| repositoryUrl | URL of the PyPI repository | Y | - |
|
676
|
+
|
677
|
+
Publishing the PyPI packages is done with Twine. For authentication againts the PiPI repository you need to set the `TWINE_USERNAME` and `TWINE_PASSWORD` environment variables.
|
678
|
+
|
659
679
|
#### `contract-testing`
|
660
680
|
|
661
681
|
```json
|
package/bin/oasg
CHANGED
@@ -45,6 +45,7 @@ const DEFAULT_GENERATOR_MAPPING = {
|
|
45
45
|
"nestjs": { version: '7.0.1', generator: 'typescript-angular' },
|
46
46
|
"spring": { version: '7.0.1', generator: 'spring' },
|
47
47
|
"spring-kotlin": { version: '7.0.1', generator: 'kotlin-spring' },
|
48
|
+
"python-fastapi": { version: '7.0.1', generator: 'python-fastapi' },
|
48
49
|
// misc targets
|
49
50
|
"contract-testing": { version: '4.3.1', generator: 'typescript-node' },
|
50
51
|
"openapi": { version: undefined, generator: undefined },
|
package/config.schema.yml
CHANGED
@@ -20,6 +20,7 @@ properties:
|
|
20
20
|
- $ref: '#/targets/Android'
|
21
21
|
- $ref: '#/targets/ios'
|
22
22
|
- $ref: '#/targets/Python'
|
23
|
+
- $ref: '#/targets/PythonFastApi'
|
23
24
|
- $ref: '#/targets/ContractTesting'
|
24
25
|
- $ref: '#/targets/NestJS'
|
25
26
|
- $ref: '#/targets/OpenAPI'
|
@@ -295,6 +296,20 @@ targets:
|
|
295
296
|
- packageName
|
296
297
|
- repositoryUrl
|
297
298
|
|
299
|
+
PythonFastApi:
|
300
|
+
allOf:
|
301
|
+
- $ref: '#/targets/Base'
|
302
|
+
- properties:
|
303
|
+
type:
|
304
|
+
pattern: "^python-fastapi$"
|
305
|
+
packageName:
|
306
|
+
type: string
|
307
|
+
repositoryUrl:
|
308
|
+
type: string
|
309
|
+
required:
|
310
|
+
- packageName
|
311
|
+
- repositoryUrl
|
312
|
+
|
298
313
|
ContractTesting:
|
299
314
|
allOf:
|
300
315
|
- $ref: '#/targets/Base'
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@team-supercharge/oasg",
|
3
|
-
"version": "13.
|
3
|
+
"version": "13.2.0-feature-python-fastapi-3f657d88.0",
|
4
4
|
"description": "Node-based tool to lint OpenAPI documents and generate clients, servers and documentation from them",
|
5
5
|
"author": "Supercharge",
|
6
6
|
"license": "MIT",
|
@@ -0,0 +1,29 @@
|
|
1
|
+
#/bin/bash
|
2
|
+
|
3
|
+
source $(dirname "$0")/../common.sh
|
4
|
+
|
5
|
+
# change npm pre-release syntax (with - after semver) to python local syntax (with + after semver)
|
6
|
+
version=$(echo $version | sed 's/-/\+/')
|
7
|
+
echo "[NOTE] version updated to: ${version}"
|
8
|
+
|
9
|
+
rm -rf out/$targetId
|
10
|
+
mkdir -p out/$targetId
|
11
|
+
|
12
|
+
java -jar $binary generate \
|
13
|
+
-g $generatorId \
|
14
|
+
-i $openApiFile \
|
15
|
+
-t $templateDir \
|
16
|
+
-o out/$targetId \
|
17
|
+
-c $(dirname "$0")/generator-config.json \
|
18
|
+
-p "packageVersion=$version,packageName=$packageName" $generatorCustomArgs
|
19
|
+
|
20
|
+
cd out/$targetId
|
21
|
+
|
22
|
+
touch "src/$packageName/__init__.py"
|
23
|
+
python3 -m venv venv
|
24
|
+
source venv/bin/activate
|
25
|
+
pip install --upgrade pip
|
26
|
+
pip install flit==3.9.0
|
27
|
+
flit build --no-use-vcs
|
28
|
+
|
29
|
+
cd ../../
|
@@ -0,0 +1,35 @@
|
|
1
|
+
[project]
|
2
|
+
name = "{{packageName}}"
|
3
|
+
version = "{{appVersion}}"
|
4
|
+
description = "{{appDescription}}"
|
5
|
+
|
6
|
+
[build-system]
|
7
|
+
requires = ["setuptools", "wheel"]
|
8
|
+
build-backend = "setuptools.build_meta"
|
9
|
+
|
10
|
+
[tool.black]
|
11
|
+
line-length = 88
|
12
|
+
exclude = '''
|
13
|
+
(
|
14
|
+
/(
|
15
|
+
\.eggs # exclude a few common directories in the
|
16
|
+
| \.git # root of the project
|
17
|
+
| \.hg
|
18
|
+
| \.mypy_cache
|
19
|
+
| \.tox
|
20
|
+
| \.venv
|
21
|
+
| _build
|
22
|
+
| buck-out
|
23
|
+
| build
|
24
|
+
| dist
|
25
|
+
)/
|
26
|
+
)
|
27
|
+
'''
|
28
|
+
|
29
|
+
[tool.isort]
|
30
|
+
profile = "black"
|
31
|
+
skip = [
|
32
|
+
'.eggs', '.git', '.hg', '.mypy_cache', '.nox', '.pants.d', '.tox',
|
33
|
+
'.venv', '_build', 'buck-out', 'build', 'dist', 'node_modules', 'venv',
|
34
|
+
]
|
35
|
+
skip_gitignore = true
|