Skip to content

fix: populate path_params when importing OpenAPI specs#355

Open
WeiMengze666 wants to merge 1 commit into
darrenburns:mainfrom
WeiMengze666:main
Open

fix: populate path_params when importing OpenAPI specs#355
WeiMengze666 wants to merge 1 commit into
darrenburns:mainfrom
WeiMengze666:main

Conversation

@WeiMengze666

Copy link
Copy Markdown

Description

When importing an OpenAPI spec, path parameters (e.g. {id} in
/example/{id}) were silently ignored:

  • The URL was stored with OpenAPI {param} syntax instead of being
    converted to posting's :param syntax.
  • path_params on the imported request was always empty, so path
    parameters could not be edited or substituted in the UI.
  • Path-item level parameters (shared across all operations on a path)
    were not read at all — only operation-level parameters were processed.

This affected both inline parameters and $ref parameters, and both
OpenAPI 3.0.x and 3.1.x specs.

Changes

  • Convert {param}:param in the URL when building each
    RequestModel during import.
  • Merge path-item level and operation level parameters per the OpenAPI
    spec: operation-level parameters override path-item parameters with
    the same (name, in) combination.
  • Populate request.path_params from parameters with in: path.

Testing

Five new tests added to tests/test_open_api_import.py:

  • test_import_inline_path_params — inline path params mixed with
    query params, OpenAPI 3.1
  • test_import_ref_path_params$ref path params, OpenAPI 3.1
    (the exact scenario from Can't use query parameters as References in path endpoints #292)
  • test_import_path_params_openapi_30 — inline path params,
    OpenAPI 3.0.x
  • test_import_path_item_level_params — path-item level params merged
    with operation-level params
  • test_import_path_item_params_operation_overrides — operation-level
    param overrides path-item param with same (name, in)

Fixes #292

@MLengl

MLengl commented May 27, 2026

Copy link
Copy Markdown

Just to be consistent and transparent - this should also be applied/automated for QueryParams which are also hidden/ignored at the URL field.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Can't use query parameters as References in path endpoints

2 participants