---
url: "https://vueda.dev/v3/reference/api/py/vueda.core.spectacular_hooks.md"
title: "core.spectacular_hooks"
---

# core.spectacular_hooks

## Overview

drf-spectacular preprocessing and postprocessing hooks for schema customization.

## Classes

- [ExpandParam](/v3/reference/api/py/vueda.core.spectacular_hooks/ExpandParam.md)

## `postprocess_schema_components` {#postprocess_schema_components}

Add examples, descriptions, and defaults to the generated schema components, and set summaries and
descriptions on VUEDA operations.

It also removes the expand query parameter from workflow object operations and renames the
single-object transition operation. It edits and returns ``result``.

### Signature {#postprocess_schema_components-signature}

`postprocess_schema_components(result, generator, kwargs)`

#### Parameters {#postprocess_schema_components-parameters}

| Name | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| <span id="postprocess_schema_components-param-result">result</span> |  | yes |  |  |
| <span id="postprocess_schema_components-param-generator">generator</span> |  | yes |  |  |
| <span id="postprocess_schema_components-param-kwargs">kwargs</span> |  | no |  |  |

### Source {#postprocess_schema_components-source}

`server/vueda/core/spectacular_hooks.py:75`

## `preprocessing_hooks` {#preprocessing_hooks}

Return the drf-spectacular ``endpoints`` without the ``/routes/tests/`` endpoints, and with each
workflow ``execute_transition`` route split in two.

The split gives OpenAPI a bulk path and a single-object path with a required ``object_id``. Runtime
routing is unchanged.

### Signature {#preprocessing_hooks-signature}

`preprocessing_hooks(endpoints)`

#### Parameters {#preprocessing_hooks-parameters}

| Name | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| <span id="preprocessing_hooks-param-endpoints">endpoints</span> |  | yes |  |  |

### Source {#preprocessing_hooks-source}

`server/vueda/core/spectacular_hooks.py:21`

## `register_cart_with_model_info` {#register_cart_with_model_info}

Register the test store's ``CartSerializer`` with ``vueda.info`` when ``tests.store`` is installed,
and return ``endpoints`` unchanged.

It runs as a schema preprocessing hook because registering in ``AppConfig.ready`` would query the
database.

### Signature {#register_cart_with_model_info-signature}

`register_cart_with_model_info(endpoints)`

#### Parameters {#register_cart_with_model_info-parameters}

| Name | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| <span id="register_cart_with_model_info-param-endpoints">endpoints</span> |  | yes |  |  |

### Source {#register_cart_with_model_info-source}

`server/vueda/core/spectacular_hooks.py:54`

## Source

`server/vueda/core/spectacular_hooks.py`
