Skip to content

Add OpenAPI Links support (#615)#1014

Open
kingdomOfIT wants to merge 2 commits intomarshmallow-code:devfrom
kingdomOfIT:feature/openapi-links
Open

Add OpenAPI Links support (#615)#1014
kingdomOfIT wants to merge 2 commits intomarshmallow-code:devfrom
kingdomOfIT:feature/openapi-links

Conversation

@kingdomOfIT
Copy link

Closes #615

Adds support for defining OpenAPI Links on path operations via the links
kwarg on APISpec.path(), as discussed in the issue with @zedrdave.

Links accept a dictionary of tuples in the format agreed with @lafrech:

links={
"GetUser": ("/users/{user_id}", "GET"),
"UpdateUser": ("/users/{user_id}", "PUT"),
"GetUserCustomParam": ("/users/{user_id}", "GET", {"user_id": "$response.body#/id"})
}

Implementation automatically uses operationId when the target operation
has one registered, falling back to operationRef with JSON Pointer escaping
when not. Links are only processed for OpenAPI 3+.

Copy link
Member

@lafrech lafrech left a comment

Choose a reason for hiding this comment

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

Thanks for contributing!

Just a few minor comments.

@kingdomOfIT kingdomOfIT requested a review from lafrech February 23, 2026 12:17
Copy link
Member

@lafrech lafrech left a comment

Choose a reason for hiding this comment

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

Thanks. This looks good.

There is indeed a lot of new tests, so OK for the new file, no big deal.

@lafrech
Copy link
Member

lafrech commented Feb 24, 2026

Leaving this open for a few days to let other users/maintainers give it a look.

Feel free to ping me if this gets out of my head and doesn't ship next week.

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.

Support for OpenAPI Links?

3 participants