Skip to content

Conversation

@EnricoMi
Copy link
Collaborator

Adds applying schema to methods as a sub-command separate to apply schema to properties.

Supports

  • post, put and url parameters
  • introduces decorators to annotate methods to map to OpenAPI spec
  • supports rewrite and update modes

@github-actions
Copy link

github-actions bot commented Sep 12, 2025

Test Results

     7 files  ±0       7 suites  ±0   2m 42s ⏱️ +2s
 1 065 tests ±0   1 065 ✅ ±0  0 💤 ±0  0 ❌ ±0 
11 760 runs  ±0  11 759 ✅ ±0  1 💤 ±0  0 ❌ ±0 

Results for commit da64e5c. ± Comparison against base commit 61dcf49.

♻️ This comment has been updated with latest results.

def method_parameter(
name: str, *, required: bool = False, merge: list[str] | None = None, docstring_prepend: str | None = None
):
def openapi_property_decorator(fn):
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
def openapi_property_decorator(fn):
def openapi_method_decorator(fn):

def openapi_property_decorator(fn):
return fn

return openapi_property_decorator
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
return openapi_property_decorator
return openapi_method_decorator

Comment on lines +663 to +692
def openapi_property_decorator(fn):
return fn

return openapi_property_decorator
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
def openapi_property_decorator(fn):
return fn
return openapi_property_decorator
def openapi_method_decorator(fn):
return fn
return openapi_method_decorator

Comment on lines +1855 to +1931
for k, v in [
("name", cst_to_python(name)),
]
+ [
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove positional arguments

Suggested change
for k, v in [
("name", cst_to_python(name)),
]
+ [
for k, v in [


# decorator to annotate methods with method metadata
def method_parameter(
name: str, *, required: bool = False, merge: list[str] | None = None, docstring_prepend: str | None = None
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
name: str, *, required: bool = False, merge: list[str] | None = None, docstring_prepend: str | None = None
*, name: str, required: bool = False, merge: list[str] | None = None, docstring_prepend: str | None = None

]
+ [
(arg.keyword.value, cst_to_python(arg.value))
for arg in args[1:]
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
for arg in args[1:]
for arg in args

@EnricoMi EnricoMi force-pushed the openapi-apply-methods branch from 343e9db to da64e5c Compare November 26, 2025 14:51
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.

2 participants