Skip to content

Attach x-pyramid-route-name to request type rather than path #326

Description

@JordanKadishTAL

I have a simple code example like this:

# openapi.yaml

/path/site/user:
    get:
        operationId: getUser
        ....
    post:
        operationId: addUser
        ....
    put:
        operationId: editUser
        ....

These each link to an @view_config() decorator akin to:

# handler.py
@view_config(
    route_name='getUser',
    request_method='GET',
    ...
)
def get_user():

and so on for the other two handler functions

This structure means I cannot use x-pyramid-route-name as this variable is at the same level as the request types

Solution:
If x-pyramid-route-name can be moved within the request type field, I could have something like:

# openapi.yaml

/path/site/user:
    get:
        x-pyramid-route-name: getUser
        operationId: getUser
        ....
    post:
        x-pyramid-route-name: addUser
        operationId: addUser
        ....
    put:
        x-pyramid-route-name: editUser
        operationId: editUser
        ....

Is there currently a way to do what I am trying to do (without having to add potentially hundreds of add_routes in my server.py)?
If not, please consider this change

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions