Skip to content

How to create parameters with regex patterns? #738

@PaulWay

Description

@PaulWay

Hi there!

I'm just coming to drf_spectacular after using drf_yasg for many years, and I'm having to change all my openapi.Parameter definitions over to OpenApiParameter. What's really puzzling me is that I can set type=OpenApiTypes.REGEX, but I cannot set a pattern when initialising the parameter. I understand that serializers can use Regex validators, but I can't see how to add a regex pattern to a parameter.

I'm prepared to write the code to support it, but I thought I'd check first the correct way of setting a regex pattern on a parameter.

Thanks in advance,

Paul

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestfix confirmation pendingissue has been fixed and confirmation from issue reporter is pending

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions