Merge incoming component schemas into the spec with collision detection. If an incoming schema name already exists and the schemas differ, a warning is logged. The incoming schema always wins so that the most-recently-registered route's models are used (matching the
(self, incoming: dict)
| 359 | self.openapi_spec["paths"][modified_endpoint][route_type] = path_obj |
| 360 | |
| 361 | def _merge_component_schemas(self, incoming: dict): |
| 362 | """Merge incoming component schemas into the spec with collision detection. |
| 363 | |
| 364 | If an incoming schema name already exists and the schemas differ, |
| 365 | a warning is logged. The incoming schema always wins so that the |
| 366 | most-recently-registered route's models are used (matching the |
| 367 | behaviour of path registration). |
| 368 | """ |
| 369 | existing = self.openapi_spec["components"]["schemas"] |
| 370 | for name, schema in incoming.items(): |
| 371 | if name in existing and existing[name] != schema: |
| 372 | _logger.warning( |
| 373 | "OpenAPI component schema '%s' is defined by multiple models with different shapes — the later definition will be used", |
| 374 | name, |
| 375 | ) |
| 376 | existing[name] = schema |
| 377 | |
| 378 | def add_subrouter_paths(self, subrouter_openapi: "OpenAPI"): |
| 379 | """ |
no outgoing calls
no test coverage detected