Skip to content

Bug: ImproperlyConfiguredException — path parameters missing type annotation #9

@roebi

Description

@roebi

Bug: ImproperlyConfiguredException — path parameters missing type annotation

Describe the bug

apiup crashes at startup when the spec contains path parameters like {skillId}.

Error

litestar.exceptions.http_exceptions.ImproperlyConfiguredException:
Path parameters should be declared with a type using the following pattern:
'{parameter_name:type}', e.g. '/my-path/{my_param:int}'
in path: '/skills/{skillId}'

Root cause

OpenAPI uses {skillId} — Litestar requires {skillId:str}. No conversion was done between the two formats.

Fix

Add _openapi_path_to_litestar() in server.py using a regex substitution:

_PARAM_RE = re.compile(r"\{(\w+)\}")

def _openapi_path_to_litestar(path: str) -> str:
    return _PARAM_RE.sub(r"{\1:str}", path)

Labels

bug

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingtriage

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions