Skip to content

Nexify class

Here's the reference information for the Nexify class, with all its parameters, attributes and methods.

You can import the Nexify class directly from nexify:

from nexify import Nexify

nexify.Nexify

Nexify(
    *,
    debug=False,
    title="Nexify API",
    dependencies=None,
    summary=None,
    description="",
    version="0.1.0",
    openapi_tags=None,
    servers=None,
    exception_handlers=None,
    terms_of_service=None,
    contact=None,
    license_info=None,
    root_path="",
    deprecated=None,
    api_gateway_type="rest",
    middlewares=None,
)
PARAMETER DESCRIPTION
debug

Boolean indicating if debug tracebacks should be returned on server errors.

TYPE: bool DEFAULT: False

title

The title of the API.

It will be added to the generated OpenAPI. ```

TYPE: str DEFAULT: 'Nexify API'

dependencies

A list of dependencies (using Depends()) to be applied

TYPE: Sequence[Depends] | None DEFAULT: None

summary

A short summary of the API.

It will be added to the generated OpenAPI.

TYPE: str | None DEFAULT: None

description

A description of the API. Supports Markdown (using CommonMark syntax).

It will be added to the generated OpenAPI.

TYPE: str DEFAULT: ''

version

The version of the API.

Note This is the version of your application, not the version of the OpenAPI specification nor the version of Nexify being used.

It will be added to the generated OpenAPI. ```

TYPE: str DEFAULT: '0.1.0'

openapi_tags

A list of tags used by OpenAPI, these are the same tags you can set in the path operations, like:

  • @app.get("/users/", tags=["users"])
  • @app.get("/items/", tags=["items"])

The order of the tags can be used to specify the order shown in tools like Swagger UI, used in the automatic path /docs.

It's not required to specify all the tags used.

The tags that are not declared MAY be organized randomly or based on the tools' logic. Each tag name in the list MUST be unique.

The value of each item is a dict containing:

  • name: The name of the tag.
  • description: A short description of the tag. CommonMark syntax MAY be used for rich text representation.
  • externalDocs: Additional external documentation for this tag. If provided, it would contain a dict with:
    • description: A short description of the target documentation. CommonMark syntax MAY be used for rich text representation.
    • url: The URL for the target documentation. Value MUST be in the form of a URL.

Example

```python tags_metadata = [ { "name": "users", "description": "Operations with users. The login logic is also here.", }, { "name": "items", "description": "Manage items. So fancy they have their own docs.", "externalDocs": { "description": "Items external docs", "url": "https://nexify.junah.dev/", }, }, ]

TYPE: list[dict[str, Any]] | None DEFAULT: None

servers

A list of dicts with connectivity information to a target server.

You would use it, for example, if your application is served from different domains and you want to use the same Swagger UI in the browser to interact with each of them (instead of having multiple browser tabs open). Or if you want to leave fixed the possible URLs.

If the servers list is not provided, or is an empty list, the default value would be a dict with a url value of /.

Each item in the list is a dict containing:

  • url: A URL to the target host. This URL supports Server Variables and MAY be relative, to indicate that the host location is relative to the location where the OpenAPI document is being served. Variable substitutions will be made when a variable is named in {brackets}.
  • description: An optional string describing the host designated by the URL. CommonMark syntax MAY be used for rich text representation.
  • variables: A dict between a variable name and its value. The value is used for substitution in the server's URL template.

Example

servers=[
    {"url": "https://stag.example.com", "description": "Staging environment"},
    {"url": "https://prod.example.com", "description": "Production environment"},
]

TYPE: list[dict[str, str | Any]] | None DEFAULT: None

exception_handlers

A dictionary with handlers for exceptions.

TYPE: dict[type[Exception], ExceptionHandler] | None DEFAULT: None

terms_of_service

A URL to the Terms of Service for your API.

It will be added to the generated OpenAPI.

Example

app = Nexify(terms_of_service="http://example.com/terms")

TYPE: str | None DEFAULT: None

contact

A dictionary with the contact information for the exposed API.

It can contain several fields.

  • name: (str) The name of the contact person/organization.
  • url: (str) A URL pointing to the contact information. MUST be in the format of a URL.
  • email: (str) The email address of the contact person/organization. MUST be in the format of an email address.

It will be added to the generated OpenAPI.

Example

app = Nexify(
    contact={
        "name": "Deadpoolio the Amazing",
        "url": "http://x-force.example.com/contact/",
        "email": "dp@x-force.example.com",
    }
)

TYPE: dict[str, str | Any] | None DEFAULT: None

license_info

A dictionary with the license information for the exposed API.

It can contain several fields.

  • name: (str) REQUIRED (if a license_info is set). The license name used for the API.
  • identifier: (str) An SPDX license expression for the API. The identifier field is mutually exclusive of the url field. Available since OpenAPI 3.1.0.
  • url: (str) A URL to the license used for the API. This MUST be the format of a URL.

It will be added to the generated OpenAPI.

Example

from nexify import Nexify

app = Nexify(
    license_info={
        "name": "Apache 2.0",
        "url": "https://www.apache.org/licenses/LICENSE-2.0.html",
    }
)

TYPE: dict[str, str | Any] | None DEFAULT: None

root_path

A path prefix handled by a proxy that is not seen by the application but is seen by external clients, which affects things like Swagger UI.

Example

from nexify import Nexify

app = Nexify(root_path="/api/v1")

TYPE: str DEFAULT: ''

deprecated

Mark all path operations as deprecated. You probably don't need it, but it's available.

It will be added to the generated OpenAPI.

TYPE: bool | None DEFAULT: None

api_gateway_type

The type of API Gateway to be used. It can be either rest or http.

  • rest: A REST API Gateway.
  • http: An HTTP API Gateway.

Example

app = Nexify(api_gateway_type="rest")

TYPE: Literal['rest', 'http'] DEFAULT: 'rest'

middlewares

A list of middlewares to be applied to this path operation.

TYPE: list[Middleware] | None DEFAULT: None

Source code in nexify/applications.py
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
def __init__(
    self,
    *,
    debug: Annotated[
        bool,
        Doc(
            """
            Boolean indicating if debug tracebacks should be returned on server
            errors.
            """
        ),
    ] = False,
    title: Annotated[
        str,
        Doc(
            """
            The title of the API.

            It will be added to the generated OpenAPI.
            ```
            """
        ),
    ] = "Nexify API",
    dependencies: Annotated[
        Sequence[params.Depends] | None,
        Doc(
            """
            A list of dependencies (using `Depends()`) to be applied
            """
        ),
    ] = None,
    summary: Annotated[
        str | None,
        Doc(
            """
            A short summary of the API.

            It will be added to the generated OpenAPI.
            """
        ),
    ] = None,
    description: Annotated[
        str,
        Doc(
            """
            A description of the API. Supports Markdown (using
            [CommonMark syntax](https://commonmark.org/)).

            It will be added to the generated OpenAPI.
            """
        ),
    ] = "",
    version: Annotated[
        str,
        Doc(
            """
            The version of the API.

            **Note** This is the version of your application, not the version of
            the OpenAPI specification nor the version of Nexify being used.

            It will be added to the generated OpenAPI.
            ```
            """
        ),
    ] = "0.1.0",
    openapi_tags: Annotated[
        list[dict[str, Any]] | None,
        # TODO: Fix the following docstring
        Doc(
            """
            A list of tags used by OpenAPI, these are the same `tags` you can set
            in the *path operations*, like:

            * `@app.get("/users/", tags=["users"])`
            * `@app.get("/items/", tags=["items"])`

            The order of the tags can be used to specify the order shown in
            tools like Swagger UI, used in the automatic path `/docs`.

            It's not required to specify all the tags used.

            The tags that are not declared MAY be organized randomly or based
            on the tools' logic. Each tag name in the list MUST be unique.

            The value of each item is a `dict` containing:

            * `name`: The name of the tag.
            * `description`: A short description of the tag.
                [CommonMark syntax](https://commonmark.org/) MAY be used for rich
                text representation.
            * `externalDocs`: Additional external documentation for this tag. If
                provided, it would contain a `dict` with:
                * `description`: A short description of the target documentation.
                    [CommonMark syntax](https://commonmark.org/) MAY be used for
                    rich text representation.
                * `url`: The URL for the target documentation. Value MUST be in
                    the form of a URL.

            **Example**

            ```python
            tags_metadata = [
                {
                    "name": "users",
                    "description": "Operations with users. The **login** logic is also here.",
                },
                {
                    "name": "items",
                    "description": "Manage items. So _fancy_ they have their own docs.",
                    "externalDocs": {
                        "description": "Items external docs",
                        "url": "https://nexify.junah.dev/",
                    },
                },
            ]
            """
        ),
    ] = None,
    servers: Annotated[
        list[dict[str, str | Any]] | None,
        Doc(
            """
            A `list` of `dict`s with connectivity information to a target server.

            You would use it, for example, if your application is served from
            different domains and you want to use the same Swagger UI in the
            browser to interact with each of them (instead of having multiple
            browser tabs open). Or if you want to leave fixed the possible URLs.

            If the servers `list` is not provided, or is an empty `list`, the
            default value would be a `dict` with a `url` value of `/`.

            Each item in the `list` is a `dict` containing:

            * `url`: A URL to the target host. This URL supports Server Variables
            and MAY be relative, to indicate that the host location is relative
            to the location where the OpenAPI document is being served. Variable
            substitutions will be made when a variable is named in `{`brackets`}`.
            * `description`: An optional string describing the host designated by
            the URL. [CommonMark syntax](https://commonmark.org/) MAY be used for
            rich text representation.
            * `variables`: A `dict` between a variable name and its value. The value
                is used for substitution in the server's URL template.

            **Example**

            ```python
            servers=[
                {"url": "https://stag.example.com", "description": "Staging environment"},
                {"url": "https://prod.example.com", "description": "Production environment"},
            ]
            ```
            """
        ),
    ] = None,
    exception_handlers: Annotated[
        dict[type[Exception], ExceptionHandler] | None,
        Doc(
            """
            A dictionary with handlers for exceptions.
            """
        ),
    ] = None,
    terms_of_service: Annotated[
        str | None,
        Doc(
            """
            A URL to the Terms of Service for your API.

            It will be added to the generated OpenAPI.

            **Example**

            ```python
            app = Nexify(terms_of_service="http://example.com/terms")
            ```
            """
        ),
    ] = None,
    contact: Annotated[
        dict[str, str | Any] | None,
        Doc(
            """
            A dictionary with the contact information for the exposed API.

            It can contain several fields.

            * `name`: (`str`) The name of the contact person/organization.
            * `url`: (`str`) A URL pointing to the contact information. MUST be in
                the format of a URL.
            * `email`: (`str`) The email address of the contact person/organization.
                MUST be in the format of an email address.

            It will be added to the generated OpenAPI.

            **Example**

            ```python
            app = Nexify(
                contact={
                    "name": "Deadpoolio the Amazing",
                    "url": "http://x-force.example.com/contact/",
                    "email": "dp@x-force.example.com",
                }
            )
            ```
            """
        ),
    ] = None,
    license_info: Annotated[
        dict[str, str | Any] | None,
        Doc(
            """
            A dictionary with the license information for the exposed API.

            It can contain several fields.

            * `name`: (`str`) **REQUIRED** (if a `license_info` is set). The
                license name used for the API.
            * `identifier`: (`str`) An [SPDX](https://spdx.dev/) license expression
                for the API. The `identifier` field is mutually exclusive of the `url`
                field. Available since OpenAPI 3.1.0.
            * `url`: (`str`) A URL to the license used for the API. This MUST be
                the format of a URL.

            It will be added to the generated OpenAPI.

            **Example**

            ```python
            from nexify import Nexify

            app = Nexify(
                license_info={
                    "name": "Apache 2.0",
                    "url": "https://www.apache.org/licenses/LICENSE-2.0.html",
                }
            )
            ```
            """
        ),
    ] = None,
    root_path: Annotated[
        str,
        Doc(
            """
            A path prefix handled by a proxy that is not seen by the application
            but is seen by external clients, which affects things like Swagger UI.

            **Example**

            ```python
            from nexify import Nexify

            app = Nexify(root_path="/api/v1")
            ```
            """
        ),
    ] = "",
    deprecated: Annotated[
        bool | None,
        Doc(
            """
            Mark all *path operations* as deprecated. You probably don't need it,
            but it's available.

            It will be added to the generated OpenAPI.
            """
        ),
    ] = None,
    api_gateway_type: Annotated[
        Literal["rest", "http"],
        Doc(
            """
            The type of API Gateway to be used. It can be either `rest` or `http`.

            * `rest`: A REST API Gateway.
            * `http`: An HTTP API Gateway.

            **Example**

            ```python
            app = Nexify(api_gateway_type="rest")
            ```
            """
        ),
    ] = "rest",
    middlewares: Annotated[
        list[Middleware] | None,
        Doc(
            """
            A list of middlewares to be applied to this *path operation*.
            """
        ),
    ] = None,
):
    self.debug = debug
    self.title = title
    self.summary = summary
    self.description = description
    self.version = version
    self.openapi_tags = openapi_tags
    self.openapi_version = "3.1.0"
    self.openapi_schema: dict[str, Any] | None = None
    self.servers = servers or []
    self.terms_of_service = terms_of_service
    self.contact = contact
    self.license_info = license_info
    self.root_path = root_path
    self.deprecated = deprecated

    self.dependencies = list(dependencies or [])
    self.middlewares = middlewares or []
    self.router = routing.APIRouter(middlewares=self.middlewares)

    self.scheduler = Scheduler()

    self.exception_handlers: dict[
        type[Exception],
        ExceptionHandler,
    ] = exception_handlers or {}
    self.exception_handlers.setdefault(HTTPException, http_exception_handler)
    self.exception_handlers.setdefault(RequestValidationError, request_validation_exception_handler)
    self.exception_handlers.setdefault(ResponseValidationError, response_validation_exception_handler)

debug instance-attribute

debug = debug

title instance-attribute

title = title

summary instance-attribute

summary = summary

description instance-attribute

description = description

version instance-attribute

version = version

openapi_tags instance-attribute

openapi_tags = openapi_tags

openapi_version instance-attribute

openapi_version = '3.1.0'

openapi_schema instance-attribute

openapi_schema = None

servers instance-attribute

servers = servers or []

terms_of_service instance-attribute

terms_of_service = terms_of_service

contact instance-attribute

contact = contact

license_info instance-attribute

license_info = license_info

root_path instance-attribute

root_path = root_path

deprecated instance-attribute

deprecated = deprecated

dependencies instance-attribute

dependencies = list(dependencies or [])

middlewares instance-attribute

middlewares = middlewares or []

router instance-attribute

router = APIRouter(middlewares=middlewares)

scheduler instance-attribute

scheduler = Scheduler()

exception_handlers instance-attribute

exception_handlers = exception_handlers or {}

get

get(
    path,
    *,
    status_code=None,
    tags=None,
    dependencies=None,
    summary=None,
    description=None,
    response_description="Successful Response",
    deprecated=None,
    operation_id=None,
    response_class=JSONResponse,
    name=None,
    openapi_extra=None,
)

Add a net path operation to the AWS REST API.

PARAMETER DESCRIPTION
path

The URL path to be used for this path operation.

For example, in http://example.com/items, the path is /items.

TYPE: str

status_code

The status code to be used for this path operation.

For example, in http://example.com/items, the status code is 200.

TYPE: int | None DEFAULT: None

tags

A list of tags to be applied to the path operation.

It will be added to the generated OpenAPI.

TYPE: list[str] | None DEFAULT: None

dependencies

A list of dependencies (using Depends()) to be applied

TYPE: Sequence[Depends] | None DEFAULT: None

summary

A summary for the path operation.

It will be added to the generated OpenAPI.

TYPE: str | None DEFAULT: None

description

A description for the path operation.

If not provided, it will be extracted automatically from the docstring of the path operation function.

It can contain Markdown.

It will be added to the generated OpenAPI.

TYPE: str | None DEFAULT: None

response_description

The description for the default response.

It will be added to the generated OpenAPI.

TYPE: str DEFAULT: 'Successful Response'

deprecated

Mark this path operation as deprecated.

It will be added to the generated OpenAPI.

TYPE: bool | None DEFAULT: None

operation_id

Custom operation ID to be used by this path operation.

By default, it is generated automatically.

If you provide a custom operation ID, you need to make sure it is unique for the whole API.

You can customize the operation ID generation with the parameter generate_unique_id_function in the Nexify class.

TYPE: str | None DEFAULT: None

response_class

Response class to be used for this path operation.

This will not be used if you return a response directly.

TYPE: type[HttpResponse] DEFAULT: JSONResponse

name

Name for this path operation. Only used internally.

TYPE: str | None DEFAULT: None

openapi_extra

Extra metadata to be included in the OpenAPI schema for this path operation.

TYPE: dict[str, Any] | None DEFAULT: None

Source code in nexify/applications.py
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
def get(
    self,
    path: Annotated[
        str,
        Doc(
            """
            The URL path to be used for this *path operation*.

            For example, in `http://example.com/items`, the path is `/items`.
            """
        ),
    ],
    *,
    status_code: Annotated[
        int | None,
        Doc(
            """
            The status code to be used for this *path operation*.

            For example, in `http://example.com/items`, the status code is `200`.
            """
        ),
    ] = None,
    tags: Annotated[
        list[str] | None,
        Doc(
            """
            A list of tags to be applied to the *path operation*.

            It will be added to the generated OpenAPI.
            """
        ),
    ] = None,
    dependencies: Annotated[
        Sequence[params.Depends] | None,
        Doc(
            """
            A list of dependencies (using `Depends()`) to be applied
            """
        ),
    ] = None,
    summary: Annotated[
        str | None,
        Doc(
            """
            A summary for the *path operation*.

            It will be added to the generated OpenAPI.
            """
        ),
    ] = None,
    description: Annotated[
        str | None,
        Doc(
            """
            A description for the *path operation*.

            If not provided, it will be extracted automatically from the docstring
            of the *path operation function*.

            It can contain Markdown.

            It will be added to the generated OpenAPI.
            """
        ),
    ] = None,
    response_description: Annotated[
        str,
        Doc(
            """
            The description for the default response.

            It will be added to the generated OpenAPI.
            """
        ),
    ] = "Successful Response",
    deprecated: Annotated[
        bool | None,
        Doc(
            """
            Mark this *path operation* as deprecated.

            It will be added to the generated OpenAPI.
            """
        ),
    ] = None,
    operation_id: Annotated[
        str | None,
        Doc(
            """
            Custom operation ID to be used by this *path operation*.

            By default, it is generated automatically.

            If you provide a custom operation ID, you need to make sure it is
            unique for the whole API.

            You can customize the
            operation ID generation with the parameter
            `generate_unique_id_function` in the `Nexify` class.
            """
        ),
    ] = None,
    response_class: Annotated[
        type[HttpResponse],
        Doc(
            """
            Response class to be used for this *path operation*.

            This will not be used if you return a response directly.
            """
        ),
    ] = JSONResponse,
    name: Annotated[
        str | None,
        Doc(
            """
            Name for this *path operation*. Only used internally.
            """
        ),
    ] = None,
    openapi_extra: Annotated[
        dict[str, Any] | None,
        Doc(
            """
            Extra metadata to be included in the OpenAPI schema for this *path
            operation*.
            """
        ),
    ] = None,
) -> Callable[[Callable], HandlerType]:
    """
    Add a net *path operation* to the AWS REST API.
    """
    return self.router.get(
        path=path,
        status_code=status_code,
        tags=tags,
        dependencies=self.dependencies + list(dependencies or []),
        summary=summary,
        description=description,
        response_description=response_description,
        deprecated=deprecated,
        operation_id=operation_id,
        response_class=response_class,
        name=name,
        openapi_extra=openapi_extra,
        exception_handlers=self.exception_handlers,
    )

put

put(
    path,
    *,
    status_code=None,
    tags=None,
    dependencies=None,
    summary=None,
    description=None,
    response_description="Successful Response",
    deprecated=None,
    operation_id=None,
    response_class=JSONResponse,
    name=None,
    openapi_extra=None,
)

Add a net path operation to the AWS REST API.

PARAMETER DESCRIPTION
path

The URL path to be used for this path operation.

For example, in http://example.com/items, the path is /items.

TYPE: str

status_code

The status code to be used for this path operation.

For example, in http://example.com/items, the status code is 200.

TYPE: int | None DEFAULT: None

tags

A list of tags to be applied to the path operation.

It will be added to the generated OpenAPI.

TYPE: list[str] | None DEFAULT: None

dependencies

A list of dependencies (using Depends()) to be applied

TYPE: Sequence[Depends] | None DEFAULT: None

summary

A summary for the path operation.

It will be added to the generated OpenAPI.

TYPE: str | None DEFAULT: None

description

A description for the path operation.

If not provided, it will be extracted automatically from the docstring of the path operation function.

It can contain Markdown.

It will be added to the generated OpenAPI.

TYPE: str | None DEFAULT: None

response_description

The description for the default response.

It will be added to the generated OpenAPI.

TYPE: str DEFAULT: 'Successful Response'

deprecated

Mark this path operation as deprecated.

It will be added to the generated OpenAPI.

TYPE: bool | None DEFAULT: None

operation_id

Custom operation ID to be used by this path operation.

By default, it is generated automatically.

If you provide a custom operation ID, you need to make sure it is unique for the whole API.

You can customize the operation ID generation with the parameter generate_unique_id_function in the Nexify class.

TYPE: str | None DEFAULT: None

response_class

Response class to be used for this path operation.

This will not be used if you return a response directly.

TYPE: type[HttpResponse] DEFAULT: JSONResponse

name

Name for this path operation. Only used internally.

TYPE: str | None DEFAULT: None

openapi_extra

Extra metadata to be included in the OpenAPI schema for this path operation.

TYPE: dict[str, Any] | None DEFAULT: None

Source code in nexify/applications.py
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
def put(
    self,
    path: Annotated[
        str,
        Doc(
            """
            The URL path to be used for this *path operation*.

            For example, in `http://example.com/items`, the path is `/items`.
            """
        ),
    ],
    *,
    status_code: Annotated[
        int | None,
        Doc(
            """
            The status code to be used for this *path operation*.

            For example, in `http://example.com/items`, the status code is `200`.
            """
        ),
    ] = None,
    tags: Annotated[
        list[str] | None,
        Doc(
            """
            A list of tags to be applied to the *path operation*.

            It will be added to the generated OpenAPI.
            """
        ),
    ] = None,
    dependencies: Annotated[
        Sequence[params.Depends] | None,
        Doc(
            """
            A list of dependencies (using `Depends()`) to be applied
            """
        ),
    ] = None,
    summary: Annotated[
        str | None,
        Doc(
            """
            A summary for the *path operation*.

            It will be added to the generated OpenAPI.
            """
        ),
    ] = None,
    description: Annotated[
        str | None,
        Doc(
            """
            A description for the *path operation*.

            If not provided, it will be extracted automatically from the docstring
            of the *path operation function*.

            It can contain Markdown.

            It will be added to the generated OpenAPI.
            """
        ),
    ] = None,
    response_description: Annotated[
        str,
        Doc(
            """
            The description for the default response.

            It will be added to the generated OpenAPI.
            """
        ),
    ] = "Successful Response",
    deprecated: Annotated[
        bool | None,
        Doc(
            """
            Mark this *path operation* as deprecated.

            It will be added to the generated OpenAPI.
            """
        ),
    ] = None,
    operation_id: Annotated[
        str | None,
        Doc(
            """
            Custom operation ID to be used by this *path operation*.

            By default, it is generated automatically.

            If you provide a custom operation ID, you need to make sure it is
            unique for the whole API.

            You can customize the
            operation ID generation with the parameter
            `generate_unique_id_function` in the `Nexify` class.
            """
        ),
    ] = None,
    response_class: Annotated[
        type[HttpResponse],
        Doc(
            """
            Response class to be used for this *path operation*.

            This will not be used if you return a response directly.
            """
        ),
    ] = JSONResponse,
    name: Annotated[
        str | None,
        Doc(
            """
            Name for this *path operation*. Only used internally.
            """
        ),
    ] = None,
    openapi_extra: Annotated[
        dict[str, Any] | None,
        Doc(
            """
            Extra metadata to be included in the OpenAPI schema for this *path
            operation*.
            """
        ),
    ] = None,
) -> Callable[[Callable], HandlerType]:
    """
    Add a net *path operation* to the AWS REST API.
    """
    return self.router.put(
        path=path,
        status_code=status_code,
        tags=tags,
        dependencies=self.dependencies + list(dependencies or []),
        summary=summary,
        description=description,
        response_description=response_description,
        deprecated=deprecated,
        operation_id=operation_id,
        response_class=response_class,
        name=name,
        openapi_extra=openapi_extra,
        exception_handlers=self.exception_handlers,
    )

post

post(
    path,
    *,
    status_code=None,
    tags=None,
    dependencies=None,
    summary=None,
    description=None,
    response_description="Successful Response",
    deprecated=None,
    operation_id=None,
    response_class=JSONResponse,
    name=None,
    openapi_extra=None,
)

Add a net path operation to the AWS REST API.

PARAMETER DESCRIPTION
path

The URL path to be used for this path operation.

For example, in http://example.com/items, the path is /items.

TYPE: str

status_code

The status code to be used for this path operation.

For example, in http://example.com/items, the status code is 200.

TYPE: int | None DEFAULT: None

tags

A list of tags to be applied to the path operation.

It will be added to the generated OpenAPI.

TYPE: list[str] | None DEFAULT: None

dependencies

A list of dependencies (using Depends()) to be applied

TYPE: Sequence[Depends] | None DEFAULT: None

summary

A summary for the path operation.

It will be added to the generated OpenAPI.

TYPE: str | None DEFAULT: None

description

A description for the path operation.

If not provided, it will be extracted automatically from the docstring of the path operation function.

It can contain Markdown.

It will be added to the generated OpenAPI.

TYPE: str | None DEFAULT: None

response_description

The description for the default response.

It will be added to the generated OpenAPI.

TYPE: str DEFAULT: 'Successful Response'

deprecated

Mark this path operation as deprecated.

It will be added to the generated OpenAPI.

TYPE: bool | None DEFAULT: None

operation_id

Custom operation ID to be used by this path operation.

By default, it is generated automatically.

If you provide a custom operation ID, you need to make sure it is unique for the whole API.

You can customize the operation ID generation with the parameter generate_unique_id_function in the Nexify class.

TYPE: str | None DEFAULT: None

response_class

Response class to be used for this path operation.

This will not be used if you return a response directly.

TYPE: type[HttpResponse] DEFAULT: JSONResponse

name

Name for this path operation. Only used internally.

TYPE: str | None DEFAULT: None

openapi_extra

Extra metadata to be included in the OpenAPI schema for this path operation.

TYPE: dict[str, Any] | None DEFAULT: None

Source code in nexify/applications.py
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
def post(
    self,
    path: Annotated[
        str,
        Doc(
            """
            The URL path to be used for this *path operation*.

            For example, in `http://example.com/items`, the path is `/items`.
            """
        ),
    ],
    *,
    status_code: Annotated[
        int | None,
        Doc(
            """
            The status code to be used for this *path operation*.

            For example, in `http://example.com/items`, the status code is `200`.
            """
        ),
    ] = None,
    tags: Annotated[
        list[str] | None,
        Doc(
            """
            A list of tags to be applied to the *path operation*.

            It will be added to the generated OpenAPI.
            """
        ),
    ] = None,
    dependencies: Annotated[
        Sequence[params.Depends] | None,
        Doc(
            """
            A list of dependencies (using `Depends()`) to be applied
            """
        ),
    ] = None,
    summary: Annotated[
        str | None,
        Doc(
            """
            A summary for the *path operation*.

            It will be added to the generated OpenAPI.
            """
        ),
    ] = None,
    description: Annotated[
        str | None,
        Doc(
            """
            A description for the *path operation*.

            If not provided, it will be extracted automatically from the docstring
            of the *path operation function*.

            It can contain Markdown.

            It will be added to the generated OpenAPI.
            """
        ),
    ] = None,
    response_description: Annotated[
        str,
        Doc(
            """
            The description for the default response.

            It will be added to the generated OpenAPI.
            """
        ),
    ] = "Successful Response",
    deprecated: Annotated[
        bool | None,
        Doc(
            """
            Mark this *path operation* as deprecated.

            It will be added to the generated OpenAPI.
            """
        ),
    ] = None,
    operation_id: Annotated[
        str | None,
        Doc(
            """
            Custom operation ID to be used by this *path operation*.

            By default, it is generated automatically.

            If you provide a custom operation ID, you need to make sure it is
            unique for the whole API.

            You can customize the
            operation ID generation with the parameter
            `generate_unique_id_function` in the `Nexify` class.
            """
        ),
    ] = None,
    response_class: Annotated[
        type[HttpResponse],
        Doc(
            """
            Response class to be used for this *path operation*.

            This will not be used if you return a response directly.
            """
        ),
    ] = JSONResponse,
    name: Annotated[
        str | None,
        Doc(
            """
            Name for this *path operation*. Only used internally.
            """
        ),
    ] = None,
    openapi_extra: Annotated[
        dict[str, Any] | None,
        Doc(
            """
            Extra metadata to be included in the OpenAPI schema for this *path
            operation*.
            """
        ),
    ] = None,
) -> Callable[[Callable], HandlerType]:
    """
    Add a net *path operation* to the AWS REST API.
    """
    return self.router.post(
        path=path,
        status_code=status_code,
        tags=tags,
        dependencies=self.dependencies + list(dependencies or []),
        summary=summary,
        description=description,
        response_description=response_description,
        deprecated=deprecated,
        operation_id=operation_id,
        response_class=response_class,
        name=name,
        openapi_extra=openapi_extra,
        exception_handlers=self.exception_handlers,
    )

delete

delete(
    path,
    *,
    status_code=None,
    tags=None,
    dependencies=None,
    summary=None,
    description=None,
    response_description="Successful Response",
    deprecated=None,
    operation_id=None,
    response_class=JSONResponse,
    name=None,
    openapi_extra=None,
)

Add a net path operation to the AWS REST API.

PARAMETER DESCRIPTION
path

The URL path to be used for this path operation.

For example, in http://example.com/items, the path is /items.

TYPE: str

status_code

The status code to be used for this path operation.

For example, in http://example.com/items, the status code is 200.

TYPE: int | None DEFAULT: None

tags

A list of tags to be applied to the path operation.

It will be added to the generated OpenAPI.

TYPE: list[str] | None DEFAULT: None

dependencies

A list of dependencies (using Depends()) to be applied

TYPE: Sequence[Depends] | None DEFAULT: None

summary

A summary for the path operation.

It will be added to the generated OpenAPI.

TYPE: str | None DEFAULT: None

description

A description for the path operation.

If not provided, it will be extracted automatically from the docstring of the path operation function.

It can contain Markdown.

It will be added to the generated OpenAPI.

TYPE: str | None DEFAULT: None

response_description

The description for the default response.

It will be added to the generated OpenAPI.

TYPE: str DEFAULT: 'Successful Response'

deprecated

Mark this path operation as deprecated.

It will be added to the generated OpenAPI.

TYPE: bool | None DEFAULT: None

operation_id

Custom operation ID to be used by this path operation.

By default, it is generated automatically.

If you provide a custom operation ID, you need to make sure it is unique for the whole API.

You can customize the operation ID generation with the parameter generate_unique_id_function in the Nexify class.

TYPE: str | None DEFAULT: None

response_class

Response class to be used for this path operation.

This will not be used if you return a response directly.

TYPE: type[HttpResponse] DEFAULT: JSONResponse

name

Name for this path operation. Only used internally.

TYPE: str | None DEFAULT: None

openapi_extra

Extra metadata to be included in the OpenAPI schema for this path operation.

TYPE: dict[str, Any] | None DEFAULT: None

Source code in nexify/applications.py
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
def delete(
    self,
    path: Annotated[
        str,
        Doc(
            """
            The URL path to be used for this *path operation*.

            For example, in `http://example.com/items`, the path is `/items`.
            """
        ),
    ],
    *,
    status_code: Annotated[
        int | None,
        Doc(
            """
            The status code to be used for this *path operation*.

            For example, in `http://example.com/items`, the status code is `200`.
            """
        ),
    ] = None,
    tags: Annotated[
        list[str] | None,
        Doc(
            """
            A list of tags to be applied to the *path operation*.

            It will be added to the generated OpenAPI.
            """
        ),
    ] = None,
    dependencies: Annotated[
        Sequence[params.Depends] | None,
        Doc(
            """
            A list of dependencies (using `Depends()`) to be applied
            """
        ),
    ] = None,
    summary: Annotated[
        str | None,
        Doc(
            """
            A summary for the *path operation*.

            It will be added to the generated OpenAPI.
            """
        ),
    ] = None,
    description: Annotated[
        str | None,
        Doc(
            """
            A description for the *path operation*.

            If not provided, it will be extracted automatically from the docstring
            of the *path operation function*.

            It can contain Markdown.

            It will be added to the generated OpenAPI.
            """
        ),
    ] = None,
    response_description: Annotated[
        str,
        Doc(
            """
            The description for the default response.

            It will be added to the generated OpenAPI.
            """
        ),
    ] = "Successful Response",
    deprecated: Annotated[
        bool | None,
        Doc(
            """
            Mark this *path operation* as deprecated.

            It will be added to the generated OpenAPI.
            """
        ),
    ] = None,
    operation_id: Annotated[
        str | None,
        Doc(
            """
            Custom operation ID to be used by this *path operation*.

            By default, it is generated automatically.

            If you provide a custom operation ID, you need to make sure it is
            unique for the whole API.

            You can customize the
            operation ID generation with the parameter
            `generate_unique_id_function` in the `Nexify` class.
            """
        ),
    ] = None,
    response_class: Annotated[
        type[HttpResponse],
        Doc(
            """
            Response class to be used for this *path operation*.

            This will not be used if you return a response directly.
            """
        ),
    ] = JSONResponse,
    name: Annotated[
        str | None,
        Doc(
            """
            Name for this *path operation*. Only used internally.
            """
        ),
    ] = None,
    openapi_extra: Annotated[
        dict[str, Any] | None,
        Doc(
            """
            Extra metadata to be included in the OpenAPI schema for this *path
            operation*.
            """
        ),
    ] = None,
) -> Callable[[Callable], HandlerType]:
    """
    Add a net *path operation* to the AWS REST API.
    """
    return self.router.delete(
        path=path,
        status_code=status_code,
        tags=tags,
        dependencies=self.dependencies + list(dependencies or []),
        summary=summary,
        description=description,
        response_description=response_description,
        deprecated=deprecated,
        operation_id=operation_id,
        response_class=response_class,
        name=name,
        openapi_extra=openapi_extra,
        exception_handlers=self.exception_handlers,
    )

options

options(
    path,
    *,
    status_code=None,
    tags=None,
    dependencies=None,
    summary=None,
    description=None,
    response_description="Successful Response",
    deprecated=None,
    operation_id=None,
    response_class=JSONResponse,
    name=None,
    openapi_extra=None,
)

Add a net path operation to the AWS REST API.

PARAMETER DESCRIPTION
path

The URL path to be used for this path operation.

For example, in http://example.com/items, the path is /items.

TYPE: str

status_code

The status code to be used for this path operation.

For example, in http://example.com/items, the status code is 200.

TYPE: int | None DEFAULT: None

tags

A list of tags to be applied to the path operation.

It will be added to the generated OpenAPI.

TYPE: list[str] | None DEFAULT: None

dependencies

A list of dependencies (using Depends()) to be applied

TYPE: Sequence[Depends] | None DEFAULT: None

summary

A summary for the path operation.

It will be added to the generated OpenAPI.

TYPE: str | None DEFAULT: None

description

A description for the path operation.

If not provided, it will be extracted automatically from the docstring of the path operation function.

It can contain Markdown.

It will be added to the generated OpenAPI.

TYPE: str | None DEFAULT: None

response_description

The description for the default response.

It will be added to the generated OpenAPI.

TYPE: str DEFAULT: 'Successful Response'

deprecated

Mark this path operation as deprecated.

It will be added to the generated OpenAPI.

TYPE: bool | None DEFAULT: None

operation_id

Custom operation ID to be used by this path operation.

By default, it is generated automatically.

If you provide a custom operation ID, you need to make sure it is unique for the whole API.

You can customize the operation ID generation with the parameter generate_unique_id_function in the Nexify class.

TYPE: str | None DEFAULT: None

response_class

Response class to be used for this path operation.

This will not be used if you return a response directly.

TYPE: type[HttpResponse] DEFAULT: JSONResponse

name

Name for this path operation. Only used internally.

TYPE: str | None DEFAULT: None

openapi_extra

Extra metadata to be included in the OpenAPI schema for this path operation.

TYPE: dict[str, Any] | None DEFAULT: None

Source code in nexify/applications.py
 951
 952
 953
 954
 955
 956
 957
 958
 959
 960
 961
 962
 963
 964
 965
 966
 967
 968
 969
 970
 971
 972
 973
 974
 975
 976
 977
 978
 979
 980
 981
 982
 983
 984
 985
 986
 987
 988
 989
 990
 991
 992
 993
 994
 995
 996
 997
 998
 999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
def options(
    self,
    path: Annotated[
        str,
        Doc(
            """
            The URL path to be used for this *path operation*.

            For example, in `http://example.com/items`, the path is `/items`.
            """
        ),
    ],
    *,
    status_code: Annotated[
        int | None,
        Doc(
            """
            The status code to be used for this *path operation*.

            For example, in `http://example.com/items`, the status code is `200`.
            """
        ),
    ] = None,
    tags: Annotated[
        list[str] | None,
        Doc(
            """
            A list of tags to be applied to the *path operation*.

            It will be added to the generated OpenAPI.
            """
        ),
    ] = None,
    dependencies: Annotated[
        Sequence[params.Depends] | None,
        Doc(
            """
            A list of dependencies (using `Depends()`) to be applied
            """
        ),
    ] = None,
    summary: Annotated[
        str | None,
        Doc(
            """
            A summary for the *path operation*.

            It will be added to the generated OpenAPI.
            """
        ),
    ] = None,
    description: Annotated[
        str | None,
        Doc(
            """
            A description for the *path operation*.

            If not provided, it will be extracted automatically from the docstring
            of the *path operation function*.

            It can contain Markdown.

            It will be added to the generated OpenAPI.
            """
        ),
    ] = None,
    response_description: Annotated[
        str,
        Doc(
            """
            The description for the default response.

            It will be added to the generated OpenAPI.
            """
        ),
    ] = "Successful Response",
    deprecated: Annotated[
        bool | None,
        Doc(
            """
            Mark this *path operation* as deprecated.

            It will be added to the generated OpenAPI.
            """
        ),
    ] = None,
    operation_id: Annotated[
        str | None,
        Doc(
            """
            Custom operation ID to be used by this *path operation*.

            By default, it is generated automatically.

            If you provide a custom operation ID, you need to make sure it is
            unique for the whole API.

            You can customize the
            operation ID generation with the parameter
            `generate_unique_id_function` in the `Nexify` class.
            """
        ),
    ] = None,
    response_class: Annotated[
        type[HttpResponse],
        Doc(
            """
            Response class to be used for this *path operation*.

            This will not be used if you return a response directly.
            """
        ),
    ] = JSONResponse,
    name: Annotated[
        str | None,
        Doc(
            """
            Name for this *path operation*. Only used internally.
            """
        ),
    ] = None,
    openapi_extra: Annotated[
        dict[str, Any] | None,
        Doc(
            """
            Extra metadata to be included in the OpenAPI schema for this *path
            operation*.
            """
        ),
    ] = None,
) -> Callable[[Callable], HandlerType]:
    """
    Add a net *path operation* to the AWS REST API.
    """
    return self.router.options(
        path=path,
        status_code=status_code,
        tags=tags,
        dependencies=self.dependencies + list(dependencies or []),
        summary=summary,
        description=description,
        response_description=response_description,
        deprecated=deprecated,
        operation_id=operation_id,
        response_class=response_class,
        name=name,
        openapi_extra=openapi_extra,
        exception_handlers=self.exception_handlers,
    )

head

head(
    path,
    *,
    status_code=None,
    tags=None,
    dependencies=None,
    summary=None,
    description=None,
    response_description="Successful Response",
    deprecated=None,
    operation_id=None,
    response_class=JSONResponse,
    name=None,
    openapi_extra=None,
)

Add a net path operation to the AWS REST API.

PARAMETER DESCRIPTION
path

The URL path to be used for this path operation.

For example, in http://example.com/items, the path is /items.

TYPE: str

status_code

The status code to be used for this path operation.

For example, in http://example.com/items, the status code is 200.

TYPE: int | None DEFAULT: None

tags

A list of tags to be applied to the path operation.

It will be added to the generated OpenAPI.

TYPE: list[str] | None DEFAULT: None

dependencies

A list of dependencies (using Depends()) to be applied

TYPE: Sequence[Depends] | None DEFAULT: None

summary

A summary for the path operation.

It will be added to the generated OpenAPI.

TYPE: str | None DEFAULT: None

description

A description for the path operation.

If not provided, it will be extracted automatically from the docstring of the path operation function.

It can contain Markdown.

It will be added to the generated OpenAPI.

TYPE: str | None DEFAULT: None

response_description

The description for the default response.

It will be added to the generated OpenAPI.

TYPE: str DEFAULT: 'Successful Response'

deprecated

Mark this path operation as deprecated.

It will be added to the generated OpenAPI.

TYPE: bool | None DEFAULT: None

operation_id

Custom operation ID to be used by this path operation.

By default, it is generated automatically.

If you provide a custom operation ID, you need to make sure it is unique for the whole API.

You can customize the operation ID generation with the parameter generate_unique_id_function in the Nexify class.

TYPE: str | None DEFAULT: None

response_class

Response class to be used for this path operation.

This will not be used if you return a response directly.

TYPE: type[HttpResponse] DEFAULT: JSONResponse

name

Name for this path operation. Only used internally.

TYPE: str | None DEFAULT: None

openapi_extra

Extra metadata to be included in the OpenAPI schema for this path operation.

TYPE: dict[str, Any] | None DEFAULT: None

Source code in nexify/applications.py
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
def head(
    self,
    path: Annotated[
        str,
        Doc(
            """
            The URL path to be used for this *path operation*.

            For example, in `http://example.com/items`, the path is `/items`.
            """
        ),
    ],
    *,
    status_code: Annotated[
        int | None,
        Doc(
            """
            The status code to be used for this *path operation*.

            For example, in `http://example.com/items`, the status code is `200`.
            """
        ),
    ] = None,
    tags: Annotated[
        list[str] | None,
        Doc(
            """
            A list of tags to be applied to the *path operation*.

            It will be added to the generated OpenAPI.
            """
        ),
    ] = None,
    dependencies: Annotated[
        Sequence[params.Depends] | None,
        Doc(
            """
            A list of dependencies (using `Depends()`) to be applied
            """
        ),
    ] = None,
    summary: Annotated[
        str | None,
        Doc(
            """
            A summary for the *path operation*.

            It will be added to the generated OpenAPI.
            """
        ),
    ] = None,
    description: Annotated[
        str | None,
        Doc(
            """
            A description for the *path operation*.

            If not provided, it will be extracted automatically from the docstring
            of the *path operation function*.

            It can contain Markdown.

            It will be added to the generated OpenAPI.
            """
        ),
    ] = None,
    response_description: Annotated[
        str,
        Doc(
            """
            The description for the default response.

            It will be added to the generated OpenAPI.
            """
        ),
    ] = "Successful Response",
    deprecated: Annotated[
        bool | None,
        Doc(
            """
            Mark this *path operation* as deprecated.

            It will be added to the generated OpenAPI.
            """
        ),
    ] = None,
    operation_id: Annotated[
        str | None,
        Doc(
            """
            Custom operation ID to be used by this *path operation*.

            By default, it is generated automatically.

            If you provide a custom operation ID, you need to make sure it is
            unique for the whole API.

            You can customize the
            operation ID generation with the parameter
            `generate_unique_id_function` in the `Nexify` class.
            """
        ),
    ] = None,
    response_class: Annotated[
        type[HttpResponse],
        Doc(
            """
            Response class to be used for this *path operation*.

            This will not be used if you return a response directly.
            """
        ),
    ] = JSONResponse,
    name: Annotated[
        str | None,
        Doc(
            """
            Name for this *path operation*. Only used internally.
            """
        ),
    ] = None,
    openapi_extra: Annotated[
        dict[str, Any] | None,
        Doc(
            """
            Extra metadata to be included in the OpenAPI schema for this *path
            operation*.
            """
        ),
    ] = None,
) -> Callable[[Callable], HandlerType]:
    """
    Add a net *path operation* to the AWS REST API.
    """
    return self.router.head(
        path=path,
        status_code=status_code,
        tags=tags,
        dependencies=self.dependencies + list(dependencies or []),
        summary=summary,
        description=description,
        response_description=response_description,
        deprecated=deprecated,
        operation_id=operation_id,
        response_class=response_class,
        name=name,
        openapi_extra=openapi_extra,
        exception_handlers=self.exception_handlers,
    )

openapi

openapi()
Source code in nexify/applications.py
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
def openapi(self) -> dict[str, Any]:
    if not self.openapi_schema:
        self.openapi_schema = get_openapi(
            title=self.title,
            version=self.version,
            openapi_version=self.openapi_version,
            summary=self.summary,
            description=self.description,
            terms_of_service=self.terms_of_service,
            contact=self.contact,
            license_info=self.license_info,
            routes=self.router.operations,
            tags=self.openapi_tags,
            servers=self.servers,
        )

    return self.openapi_schema

swagger_html

swagger_html()
Source code in nexify/applications.py
1269
1270
1271
1272
1273
def swagger_html(self) -> str:
    return get_swagger_ui_html(
        openapi_url="openapi.json",
        title=self.title,
    )

redoc_html

redoc_html()
Source code in nexify/applications.py
1275
1276
1277
1278
1279
def redoc_html(self) -> str:
    return get_swagger_ui_html(
        openapi_url="openapi.json",
        title=self.title,
    )

middleware

middleware(func)
Source code in nexify/applications.py
1281
1282
1283
1284
1285
def middleware(self, func: MiddlewareType) -> MiddlewareType:
    self.middlewares.insert(0, func)
    self.router.add_middleware(func)

    return func

add_middleware

add_middleware(middleware)
Source code in nexify/applications.py
1287
1288
1289
def add_middleware(self, middleware: MiddlewareType) -> None:
    self.middlewares.insert(0, middleware)
    self.router.add_middleware(middleware)

exception_handler

exception_handler(exception_class)
Source code in nexify/applications.py
1291
1292
1293
1294
1295
1296
def exception_handler(self, exception_class: type[Exception]):
    def decorator(func: ExceptionHandler) -> ExceptionHandler:
        self.exception_handlers[exception_class] = func
        return func

    return decorator

add_exception_handler

add_exception_handler(exception_class, handler)
Source code in nexify/applications.py
1298
1299
def add_exception_handler(self, exception_class: type[Exception], handler: ExceptionHandler) -> None:
    self.exception_handlers[exception_class] = handler

schedule

schedule(expression)
Source code in nexify/applications.py
1301
1302
1303
1304
1305
def schedule(self, expression: ScheduleExpression | list[ScheduleExpression]) -> Callable:
    if not isinstance(expression, list):
        expression = [expression]

    return self.scheduler.schedule(expressions=expression)