Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to add a pattern at a specified location #2114

Open
melina5656 opened this issue Jan 22, 2025 · 1 comment
Open

How to add a pattern at a specified location #2114

melina5656 opened this issue Jan 22, 2025 · 1 comment
Assignees
Labels
needs-area needs-info Mark an issue that needs reply from the author or it will be closed automatically

Comments

@melina5656
Copy link
Member

In this example, there is a KeyName = "hostName", which shows up in the operation parameters. The original swagger has pattern "^[-\w\._]+$" for this parameter.
I know there is a way to add patterns like this
But this applies pattern to all the resource operations. There is only a small portion of operations have this pattern.
Is there a way to add this pattern at a specified location?

@markcowl
Copy link
Member

markcowl commented Jan 22, 2025

@melina5656

  • You can either use the Pattern parameter in the ResourceName template, or an augment decorator for @@pattern, like this
  • It doesn't seem to make sense for some resource operations to have a pattern constraint on a resource name and others not to - either the resource has an allowed pattern for names or it doesn't. If there are old specs that have the pattern constraint on some operations for a resource but not others, that is likely a swagger mistake that we do not want to replicate. Since Azure clients do not implement pattern constraints in code, correcting a previous oversight in swagger would have no generated code impact and would improve the accuracy of the spec.

@markcowl markcowl assigned melina5656 and unassigned markcowl Jan 22, 2025
@markcowl markcowl added the needs-info Mark an issue that needs reply from the author or it will be closed automatically label Jan 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-area needs-info Mark an issue that needs reply from the author or it will be closed automatically
Projects
None yet
Development

No branches or pull requests

2 participants