Skip to content

Commit f04285d

Browse files
authored
✨ Add JSON Schema for FastAPI in pyproject.toml (#5579)
1 parent 0b92cd9 commit f04285d

File tree

6 files changed

+33
-0
lines changed

6 files changed

+33
-0
lines changed

.github/CODEOWNERS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,9 @@ src/schemas/json/cargo.json @ya7010
4646
src/schemas/json/tombi.json @ya7010
4747
src/schemas/json/pyproject.json @ya7010
4848

49+
# Managed by FastAPI Team:
50+
src/schemas/json/partial-fastapi.json @tiangolo
51+
4952
# Managed by Contextive Team:
5053
src/schemas/json/contextive-glossary.json @chrissimon-au
5154
src/test/contextive-glossary/ @chrissimon-au

src/api/json/catalog.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1195,6 +1195,12 @@
11951195
"fileMatch": [],
11961196
"url": "https://raw.githubusercontent.com/SchemaStore/schemastore/master/src/schemas/json/partial-black.json"
11971197
},
1198+
{
1199+
"name": "partial-fastapi.json",
1200+
"description": "FastAPI web framework configuration for pyproject.toml",
1201+
"fileMatch": [],
1202+
"url": "https://raw.githubusercontent.com/SchemaStore/schemastore/master/src/schemas/json/partial-fastapi.json"
1203+
},
11981204
{
11991205
"name": "bozr.suite.json",
12001206
"description": "Bozr test suite file",

src/schema-validation.jsonc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -331,6 +331,7 @@
331331
"partial-setuptools-scm.json", // pyproject.json[tool.setuptools-scm]
332332
"partial-scikit-build.json", // pyproject.json[tool.scikit-build]
333333
"partial-cibuildwheel.json", // pyproject.json[tool.cibuildwheel]
334+
"partial-fastapi.json", // pyproject.json[tool.fastapi]
334335
"partial-mypy.json", // pyproject.json[tool.mypy]
335336
"partial-pdm.json", // pyproject.json[tool.pdm]
336337
"partial-pdm-dockerize.json", // pyproject.json[tool.pdm.dockerize]
@@ -1269,6 +1270,7 @@
12691270
"maturin.json",
12701271
"partial-black.json",
12711272
"partial-cibuildwheel.json",
1273+
"partial-fastapi.json",
12721274
"partial-mypy.json",
12731275
"partial-pdm.json",
12741276
"partial-pdm-dockerize.json",
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"$schema": "http://json-schema.org/draft-07/schema#",
3+
"$id": "https://json.schemastore.org/partial-fastapi.json",
4+
"type": "object",
5+
"properties": {
6+
"entrypoint": {
7+
"type": "string",
8+
"title": "Application Entrypoint",
9+
"description": "Import string entrypoint for the **FastAPI** application, in the format: \n```\nimportable.module:attribute\n```\n\nFor example, for an app like:\n\n ```python\nfrom fastapi import FastAPI\n\napp = FastAPI()\n```\n\nin a file at `backend/main.py`\n the config could look like:\n\n```toml\n[tool.fastapi]\nentrypoint = \"backend.main:app\"\n```\n\nDocs: https://fastapi.tiangolo.com/fastapi-cli/",
10+
"examples": ["main:app", "backend.main:app"]
11+
}
12+
},
13+
"additionalProperties": false
14+
}

src/schemas/json/pyproject.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -972,6 +972,11 @@
972972
"title": "Wheel Builder",
973973
"description": "Build Python wheels for all platforms."
974974
},
975+
"fastapi": {
976+
"$ref": "https://json.schemastore.org/partial-fastapi.json",
977+
"title": "Web Framework",
978+
"description": "FastAPI web framework configuration."
979+
},
975980
"mypy": {
976981
"$ref": "https://json.schemastore.org/partial-mypy.json",
977982
"title": "Static Type Checker",

src/test/pyproject/fastapi.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#:schema ../../schemas/json/pyproject.json
2+
[tool.fastapi]
3+
entrypoint = "backend.main:app"

0 commit comments

Comments
 (0)