]> git.ipfire.org Git - thirdparty/fastapi/fastapi.git/commitdiff
📝 Fix code consistency in examples for Tutorial - User Guide - Path Parameters (...
authornukopy <pytwbf201830@gmail.com>
Thu, 5 Nov 2020 22:30:09 +0000 (07:30 +0900)
committerGitHub <noreply@github.com>
Thu, 5 Nov 2020 22:30:09 +0000 (23:30 +0100)
docs/en/docs/img/tutorial/path-params/image03.png
docs_src/path_params/tutorial005.py
tests/test_tutorial/test_path_params/test_tutorial005.py

index d08645d1c8c91da4920d18ca9f190cfe85e8212f..080e9e67dcb3ddb869a5c0a181598a7a42e5dcaa 100644 (file)
Binary files a/docs/en/docs/img/tutorial/path-params/image03.png and b/docs/en/docs/img/tutorial/path-params/image03.png differ
index d14b926e5559d54b2d0c8936be169bd9074a87db..8e376774492cebcaeb6d899546acfb88256de891 100644 (file)
@@ -12,7 +12,7 @@ class ModelName(str, Enum):
 app = FastAPI()
 
 
-@app.get("/model/{model_name}")
+@app.get("/models/{model_name}")
 async def get_model(model_name: ModelName):
     if model_name == ModelName.alexnet:
         return {"model_name": model_name, "message": "Deep Learning FTW!"}
index 6e9333084f18ebadefb8ee4edb3200b1f7c2d79c..ed9d2032b3a83cf2360ec81ef4c1f5ec176ff07c 100644 (file)
@@ -9,7 +9,7 @@ openapi_schema = {
     "openapi": "3.0.2",
     "info": {"title": "FastAPI", "version": "0.1.0"},
     "paths": {
-        "/model/{model_name}": {
+        "/models/{model_name}": {
             "get": {
                 "responses": {
                     "200": {
@@ -28,7 +28,7 @@ openapi_schema = {
                     },
                 },
                 "summary": "Get Model",
-                "operationId": "get_model_model__model_name__get",
+                "operationId": "get_model_models__model_name__get",
                 "parameters": [
                     {
                         "required": True,
@@ -80,10 +80,10 @@ openapi_schema2 = {
     "openapi": "3.0.2",
     "info": {"title": "FastAPI", "version": "0.1.0"},
     "paths": {
-        "/model/{model_name}": {
+        "/models/{model_name}": {
             "get": {
                 "summary": "Get Model",
-                "operationId": "get_model_model__model_name__get",
+                "operationId": "get_model_models__model_name__get",
                 "parameters": [
                     {
                         "required": True,
@@ -160,22 +160,22 @@ def test_openapi():
     "url,status_code,expected",
     [
         (
-            "/model/alexnet",
+            "/models/alexnet",
             200,
             {"model_name": "alexnet", "message": "Deep Learning FTW!"},
         ),
         (
-            "/model/lenet",
+            "/models/lenet",
             200,
             {"model_name": "lenet", "message": "LeCNN all the images"},
         ),
         (
-            "/model/resnet",
+            "/models/resnet",
             200,
             {"model_name": "resnet", "message": "Have some residuals"},
         ),
         (
-            "/model/foo",
+            "/models/foo",
             422,
             {
                 "detail": [